Skip to content

Commit de24641

Browse files
fix(entrypoint): compare enabled app names when reporting disabled apps (#2554)
Extract the disabled-app reporting logic into a helper and compare normalized enabled app names instead of parsing diff output from full `occ app:list` snapshots. This fixes false positives where apps upgraded during `occ upgrade` were reported as disabled because their version line changed, and avoids reliance on diff output format differences on Alpine/BusyBox. Fixes #1911 Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent 5e8f859 commit de24641

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

docker-entrypoint.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ file_env() {
8181
unset "$fileVar"
8282
}
8383

84+
get_enabled_apps() {
85+
run_as 'php /var/www/html/occ app:list' \
86+
| sed -n '/^Enabled:$/,/^Disabled:$/p' \
87+
| sed '1d;$d' \
88+
| sed -n 's/^ - \([^:]*\):.*/\1/p' \
89+
| sort
90+
}
91+
8492
# Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
8593
configure_redis_session() {
8694
echo "=> Configuring PHP session handler..."
@@ -188,7 +196,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
188196
exit 1
189197
fi
190198
echo "Upgrading nextcloud from $installed_version ..."
191-
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
199+
get_enabled_apps > /tmp/list_before
192200
fi
193201
if [ "$(id -u)" = 0 ]; then
194202
rsync_options="-rlDog --chown $user:$group"
@@ -286,9 +294,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
286294

287295
run_as 'php /var/www/html/occ upgrade'
288296

289-
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
290-
echo "The following apps have been disabled:"
291-
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
297+
get_enabled_apps > /tmp/list_after
298+
disabled_apps="$(comm -23 /tmp/list_before /tmp/list_after || true)"
299+
if [ -n "$disabled_apps" ]; then
300+
echo "The following apps have been disabled:"
301+
printf '%s\n' "$disabled_apps"
302+
fi
292303
rm -f /tmp/list_before /tmp/list_after
293304

294305
run_path post-upgrade

0 commit comments

Comments
 (0)