Update paperless-ngx addon to 2.20.15 and realign with upstream s6-overlay

Upstream paperless-ngx switched to an s6-overlay v3 init system at v2.15.0
(ENTRYPOINT ["/init"]) and removed the legacy /sbin/docker-entrypoint.sh that
this add-on patched. The add-on had therefore been broken since the 2.15.x bump.

- Inject initialization via S6_STAGE2_HOOK=/ha_entrypoint.sh instead of patching
  the now-removed upstream entrypoint
- Export runtime variables to the s6 container_environment so the upstream
  supervised services (svc-webserver, svc-worker, svc-scheduler, svc-consumer)
  pick them up
- Use the canonical ha_entrypoint.sh template (remove the outdated bundled copy)
- Add 00-global_var module + jq for env_vars passthrough
- Guard the ImageMagick policy patch and the optional nginx/redis startup
- Bump version and updater tracking to 2.20.15
This commit is contained in:
Claude
2026-06-05 18:17:45 +00:00
parent d9d359aea0
commit c6c7171ff8
6 changed files with 57 additions and 89 deletions

View File

@@ -1,3 +1,6 @@
## 2.20.15 (2026-06-05)
- Update to latest version from paperless-ngx/paperless-ngx (changelog : https://github.com/paperless-ngx/paperless-ngx/releases)
- Realign the add-on with upstream's s6-overlay v3 init system: upstream removed the legacy `/sbin/docker-entrypoint.sh`, so initialization is now injected through the s6 stage-2 hook (`S6_STAGE2_HOOK=/ha_entrypoint.sh`) and runtime variables are exported to the s6 container environment that feeds the supervised services (svc-webserver, svc-worker, svc-scheduler, svc-consumer)
- Added support for configuring extra environment variables via the `env_vars` add-on option alongside config.yaml. See https://github.com/alexbelgium/hassio-addons/wiki/Add-Environment-variables-to-your-Addon-2 for details. - Added support for configuring extra environment variables via the `env_vars` add-on option alongside config.yaml. See https://github.com/alexbelgium/hassio-addons/wiki/Add-Environment-variables-to-your-Addon-2 for details.
## 2.15.1 (2025-04-12) ## 2.15.1 (2025-04-12)

View File

@@ -45,14 +45,16 @@ RUN if [ ! -f /bin/sh ] && [ -f /usr/bin/sh ]; then ln -s /usr/bin/sh /bin/sh; f
if [ ! -f /bin/bash ] && [ -f /usr/bin/bash ]; then ln -s /usr/bin/bash /bin/bash; fi if [ ! -f /bin/bash ] && [ -f /usr/bin/bash ]; then ln -s /usr/bin/bash /bin/bash; fi
# Modules # Modules
ARG MODULES="00-banner.sh 00-local_mounts.sh 00-smb_mounts.sh 01-custom_script.sh" ARG MODULES="00-banner.sh 00-global_var.sh 00-local_mounts.sh 00-smb_mounts.sh 01-custom_script.sh"
# Automatic modules download # Automatic modules download
COPY ha_automodules.sh /ha_automodules.sh COPY ha_automodules.sh /ha_automodules.sh
RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh
# Manual apps # Manual apps
ENV PACKAGES="redis-server" # redis-server: paperless-ngx expects an external broker, provided by this add-on
# jq: required by the 00-global_var module for env_vars passthrough
ENV PACKAGES="redis-server jq"
# Automatic apps & bashio # Automatic apps & bashio
COPY ha_autoapps.sh /ha_autoapps.sh COPY ha_autoapps.sh /ha_autoapps.sh
@@ -63,22 +65,21 @@ RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" && rm /ha_autoapps.
################ ################
# Add entrypoint # Add entrypoint
#ENV S6_STAGE2_HOOK=/ha_entrypoint.sh # Upstream paperless-ngx ships an s6-overlay v3 init (ENTRYPOINT ["/init"]) and no
#COPY ha_entrypoint.sh /ha_entrypoint.sh # longer provides /sbin/docker-entrypoint.sh, so initialization is injected through
# the s6 stage-2 hook instead of patching the upstream entrypoint.
ENV S6_STAGE2_HOOK=/ha_entrypoint.sh
COPY ha_entrypoint.sh /ha_entrypoint.sh
RUN chmod 777 /ha_entrypoint.sh RUN chmod 777 /ha_entrypoint.sh
# Install bashio # Install bashio
COPY bashio-standalone.sh /usr/local/lib/bashio-standalone.sh COPY bashio-standalone.sh /usr/local/lib/bashio-standalone.sh
RUN chmod 0755 /usr/local/lib/bashio-standalone.sh RUN chmod 0755 /usr/local/lib/bashio-standalone.sh
# Add custom scripts # Activate imagemagick (upstream already ships a paperless policy; guard for safety)
RUN sed -i "2a source /ha_entrypoint.sh" /sbin/docker-entrypoint.sh && \ RUN if [ -f /etc/ImageMagick-6/policy.xml ]; then \
sed -i "s=/\.=source =g" /ha_entrypoint.sh && \ sed -i "s/rights=\"none\"/rights=\"read|write\"/g" /etc/ImageMagick-6/policy.xml; \
sed -i "s=env bash=env bashio=g" /sbin/docker-entrypoint.sh fi
RUN \
# Activate imagemagick
sed -i "s/rights=\"none\"/rights=\"read|write\"/g" /etc/ImageMagick-6/policy.xml
#ENTRYPOINT [ "/usr/bin/env" ] #ENTRYPOINT [ "/usr/bin/env" ]
#CMD [ "/ha_entrypoint.sh" ] #CMD [ "/ha_entrypoint.sh" ]

View File

@@ -130,5 +130,5 @@ slug: paperless_ng
stage: deprecated stage: deprecated
udev: true udev: true
url: https://github.com/alexbelgium/hassio-addons url: https://github.com/alexbelgium/hassio-addons
version: 2.14.7 version: 2.20.15
webui: http://[HOST]:[PORT:8000] webui: http://[HOST]:[PORT:8000]

View File

@@ -25,9 +25,13 @@ if bashio::config.has_value "PAPERLESS_MEDIA_ROOT"; then export PAPERLESS_MEDIA_
if bashio::config.has_value "PAPERLESS_CONSUMPTION_DIR"; then export PAPERLESS_CONSUMPTION_DIR="$(bashio::config "PAPERLESS_CONSUMPTION_DIR")"; fi if bashio::config.has_value "PAPERLESS_CONSUMPTION_DIR"; then export PAPERLESS_CONSUMPTION_DIR="$(bashio::config "PAPERLESS_CONSUMPTION_DIR")"; fi
if bashio::config.has_value "PAPERLESS_EXPORT_DIR"; then export PAPERLESS_EXPORT_DIR="$(bashio::config "PAPERLESS_EXPORT_DIR")"; fi if bashio::config.has_value "PAPERLESS_EXPORT_DIR"; then export PAPERLESS_EXPORT_DIR="$(bashio::config "PAPERLESS_EXPORT_DIR")"; fi
# Redis is provided by this add-on (paperless-ngx expects an external broker)
export PAPERLESS_REDIS="redis://localhost:6379"
# Create folder and permissions if needed # Create folder and permissions if needed
chown -R paperless:paperless /config chown -R paperless:paperless /config || true
for variable in "$PAPERLESS_DATA_DIR" "$PAPERLESS_MEDIA_ROOT" "$PAPERLESS_CONSUMPTION_DIR" "$PAPERLESS_EXPORT_DIR"; do for variable in "$PAPERLESS_DATA_DIR" "$PAPERLESS_MEDIA_ROOT" "$PAPERLESS_CONSUMPTION_DIR" "$PAPERLESS_EXPORT_DIR"; do
[ -z "$variable" ] && continue
echo "Creating directory \"$variable\"" echo "Creating directory \"$variable\""
mkdir -p "$variable" mkdir -p "$variable"
chmod -R 755 "$variable" chmod -R 755 "$variable"
@@ -77,8 +81,20 @@ esac
set +u set +u
#############################
# Export to s6 environment #
#############################
# Upstream now runs on s6-overlay v3: variables are shared with the supervised
# services (svc-webserver, svc-worker, ...) by writing them to the s6
# container_environment, which is read by `with-contenv` when each service starts.
S6_ENV_DIR=""
for candidate in /var/run/s6/container_environment /run/s6/container_environment; do
if [ -d "$candidate" ]; then S6_ENV_DIR="$candidate"; break; fi
done
# For all relevant variables # For all relevant variables
for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DIR PAPERLESS_EXPORT_DIR USERMAP_UID USERMAP_GID PAPERLESS_TIME_ZONE PAPERLESS_URL PAPERLESS_OCR_LANGUAGES PAPERLESS_OCR_MODE PAPERLESS_ADMIN_PASSWORD PAPERLESS_ADMIN_USER PAPERLESS_DBENGINE PAPERLESS_DBHOST PAPERLESS_DBPORT PAPERLESS_DBNAME PAPERLESS_DBUSER PAPERLESS_DBPASS; do for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DIR PAPERLESS_EXPORT_DIR USERMAP_UID USERMAP_GID PAPERLESS_TIME_ZONE PAPERLESS_URL PAPERLESS_OCR_LANGUAGES PAPERLESS_OCR_MODE PAPERLESS_ADMIN_PASSWORD PAPERLESS_ADMIN_USER PAPERLESS_REDIS PAPERLESS_DBENGINE PAPERLESS_DBHOST PAPERLESS_DBPORT PAPERLESS_DBNAME PAPERLESS_DBUSER PAPERLESS_DBPASS; do
# Skip if not defined # Skip if not defined
if [[ -z "$(eval echo "\$$variable")" ]]; then continue; fi if [[ -z "$(eval echo "\$$variable")" ]]; then continue; fi
@@ -87,12 +103,7 @@ for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DI
variablecontent="$(eval echo "\$$variable")" variablecontent="$(eval echo "\$$variable")"
# Sanitize " ' ` in current variable # Sanitize " ' ` in current variable
variablecontent="${variablecontent//[\"\'\`]/}" variablecontent="${variablecontent//[\"\'\`]/}"
#if [[ "$variablecontent" = *" "* ]] && [[ "$variable" != "PAPERLESS_OCR_LANGUAGES" ]]; then
# variablecontent="\"$variablecontent\""
#fi
bashio::log.blue "$variable=\"$variablecontent\"" bashio::log.blue "$variable=\"$variablecontent\""
# Add to entrypoint
sed -i "1a export $variable=\"$variablecontent\"" /sbin/docker-entrypoint.sh
# Export # Export
export "$variable"="$variablecontent" export "$variable"="$variablecontent"
# Add to bashrc # Add to bashrc
@@ -102,23 +113,35 @@ for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DI
# set /etc/environment # set /etc/environment
mkdir -p /etc mkdir -p /etc
echo "$variable=\"$variablecontent\"" >> /etc/environment echo "$variable=\"$variablecontent\"" >> /etc/environment
# For s6 # For s6 (read by the upstream supervised services via with-contenv)
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${variablecontent}" > /var/run/s6/container_environment/"${variable}"; fi if [ -n "$S6_ENV_DIR" ]; then printf "%s" "${variablecontent}" > "$S6_ENV_DIR/${variable}"; fi
done done
################# #################
# Staring redis # # Staring redis #
################# #################
exec redis-server & if command -v redis-server > /dev/null 2>&1; then
bashio::log.info "Starting redis" bashio::log.info "Starting redis"
redis-server &
else
bashio::log.fatal "redis-server is not installed; paperless-ngx requires it as broker"
fi
################# #################
# Staring nginx # # Staring nginx #
################# #################
exec nginx & # nginx is only used for the optional SSL endpoint (port 8443). The web UI is
bashio::log.info "Starting nginx" # served directly by the upstream svc-webserver on port 8000 regardless.
if command -v nginx > /dev/null 2>&1; then
bashio::log.info "Starting nginx"
nginx &
else
bashio::log.warning "nginx not installed; skipping the optional SSL proxy (the web UI stays available on port 8000)"
fi
############### ################
# Starting app # # Starting app #
############### ################
# The upstream s6-overlay init (svc-webserver, svc-worker, svc-scheduler,
# svc-consumer, svc-flower) is started by s6 once this stage-2 hook returns.
bashio::log.info "Initial username and password are admin. Please change in the administration panel of the webUI after login." bashio::log.info "Initial username and password are admin. Please change in the administration panel of the webUI after login."

View File

@@ -1,59 +0,0 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
echo "Starting..."
####################
# Starting scripts #
####################
for SCRIPTS in /etc/cont-init.d/*; do
[ -e "$SCRIPTS" ] || continue
echo "$SCRIPTS: executing"
# Check if run as root
if test "$(id -u)" == 0 && test "$(id -u)" == 0; then
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
chmod a+x "$SCRIPTS"
else
bashio::log.warning "Script executed with user $(id -u):$(id -g), things can break and chown won't work"
# Disable chown and chmod in scripts
sed -i "s/^chown /true # chown /g" "$SCRIPTS"
sed -i "s/ chown / true # chown /g" "$SCRIPTS"
sed -i "s/^chmod /true # chmod /g" "$SCRIPTS"
sed -i "s/ chmod / true # chmod /g" "$SCRIPTS"
fi
# Get current shebang, if not available use another
currentshebang="$(sed -n '1{s/^#![[:blank:]]*//p;q}' "$SCRIPTS")"
if [ ! -f "${currentshebang%% *}" ]; then
for shebang in "/command/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/bin/bash" "/bin/sh"; do if [ -f "${shebang%% *}" ]; then break; fi; done
sed -i "s|$currentshebang|$shebang|g" "$SCRIPTS"
fi
# Use source to share env variables when requested
if [ "${ha_entry_source:-null}" = true ] && command -v "source" &> /dev/null; then
# Exit cannot be used with source
sed -i "s/(.*\s|^)exit ([0-9]+)/\1 return \2 || exit \2/g" "$SCRIPTS"
sed -i "s/bashio::exit.nok/return 1/g" "$SCRIPTS"
sed -i "s/bashio::exit.ok/return 0/g" "$SCRIPTS"
# shellcheck source=/dev/null
source "$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?"
else
# Support for posix only shell
/."$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?"
fi
# Cleanup
rm "$SCRIPTS"
done
######################
# Starting container #
######################
echo " "
echo -e "\033[0;32mStarting the upstream container\033[0m"
echo " "
# Launch lsio mods
if [ -f /docker-mods ]; then exec /docker-mods; fi

View File

@@ -1,11 +1,11 @@
{ {
"github_beta": "false", "github_beta": "false",
"github_fulltag": "false", "github_fulltag": "false",
"last_update": "12-04-2025", "last_update": "05-06-2026",
"paused": true, "paused": true,
"repository": "alexbelgium/hassio-addons", "repository": "alexbelgium/hassio-addons",
"slug": "paperless_ng", "slug": "paperless_ng",
"source": "github", "source": "github",
"upstream_repo": "paperless-ngx/paperless-ngx", "upstream_repo": "paperless-ngx/paperless-ngx",
"upstream_version": "2.15.1" "upstream_version": "2.20.15"
} }