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
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"

View File

@ -19,20 +19,21 @@ run_as() {
fi
}
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
if expr "$1" : "apache*" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
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?"
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
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
@ -96,6 +97,7 @@ if version_greater "$image_version" "$installed_version"; then
rm -f /tmp/list_before /tmp/list_after
fi
fi
fi
exec "$@"