From 74eb7e649378ba8d095e9f7359cd5c74462b0b2f Mon Sep 17 00:00:00 2001 From: Shawn Mix <1activegeek@users.noreply.github.com> Date: Tue, 10 Sep 2024 20:47:14 -0400 Subject: [PATCH] s6 v3 Upgrade (#63) - Cleaned up old armv6 references - Updated to s6 v3 format for service launch - Altered run command to use -Z for non-interactive launch (this was missing piece for my primary issue in upgrading) - Simplified binary naming in dockerfile and launch scripts - Enhanced logging verbosity with extra details and formatting --- Dockerfile | 12 ++-- README.md | 13 +--- root/etc/cont-init.d/30-install | 59 ------------------- root/etc/s6-overlay/s6-rc.d/svc-aircast/run | 16 +++++ root/etc/s6-overlay/s6-rc.d/svc-aircast/type | 1 + root/etc/s6-overlay/s6-rc.d/svc-aircast/up | 1 + root/etc/s6-overlay/s6-rc.d/svc-airupnp/run | 16 +++++ root/etc/s6-overlay/s6-rc.d/svc-airupnp/type | 1 + root/etc/s6-overlay/s6-rc.d/svc-airupnp/up | 1 + .../s6-rc.d/user/contents.d/svc-aircast | 0 .../s6-rc.d/user/contents.d/svc-airupnp | 0 root/etc/services.d/airconnect/run | 3 - root/etc/supervisord.conf | 12 ---- 13 files changed, 44 insertions(+), 91 deletions(-) delete mode 100644 root/etc/cont-init.d/30-install create mode 100755 root/etc/s6-overlay/s6-rc.d/svc-aircast/run create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-aircast/type create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-aircast/up create mode 100755 root/etc/s6-overlay/s6-rc.d/svc-airupnp/run create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-airupnp/type create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-airupnp/up create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-aircast create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-airupnp delete mode 100644 root/etc/services.d/airconnect/run delete mode 100644 root/etc/supervisord.conf diff --git a/Dockerfile b/Dockerfile index c915335..e16c15e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,11 +13,13 @@ RUN apt-get update && apt-get install -y \ COPY root/ / # Grab latest version of the app, extract binaries, cleanup tmp dir -RUN if [ "$ARCH_VAR" = "amd64" ]; then ARCH_VAR=linux-x86_64; elif [ "$ARCH_VAR" = "arm64" ]; then ARCH_VAR=linux-aarch64; elif [ "$ARCH_VAR" = "arm" ]; then ARCH_VAR=linux-arm; fi \ +RUN if [ "$ARCH_VAR" = "amd64" ]; then ARCH_VAR=linux-x86_64; elif [ "$ARCH_VAR" = "arm64" ]; then ARCH_VAR=linux-aarch64; fi \ && curl -s https://api.github.com/repos/philippe44/AirConnect/releases/latest | grep browser_download_url | cut -d '"' -f 4 | xargs curl -L -o airconnect.zip \ && unzip airconnect.zip -d /tmp/ \ - && mv /tmp/airupnp-$ARCH_VAR /bin/airupnp-$ARCH_VAR \ - && mv /tmp/aircast-$ARCH_VAR /bin/aircast-$ARCH_VAR \ - && chmod +x /bin/airupnp-$ARCH_VAR \ - && chmod +x /bin/aircast-$ARCH_VAR \ + && mv /tmp/airupnp-$ARCH_VAR /usr/bin/airupnp-docker \ + && mv /tmp/aircast-$ARCH_VAR /usr/bin/aircast-docker \ + && chmod +x /usr/bin/airupnp-docker \ + && chmod +x /usr/bin/aircast-docker \ && rm -r /tmp/* + +ENTRYPOINT ["/init"] diff --git a/README.md b/README.md index 0c21d84..e964386 100644 --- a/README.md +++ b/README.md @@ -12,17 +12,6 @@ If you like what I've created, please consider contributing:
-# If you're reading this ... - -Please validate/test the dev version of this container image. I had to restructure the container on 7/15 due to upstream updates, leading to a complete rebuild of the startup/supervisor daemon system. - -Steps: -1. Run the current `latest` tag to ensure a working setup. -2. Use the `dev` tag to validate its functionality. -3. Report any errors or confirm it works by commenting on https://github.com/1activegeek/docker-airconnect/issues/62, including any special configurations used (ENV VARs, configs, etc.). - -I plan to run this for 2 weeks and push `dev` to `latest` by the end of July. Thank you for your help. - # docker-airconnect AirConnect container for turning Chromecast into Airplay targets On DockerHub: https://hub.docker.com/r/1activegeek/airconnect @@ -94,7 +83,7 @@ Unfortunately the base I use, has deprecated ARMv7 support. My only alternative
# Changelog -**2024-07-15:** Large change to update to support for s6 v3 since v2 has been deprecated by upstream container image provider. Simplified launch scritp, simplified service files, easier separation of both services, less "stuff" overall. Currently testing in Dev branch on Docker Hub. +**2024-07-15:** Large change to update to support for s6 v3 since v2 has been deprecated by upstream container image provider. Simplified launch scritp, simplified service files, easier separation of both services, less "stuff" overall. **2023-10-21:** Package maintainer changed the release asset output, had to move from tarball to zip package. No major change should be experienced as the output is still the same. Also added link in docs to an ARMv7 repo for those using older devices stuck on ARMv7 release maintained by [sidevesh](https://github.com/sidevesh).
**2023-07-08:** The LS.io team has officially deprecated building ARMv7 base images. Had to deprecate this support as well. Attempted to comment out in case changes happen in the future to remedy this.
**2022-11-28:** Some recent updates to handle changes by the original developer in formatting for binary file names. More efficient workflow runs as well. Added in output of tags for AirConnect versions, allowing you to specifically use a specific version of AirConnect.
diff --git a/root/etc/cont-init.d/30-install b/root/etc/cont-init.d/30-install deleted file mode 100644 index 1d6d16f..0000000 --- a/root/etc/cont-init.d/30-install +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/with-contenv bash - -if [ "$ARCH_VAR" == "amd64" ]; then - ARCH_VAR=linux-x86_64 -elif [ "$ARCH_VAR" == "arm64" ]; then - ARCH_VAR=linux-aarch64 -# elif [ "$ARCH_VAR" == "arm" ]; then -# ARCH_VAR=linux-arm -fi - -echo "Checking for valid arch options" -case $ARCH_VAR in - linux-x86_64) - echo "Proceeding with linux-x86_64 arch" - ;; - linux-aarch64) - echo "Proceeding with linux-aarch64 arch" - ;; - # linux-arm) - # echo "Proceeding with linux-arm arch" - # ;; - *) - echo "Unrecognized or invalid arch selection, CANCELING INSTALL" - echo "========== FAILURE DETECTED =========" - echo "YOUR CONTAINER WILL NOT WORK, PLEASE ADDRESS OR OPEN AN ISSUE" - exit 1 - ;; -esac - -# Adjusting process names in supervisord for Architecture differences -[ "$ARCH_VAR" != "linux-x86_64" ] && sed -i 's;process_name = airupnp-linux-x86_64;process_name = airupnp-'"$ARCH_VAR"';' /etc/supervisord.conf -[ "$ARCH_VAR" != "linux-x86_64" ] && sed -i 's;process_name = aircast-linux-x86_64;process_name = aircast-'"$ARCH_VAR"';' /etc/supervisord.conf - -UPNP=$(sed '4,7!d' /etc/supervisord.conf | grep -c '^#') -CAST=$(sed '9,12!d' /etc/supervisord.conf | grep -c '^#') - -# Check if VAR is empty, and assign arch / if not empty, run with command and assign arch / if kill, and hasn't run (=0) then comment out -if [ -z "$AIRUPNP_VAR" ]; then - sed -i 's;command=/bin/airupnp-linux-x86_64 -l 1000:2000;command=/bin/airupnp-'"$ARCH_VAR"' -l 1000:2000;' /etc/supervisord.conf -elif [ "$AIRUPNP_VAR" != "kill" ]; then - sed -i 's;command=/bin/airupnp-linux-x86_64 -l 1000:2000;command=/bin/airupnp-'"$ARCH_VAR $AIRUPNP_VAR"';' /etc/supervisord.conf -elif [ "$AIRUPNP_VAR" = "kill" ] && [ "$UPNP" = 0 ]; then - for i in {4..7} - do - sed -i ''$i'{s/^/#/}' /etc/supervisord.conf - done -fi - -# Check if VAR is empty, and assign arch / if not empty, run with command and assign arch / if kill, and hasn't run (=0) then comment out -if [ -z "$AIRCAST_VAR" ]; then - sed -i 's;command=/bin/aircast-linux-x86_64;command=/bin/aircast-'"$ARCH_VAR"';' /etc/supervisord.conf -elif [ "$AIRCAST_VAR" != "kill" ]; then - sed -i 's;command=/bin/aircast-linux-x86_64;command=/bin/aircast-'"$ARCH_VAR $AIRCAST_VAR"';' /etc/supervisord.conf -elif [ "$AIRCAST_VAR" = "kill" ] && [ "$CAST" = 0 ]; then - for i in {9..12} - do - sed -i ''$i'{s/^/#/}' /etc/supervisord.conf - done -fi diff --git a/root/etc/s6-overlay/s6-rc.d/svc-aircast/run b/root/etc/s6-overlay/s6-rc.d/svc-aircast/run new file mode 100755 index 0000000..6c39c06 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-aircast/run @@ -0,0 +1,16 @@ +#!/usr/bin/with-contenv bash + +echo "[AirConnect-AIRCAST] Launching AIRCAST ..." +# Check for VAR - default, kill, custom +if [ -z "$AIRCAST_VAR" ]; then + echo "[AirConnect-AIRCAST] AIRCAST_VAR is NOT present, launching with standard launch variables" + exec /usr/bin/aircast-docker -Z +elif [ "$AIRCAST_VAR" = "kill" ]; then + echo "[AirConnect-AIRCAST] AIRCAST_VAR set to kill, skipping aircast service launch" + exit 0 +else + echo "[AirConnect-AIRCAST] AIRCAST_VAR is present, launching with custom launch variables: $AIRCAST_VAR" + exec /usr/bin/aircast-docker -Z $AIRCAST_VAR +fi + +echo "[AirConnect-AIRCAST] AIRCAST launch sequence complete ..." \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-aircast/type b/root/etc/s6-overlay/s6-rc.d/svc-aircast/type new file mode 100644 index 0000000..3d92b15 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-aircast/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-aircast/up b/root/etc/s6-overlay/s6-rc.d/svc-aircast/up new file mode 100644 index 0000000..5b212be --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-aircast/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/svc-aircast/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-airupnp/run b/root/etc/s6-overlay/s6-rc.d/svc-airupnp/run new file mode 100755 index 0000000..ab80df0 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-airupnp/run @@ -0,0 +1,16 @@ +#!/usr/bin/with-contenv bash + +echo "[AirConnect-AIRUPNP] Launching AIRUPNP ..." +# Check for VAR - default, kill, custom +if [ -z "$AIRUPNP_VAR" ]; then + echo "[AirConnect-AIRUPNP] AIRUPNP_VAR is NOT present, launching with standard launch variables" + exec /usr/bin/airupnp-docker -Z -l 1000:2000 +elif [ "$AIRUPNP_VAR" = "kill" ]; then + echo "[AirConnect-AIRUPNP] AIRUPNP_VAR set to kill, skipping AIRUPNP service launch" + exit 0 +else + echo "[AirConnect-AIRUPNP] AIRUPNP_VAR is present, launching with custom launch variables: $AIRUPNP_VAR" + exec /usr/bin/airupnp-docker -Z $AIRUPNP_VAR +fi + +echo "[AirConnect-AIRUPNP] AIRUPNP launch sequence complete ..." \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-airupnp/type b/root/etc/s6-overlay/s6-rc.d/svc-airupnp/type new file mode 100644 index 0000000..3d92b15 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-airupnp/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-airupnp/up b/root/etc/s6-overlay/s6-rc.d/svc-airupnp/up new file mode 100644 index 0000000..e115a3e --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-airupnp/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/svc-airupnp/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-aircast b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-aircast new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-airupnp b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-airupnp new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/services.d/airconnect/run b/root/etc/services.d/airconnect/run deleted file mode 100644 index b06647d..0000000 --- a/root/etc/services.d/airconnect/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/with-contenv bash - -supervisord --nodaemon --configuration /etc/supervisord.conf \ No newline at end of file diff --git a/root/etc/supervisord.conf b/root/etc/supervisord.conf deleted file mode 100644 index da7768f..0000000 --- a/root/etc/supervisord.conf +++ /dev/null @@ -1,12 +0,0 @@ -[supervisord] -nodaemon=true - -[program:airupnp] -redirect_stderr=true -command=/bin/airupnp-linux-x86_64 -l 1000:2000 -process_name = airupnp-linux-x86_64 - -[program:aircast] -redirect_stderr=true -command=/bin/aircast-linux-x86_64 -process_name = aircast-linux-x86_64