From 8c8ff785884b89a564433e5368b8911f40b2d454 Mon Sep 17 00:00:00 2001 From: wiedehopf Date: Fri, 13 Sep 2024 16:34:11 +0200 Subject: [PATCH] fixup python dependency / cleanup (#199) * fixup python dependencies, better cleanup * use stop_service if service isn't needed --- Dockerfile | 11 +++++++---- rootfs/etc/s6-overlay/scripts/978raw-splitter | 5 +++-- rootfs/etc/s6-overlay/scripts/beast-splitter | 5 +++-- rootfs/etc/s6-overlay/scripts/dump1090 | 5 +++-- rootfs/etc/s6-overlay/scripts/dump978 | 5 +++-- rootfs/etc/s6-overlay/scripts/skyaware978 | 5 +++-- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 217cc26..5f6ecbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,8 +44,10 @@ RUN set -x && \ TEMP_PACKAGES+=(libfftw3-dev) && \ # mlat-client dependencies KEPT_PACKAGES+=(python3-minimal) && \ - KEPT_PACKAGES+=(python3-distutils) && \ + KEPT_PACKAGES+=(python3-pkg-resources) && \ + TEMP_PACKAGES+=(python3-distutils) && \ TEMP_PACKAGES+=(python3-dev) && \ + TEMP_PACKAGES+=(python3-setuptools) && \ # piaware dependencies KEPT_PACKAGES+=(itcl3) && \ KEPT_PACKAGES+=(tcllib) && \ @@ -203,10 +205,11 @@ RUN set -x && \ curl -L -o "$BLADERF_RBF_PATH/adsbx115.rbf" https://www.nuand.com/fpga/adsbx115.rbf && \ # Clean up apt-get remove -y ${TEMP_PACKAGES[@]} && \ - apt-get autoremove -y && \ + apt-get autoremove -q -o APT::Autoremove::RecommendsImportant=0 -o APT::Autoremove::SuggestsImportant=0 -y && \ apt-get clean -y && \ - rm -rf /src /tmp/* /var/lib/apt/lists/* && \ - find /var/log -type f -iname "*log" -exec truncate --size 0 {} \; && \ + # remove pycache + find /usr | grep -E "/__pycache__$" | xargs rm -rf || true && \ + rm -rf /src /tmp/* /var/lib/apt/lists/* /var/log/* /var/cache/* && \ # Store container version grep piaware /VERSIONS | cut -d " " -f 2 > /IMAGE_VERSION diff --git a/rootfs/etc/s6-overlay/scripts/978raw-splitter b/rootfs/etc/s6-overlay/scripts/978raw-splitter index 6cfca78..848b0ce 100755 --- a/rootfs/etc/s6-overlay/scripts/978raw-splitter +++ b/rootfs/etc/s6-overlay/scripts/978raw-splitter @@ -2,10 +2,11 @@ # shellcheck shell=bash set -eo pipefail +source /scripts/common + # Don't continue if UAT_RECEIVER_HOST isn't set if [[ -z "$UAT_RECEIVER_HOST" ]]; then - sleep 86400 - exit 0 + stop_service fi # shellcheck disable=SC2016 diff --git a/rootfs/etc/s6-overlay/scripts/beast-splitter b/rootfs/etc/s6-overlay/scripts/beast-splitter index 81c3257..0001407 100755 --- a/rootfs/etc/s6-overlay/scripts/beast-splitter +++ b/rootfs/etc/s6-overlay/scripts/beast-splitter @@ -2,10 +2,11 @@ # shellcheck shell=bash set -eo pipefail +source /scripts/common + # Don't continue if BEASTHOST isn't set if [[ -z "$BEASTHOST" ]]; then - sleep 86400 - exit 0 + stop_service fi # Prepare beast-splitter command line diff --git a/rootfs/etc/s6-overlay/scripts/dump1090 b/rootfs/etc/s6-overlay/scripts/dump1090 index aa7c059..d2a9234 100755 --- a/rootfs/etc/s6-overlay/scripts/dump1090 +++ b/rootfs/etc/s6-overlay/scripts/dump1090 @@ -2,6 +2,8 @@ # shellcheck shell=bash set -eo pipefail +source /scripts/common + # Don't continue if ADSB not used if [[ -n "$BEASTHOST" ]]; then RUN_DUMP1090="true" @@ -13,8 +15,7 @@ if [[ -n "$RECEIVER_TYPE" ]]; then RUN_DUMP1090="true" fi if [[ -z "$RUN_DUMP1090" ]]; then - sleep 86400 - exit 0 + stop_service fi mkdir -p /run/dump1090-fa diff --git a/rootfs/etc/s6-overlay/scripts/dump978 b/rootfs/etc/s6-overlay/scripts/dump978 index 2ec6509..d3aa115 100755 --- a/rootfs/etc/s6-overlay/scripts/dump978 +++ b/rootfs/etc/s6-overlay/scripts/dump978 @@ -1,6 +1,8 @@ #!/command/with-contenv bash #shellcheck shell=bash +source /scripts/common + # Don't continue if UAT not used if [[ -n "$UAT_RECEIVER_TYPE" ]]; then if [[ "$UAT_RECEIVER_TYPE" != "none" ]]; then @@ -11,8 +13,7 @@ if [[ -n "$UAT_RECEIVER_TYPE" ]]; then fi if [[ -z "$RUN_DUMP978" ]]; then - sleep 86400 - exit 0 + stop_service fi diff --git a/rootfs/etc/s6-overlay/scripts/skyaware978 b/rootfs/etc/s6-overlay/scripts/skyaware978 index b7c062b..e235c06 100755 --- a/rootfs/etc/s6-overlay/scripts/skyaware978 +++ b/rootfs/etc/s6-overlay/scripts/skyaware978 @@ -1,6 +1,8 @@ #!/command/with-contenv bash #shellcheck shell=bash +source /scripts/common + # Don't continue if UAT not used if [[ -n "$UAT_RECEIVER_HOST" ]]; then RUN_SKYAWARE978="true" @@ -13,8 +15,7 @@ if [[ -n "$UAT_RECEIVER_TYPE" ]]; then fi if [[ -z "$RUN_SKYAWARE978" ]]; then - sleep 86400 - exit 0 + stop_service fi mkdir -p /run/skyaware978