mirror of
https://github.com/nextcloud/docker.git
synced 2025-03-15 19:05:09 +01:00
fix version check without volume var/www/html
This commit is contained in:
parent
cb71d98f72
commit
04c3222cb8
10 changed files with 240 additions and 30 deletions
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
|
@ -6,6 +6,11 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# version_equal A B returns whether A = B
|
||||||
|
version_equal() {
|
||||||
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" = "$1" ]
|
||||||
|
}
|
||||||
|
|
||||||
# return true if specified directory is empty
|
# return true if specified directory is empty
|
||||||
directory_empty() {
|
directory_empty() {
|
||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
|
@ -21,9 +26,9 @@ run_as() {
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
|
||||||
installed_version="0.0.0.0"
|
installed_version="0.0.0.0"
|
||||||
if [ -f /var/www/html/version.php ]; then
|
if [ -f /var/www/html/config/config.php ]; then
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
installed_version="$(awk '$1 ~ /version/ { print $3 }' /var/www/html/config/config.php | grep -oP "(?<=').*(?=')")"
|
||||||
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);')"
|
||||||
|
@ -33,6 +38,22 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if version_equal "$installed_version" "$image_version"; then
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
rsync_options="-rlDog --chown www-data:root"
|
||||||
|
else
|
||||||
|
rsync_options="-rlD"
|
||||||
|
fi
|
||||||
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||||
|
|
||||||
|
for dir in config data custom_apps themes; do
|
||||||
|
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||||
|
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Initializing finished"
|
||||||
|
fi
|
||||||
|
|
||||||
if version_greater "$image_version" "$installed_version"; then
|
if version_greater "$image_version" "$installed_version"; then
|
||||||
echo "Initializing nextcloud $image_version ..."
|
echo "Initializing nextcloud $image_version ..."
|
||||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||||
|
@ -90,7 +111,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install" = true ]; then
|
if [ "$install" = true ]; then
|
||||||
echo "starting nextcloud installation"
|
echo "starting nexcloud installation"
|
||||||
max_retries=10
|
max_retries=10
|
||||||
try=0
|
try=0
|
||||||
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
until run_as "php /var/www/html/occ maintenance:install $install_options" || [ "$try" -gt "$max_retries" ]
|
||||||
|
|
Loading…
Add table
Reference in a new issue