From 45bfb53f616525fab34b6ca57bc93e4e3f7ac814 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sun, 9 Feb 2025 17:16:38 +0100 Subject: [PATCH] Try align new logic https://github.com/alexbelgium/hassio-addons/issues/1750#issuecomment-2645026370 https://github.com/alexbelgium/hassio-addons/issues/1757 https://github.com/alexbelgium/hassio-addons/issues/1758 --- fireflyiii/CHANGELOG.md | 1 + fireflyiii/Dockerfile | 26 ++++++++++++++++----- fireflyiii/config.json | 5 ++-- fireflyiii/rootfs/etc/cont-init.d/99-run.sh | 4 ++-- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/fireflyiii/CHANGELOG.md b/fireflyiii/CHANGELOG.md index 418144634..d79a65ece 100644 --- a/fireflyiii/CHANGELOG.md +++ b/fireflyiii/CHANGELOG.md @@ -1,3 +1,4 @@ +- Try adapt new logic ## 20250205.2 (08-02-2025) - Update to latest version from firefly-iii/firefly-iii (changelog : https://github.com/firefly-iii/firefly-iii/releases) diff --git a/fireflyiii/Dockerfile b/fireflyiii/Dockerfile index 3cd3e361a..dd856f16f 100644 --- a/fireflyiii/Dockerfile +++ b/fireflyiii/Dockerfile @@ -27,14 +27,12 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \ S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ S6_SERVICES_GRACETIME=0 - #ENV FIREFLY_III_PATH="/data/firefly" #WORKDIR $FIREFLY_III_PATH #RUN \ # # Change data location # grep -rl "/var/www/html" /etc/ | xargs sed -i 's|/var/www/html|/data/firefly|g' -ARG BUILD_UPSTREAM="6.1.16" RUN \ # Change upload folder to "ha_upload" since the default one is binded to a volume (see base image) sed -i "s/'root' => storage_path('upload'),/'root' => storage_path('ha_upload'),/g" /var/www/html/config/filesystems.php @@ -59,7 +57,7 @@ ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templat RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh # Manual apps -ENV PACKAGES="cron mariadb-client" +ENV PACKAGES="cron mariadb-client sudo" # Automatic apps & bashio ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_autoapps.sh" "/ha_autoapps.sh" @@ -70,16 +68,32 @@ RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" && rm /ha_autoapps. ################ # Add entrypoint -ENV S6_STAGE2_HOOK=/ha_entrypoint.sh +#ENV S6_STAGE2_HOOK=/ha_entrypoint.sh ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint.sh" "/ha_entrypoint.sh" # Entrypoint modifications ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint_modif.sh" "/ha_entrypoint_modif.sh" RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/ha_entrypoint.sh" ] -ENTRYPOINT [ "/usr/bin/env" ] -CMD [ "/ha_entrypoint.sh" ] +# Adapt shebang +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN \ + # Run as www-data + sed -i "s|/usr|exec sudo -Eu www-data /usr|g" /etc/s6*/s6*/php-fpm/run && \ + # Move execute things + mkdir -p /scripts && \ + mv /etc/entrypoint.d/11-execute-things.sh /scripts/ && \ + # Allow passwordless root + echo "www-data ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ + # Change output lots + sed -i "s|/proc/self/fd/2|/log_php|g" /etc/entrypoint.d/1-log-output-level.sh && \ + grep -rl "/proc/self/fd/2" /usr/local/etc | while read -r files; do sed -i "s|/proc/self/fd/2|/log_php|g" "$files"; done && \ + touch /log_php && chown www-data:www-data /log_php && \ + # Adapt files + for files in /etc/cont-init.d/*; do sed -i "s|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g" "$files"; done ############ # 5 Labels # diff --git a/fireflyiii/config.json b/fireflyiii/config.json index f837ef4f2..39ef49aed 100644 --- a/fireflyiii/config.json +++ b/fireflyiii/config.json @@ -1,8 +1,7 @@ { "arch": [ "aarch64", - "amd64", - "armv7" + "amd64" ], "codenotary": "alexandrep.github@gmail.com", "description": "A free and open source personal finance manager", @@ -107,6 +106,6 @@ "startup": "services", "udev": true, "url": "https://github.com/alexbelgium/hassio-addons", - "version": "20250205.2", + "version": "20250205.2-2", "webui": "[PROTO:ssl]://[HOST]:[PORT:8080]" } diff --git a/fireflyiii/rootfs/etc/cont-init.d/99-run.sh b/fireflyiii/rootfs/etc/cont-init.d/99-run.sh index d0f36463c..f2246d87a 100755 --- a/fireflyiii/rootfs/etc/cont-init.d/99-run.sh +++ b/fireflyiii/rootfs/etc/cont-init.d/99-run.sh @@ -180,7 +180,7 @@ bashio::log.info "Please wait while the app is loading !" if bashio::config.true 'silent'; then bashio::log.warning "Silent mode activated. Only errors will be shown. Please disable in addon options if you need to debug" - /./usr/local/bin/entrypoint.sh >/dev/null + sudo -Eu www-data bash -c 'cd /var/www/html && /scripts/11-execute-things.sh >/dev/null' else - /./usr/local/bin/entrypoint.sh + sudo -Eu www-data bash -c 'cd /var/www/html && /scripts/11-execute-things.sh' fi