0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-07-08 17:54:09 +02:00
This commit is contained in:
PizZaKatZe 2025-06-17 12:43:58 +00:00 committed by GitHub
commit 5e9f44d25c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 150 additions and 110 deletions

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/bash
set -eu set -euo pipefail
# version_greater A B returns whether A > B # version_greater A B returns whether A > B
version_greater() { version_greater() {
@ -67,8 +67,10 @@ file_env() {
local var="$1" local var="$1"
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") local varValue
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") local fileVarValue
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1 exit 1
@ -80,7 +82,6 @@ file_env() {
elif [ -n "${def}" ]; then elif [ -n "${def}" ]; then
export "$var"="$def" export "$var"="$def"
fi fi
unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then if expr "$1" : "apache" 1>/dev/null; then
@ -186,12 +187,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
rsync_options="-rlD" rsync_options="-rlD"
fi fi
# shellcheck disable=SC2086
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
for dir in config data custom_apps themes; do for dir in config data custom_apps themes; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
# shellcheck disable=SC2086
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
fi fi
done done
# shellcheck disable=SC2086
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/ rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
# Install # Install
@ -240,7 +244,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
echo "Starting nextcloud installation" echo "Starting nextcloud installation"
max_retries=10 max_retries=10
try=0 try=0
until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options" until [ "$try" -gt "$max_retries" ] || run_as "php /var/www/html/occ maintenance:install $install_options"
do do
echo "Retrying install..." echo "Retrying install..."
try=$((try+1)) try=$((try+1))
@ -252,21 +256,21 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\""
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation
fi fi
fi fi
# not enough specified to do a fully automated installation # not enough specified to do a fully automated installation
if [ "$install" = false ]; then if [ "$install" = false ]; then
echo "Next step: Access your instance to finish the web-based installation!" echo "Next step: Access your instance to finish the web-based installation!"
echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation." echo "Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation."
fi fi