From 4d0972ed3533d3c6bce085855897a353b9f61400 Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Thu, 29 Jun 2017 15:33:58 +0200 Subject: [PATCH] Ensure apps.config.php get only copied when upgrading from old version --- 10.0/apache/docker-entrypoint.sh | 8 ++++++-- 10.0/fpm/docker-entrypoint.sh | 8 ++++++-- 11.0/apache/docker-entrypoint.sh | 8 ++++++-- 11.0/fpm/docker-entrypoint.sh | 8 ++++++-- 12.0/apache/docker-entrypoint.sh | 8 ++++++-- 12.0/fpm/docker-entrypoint.sh | 8 ++++++-- docker-entrypoint.sh | 8 ++++++-- 7 files changed, 42 insertions(+), 14 deletions(-) diff --git a/10.0/apache/docker-entrypoint.sh b/10.0/apache/docker-entrypoint.sh index 31d3e6ce..f073581e 100755 --- a/10.0/apache/docker-entrypoint.sh +++ b/10.0/apache/docker-entrypoint.sh @@ -29,16 +29,20 @@ if version_greater "$image_version" "$installed_version"; then fi rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data custom_apps themes; do + for dir in config data themes; do if [ ! -d /var/www/html/"$dir" ] || directory_empty /var/www/html/"$dir"; then cp -arT /usr/src/nextcloud/"$dir" /var/www/html/"$dir" fi done - if [ ! -f /var/www/html/config/apps.config.php ]; then + if [ ! -d /var/www/html/custom_apps ] && [ ! -f /var/www/html/config/apps.config.php ]; then cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php fi + if [ ! -d /var/www/html/custom_apps ] || directory_empty /var/www/html/custom_apps; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + fi + if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/10.0/fpm/docker-entrypoint.sh b/10.0/fpm/docker-entrypoint.sh index 31d3e6ce..f073581e 100755 --- a/10.0/fpm/docker-entrypoint.sh +++ b/10.0/fpm/docker-entrypoint.sh @@ -29,16 +29,20 @@ if version_greater "$image_version" "$installed_version"; then fi rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data custom_apps themes; do + for dir in config data themes; do if [ ! -d /var/www/html/"$dir" ] || directory_empty /var/www/html/"$dir"; then cp -arT /usr/src/nextcloud/"$dir" /var/www/html/"$dir" fi done - if [ ! -f /var/www/html/config/apps.config.php ]; then + if [ ! -d /var/www/html/custom_apps ] && [ ! -f /var/www/html/config/apps.config.php ]; then cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php fi + if [ ! -d /var/www/html/custom_apps ] || directory_empty /var/www/html/custom_apps; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + fi + if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/11.0/apache/docker-entrypoint.sh b/11.0/apache/docker-entrypoint.sh index 31d3e6ce..f073581e 100755 --- a/11.0/apache/docker-entrypoint.sh +++ b/11.0/apache/docker-entrypoint.sh @@ -29,16 +29,20 @@ if version_greater "$image_version" "$installed_version"; then fi rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data custom_apps themes; do + for dir in config data themes; do if [ ! -d /var/www/html/"$dir" ] || directory_empty /var/www/html/"$dir"; then cp -arT /usr/src/nextcloud/"$dir" /var/www/html/"$dir" fi done - if [ ! -f /var/www/html/config/apps.config.php ]; then + if [ ! -d /var/www/html/custom_apps ] && [ ! -f /var/www/html/config/apps.config.php ]; then cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php fi + if [ ! -d /var/www/html/custom_apps ] || directory_empty /var/www/html/custom_apps; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + fi + if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/11.0/fpm/docker-entrypoint.sh b/11.0/fpm/docker-entrypoint.sh index 31d3e6ce..f073581e 100755 --- a/11.0/fpm/docker-entrypoint.sh +++ b/11.0/fpm/docker-entrypoint.sh @@ -29,16 +29,20 @@ if version_greater "$image_version" "$installed_version"; then fi rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data custom_apps themes; do + for dir in config data themes; do if [ ! -d /var/www/html/"$dir" ] || directory_empty /var/www/html/"$dir"; then cp -arT /usr/src/nextcloud/"$dir" /var/www/html/"$dir" fi done - if [ ! -f /var/www/html/config/apps.config.php ]; then + if [ ! -d /var/www/html/custom_apps ] && [ ! -f /var/www/html/config/apps.config.php ]; then cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php fi + if [ ! -d /var/www/html/custom_apps ] || directory_empty /var/www/html/custom_apps; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + fi + if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/12.0/apache/docker-entrypoint.sh b/12.0/apache/docker-entrypoint.sh index 31d3e6ce..f073581e 100755 --- a/12.0/apache/docker-entrypoint.sh +++ b/12.0/apache/docker-entrypoint.sh @@ -29,16 +29,20 @@ if version_greater "$image_version" "$installed_version"; then fi rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data custom_apps themes; do + for dir in config data themes; do if [ ! -d /var/www/html/"$dir" ] || directory_empty /var/www/html/"$dir"; then cp -arT /usr/src/nextcloud/"$dir" /var/www/html/"$dir" fi done - if [ ! -f /var/www/html/config/apps.config.php ]; then + if [ ! -d /var/www/html/custom_apps ] && [ ! -f /var/www/html/config/apps.config.php ]; then cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php fi + if [ ! -d /var/www/html/custom_apps ] || directory_empty /var/www/html/custom_apps; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + fi + if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/12.0/fpm/docker-entrypoint.sh b/12.0/fpm/docker-entrypoint.sh index 31d3e6ce..f073581e 100755 --- a/12.0/fpm/docker-entrypoint.sh +++ b/12.0/fpm/docker-entrypoint.sh @@ -29,16 +29,20 @@ if version_greater "$image_version" "$installed_version"; then fi rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data custom_apps themes; do + for dir in config data themes; do if [ ! -d /var/www/html/"$dir" ] || directory_empty /var/www/html/"$dir"; then cp -arT /usr/src/nextcloud/"$dir" /var/www/html/"$dir" fi done - if [ ! -f /var/www/html/config/apps.config.php ]; then + if [ ! -d /var/www/html/custom_apps ] && [ ! -f /var/www/html/config/apps.config.php ]; then cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php fi + if [ ! -d /var/www/html/custom_apps ] || directory_empty /var/www/html/custom_apps; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + fi + if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 31d3e6ce..f073581e 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -29,16 +29,20 @@ if version_greater "$image_version" "$installed_version"; then fi rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data custom_apps themes; do + for dir in config data themes; do if [ ! -d /var/www/html/"$dir" ] || directory_empty /var/www/html/"$dir"; then cp -arT /usr/src/nextcloud/"$dir" /var/www/html/"$dir" fi done - if [ ! -f /var/www/html/config/apps.config.php ]; then + if [ ! -d /var/www/html/custom_apps ] && [ ! -f /var/www/html/config/apps.config.php ]; then cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php fi + if [ ! -d /var/www/html/custom_apps ] || directory_empty /var/www/html/custom_apps; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + fi + if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable'