From 69b4a015ed7c21cd829f9747e0209fb80604e7b3 Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Thu, 10 Aug 2017 14:53:11 +0200 Subject: [PATCH] Fix permissions when running as root --- 10.0/apache/docker-entrypoint.sh | 16 ++++------------ 10.0/fpm/docker-entrypoint.sh | 16 ++++------------ 11.0/apache/docker-entrypoint.sh | 16 ++++------------ 11.0/fpm/docker-entrypoint.sh | 16 ++++------------ 12.0/apache/docker-entrypoint.sh | 16 ++++------------ 12.0/fpm/docker-entrypoint.sh | 16 ++++------------ docker-entrypoint.sh | 16 ++++------------ 7 files changed, 28 insertions(+), 84 deletions(-) diff --git a/10.0/apache/docker-entrypoint.sh b/10.0/apache/docker-entrypoint.sh index 61242d41..9298bb47 100755 --- a/10.0/apache/docker-entrypoint.sh +++ b/10.0/apache/docker-entrypoint.sh @@ -35,26 +35,18 @@ if version_greater "$image_version" "$installed_version"; then run_as 'php /var/www/html/occ app:list' > /tmp/list_before fi if [[ $EUID -eq 0 ]]; then - rsync_options=-a + rsync_options="-rlDog --chown www-data:root" else - rsync_options=-rlD + rsync_options="-rlD" fi rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data themes; do + for dir in config data custom_apps 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" + rsync $rsync_options --include /"$dir"/ --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done - 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 run_as '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 61242d41..9298bb47 100755 --- a/10.0/fpm/docker-entrypoint.sh +++ b/10.0/fpm/docker-entrypoint.sh @@ -35,26 +35,18 @@ if version_greater "$image_version" "$installed_version"; then run_as 'php /var/www/html/occ app:list' > /tmp/list_before fi if [[ $EUID -eq 0 ]]; then - rsync_options=-a + rsync_options="-rlDog --chown www-data:root" else - rsync_options=-rlD + rsync_options="-rlD" fi rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data themes; do + for dir in config data custom_apps 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" + rsync $rsync_options --include /"$dir"/ --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done - 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 run_as '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 61242d41..9298bb47 100755 --- a/11.0/apache/docker-entrypoint.sh +++ b/11.0/apache/docker-entrypoint.sh @@ -35,26 +35,18 @@ if version_greater "$image_version" "$installed_version"; then run_as 'php /var/www/html/occ app:list' > /tmp/list_before fi if [[ $EUID -eq 0 ]]; then - rsync_options=-a + rsync_options="-rlDog --chown www-data:root" else - rsync_options=-rlD + rsync_options="-rlD" fi rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data themes; do + for dir in config data custom_apps 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" + rsync $rsync_options --include /"$dir"/ --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done - 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 run_as '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 61242d41..9298bb47 100755 --- a/11.0/fpm/docker-entrypoint.sh +++ b/11.0/fpm/docker-entrypoint.sh @@ -35,26 +35,18 @@ if version_greater "$image_version" "$installed_version"; then run_as 'php /var/www/html/occ app:list' > /tmp/list_before fi if [[ $EUID -eq 0 ]]; then - rsync_options=-a + rsync_options="-rlDog --chown www-data:root" else - rsync_options=-rlD + rsync_options="-rlD" fi rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data themes; do + for dir in config data custom_apps 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" + rsync $rsync_options --include /"$dir"/ --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done - 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 run_as '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 61242d41..9298bb47 100755 --- a/12.0/apache/docker-entrypoint.sh +++ b/12.0/apache/docker-entrypoint.sh @@ -35,26 +35,18 @@ if version_greater "$image_version" "$installed_version"; then run_as 'php /var/www/html/occ app:list' > /tmp/list_before fi if [[ $EUID -eq 0 ]]; then - rsync_options=-a + rsync_options="-rlDog --chown www-data:root" else - rsync_options=-rlD + rsync_options="-rlD" fi rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data themes; do + for dir in config data custom_apps 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" + rsync $rsync_options --include /"$dir"/ --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done - 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 run_as '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 61242d41..9298bb47 100755 --- a/12.0/fpm/docker-entrypoint.sh +++ b/12.0/fpm/docker-entrypoint.sh @@ -35,26 +35,18 @@ if version_greater "$image_version" "$installed_version"; then run_as 'php /var/www/html/occ app:list' > /tmp/list_before fi if [[ $EUID -eq 0 ]]; then - rsync_options=-a + rsync_options="-rlDog --chown www-data:root" else - rsync_options=-rlD + rsync_options="-rlD" fi rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data themes; do + for dir in config data custom_apps 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" + rsync $rsync_options --include /"$dir"/ --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done - 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 run_as 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 61242d41..9298bb47 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -35,26 +35,18 @@ if version_greater "$image_version" "$installed_version"; then run_as 'php /var/www/html/occ app:list' > /tmp/list_before fi if [[ $EUID -eq 0 ]]; then - rsync_options=-a + rsync_options="-rlDog --chown www-data:root" else - rsync_options=-rlD + rsync_options="-rlD" fi rsync $rsync_options --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ --exclude /themes/ /usr/src/nextcloud/ /var/www/html/ - for dir in config data themes; do + for dir in config data custom_apps 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" + rsync $rsync_options --include /"$dir"/ --exclude '/*' /usr/src/nextcloud/ /var/www/html/ fi done - 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 run_as 'php /var/www/html/occ upgrade --no-app-disable'