only initialize / update when the command is apache* or php-fpm (do nothing on thins like bash, echo)

This commit is contained in:
Marc Brückner 2018-09-13 14:36:50 +02:00
parent f5d3234fca
commit a3cce50b00
10 changed files with 680 additions and 660 deletions

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi fi
} }
installed_version="0.0.0.0" if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
if [ -f /var/www/html/version.php ]; then installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi fi
# shellcheck disable=SC2016 # shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1 exit 1
fi fi
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
fi
fi fi
exec "$@" exec "$@"