0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-02-06 03:18:26 +01:00

Fix POSIX shell differences of Alpine and Debian in occ and occ-cron

Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
This commit is contained in:
Daniel Rudolf 2023-12-15 14:43:28 +01:00
parent 4ff550e4d0
commit 67d1ed534e
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538
2 changed files with 3 additions and 3 deletions

View file

@ -12,8 +12,8 @@ fi
RUN_AS="$(stat -c %U /var/www/html/cron.php)" RUN_AS="$(stat -c %U /var/www/html/cron.php)"
[ -n "$RUN_AS" ] && [ "$RUN_AS" != "UNKNOWN" ] || { echo "Unable to run \`occ-cron\`: Failed to determine www-data user" >&2 ; exit 1 ; } [ -n "$RUN_AS" ] && [ "$RUN_AS" != "UNKNOWN" ] || { echo "Unable to run \`occ-cron\`: Failed to determine www-data user" >&2 ; exit 1 ; }
if [ "$(id -u)" == 0 ]; then if [ "$(id -u)" = 0 ]; then
exec su -p "$RUN_AS" -s /bin/sh -c 'php -f /var/www/html/cron.php' -- '/bin/sh' exec su -p "$RUN_AS" -s /bin/sh -c 'exec php -f /var/www/html/cron.php' -- '/bin/sh'
else else
exec php -f /var/www/html/cron.php exec php -f /var/www/html/cron.php
fi fi

View file

@ -7,7 +7,7 @@ set -eu
RUN_AS="$(stat -c %U /var/www/html/occ)" RUN_AS="$(stat -c %U /var/www/html/occ)"
[ -n "$RUN_AS" ] && [ "$RUN_AS" != "UNKNOWN" ] || { echo "Unable to run \`occ\`: Failed to determine www-data user" >&2 ; exit 1 ; } [ -n "$RUN_AS" ] && [ "$RUN_AS" != "UNKNOWN" ] || { echo "Unable to run \`occ\`: Failed to determine www-data user" >&2 ; exit 1 ; }
if [ "$(id -u)" == 0 ]; then if [ "$(id -u)" = 0 ]; then
exec su -p "$RUN_AS" -s /bin/sh -c 'exec php -f /var/www/html/occ -- "$@"' -- '/bin/sh' "$@" exec su -p "$RUN_AS" -s /bin/sh -c 'exec php -f /var/www/html/occ -- "$@"' -- '/bin/sh' "$@"
else else
exec php -f /var/www/html/occ -- "$@" exec php -f /var/www/html/occ -- "$@"