From 38710eeeeaa94dfbddd0bf3f82bfb308b1c3bb7b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 19 Jan 2016 16:29:38 -0200 Subject: Script: support for non-root user --- files/wordpress.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/files/wordpress.sh b/files/wordpress.sh index 773eab7..055f204 100644 --- a/files/wordpress.sh +++ b/files/wordpress.sh @@ -7,6 +7,7 @@ BASE="/var/www/data" LOCALE="-pt_BR" WP_CLI="/usr/local/bin/wp-cli" BASENAME="`basename $0`" +WHOAMI="`whoami`" # Set alternative base function wordpress_set_base { @@ -45,7 +46,10 @@ function wordpress_deploy { wget http://br.wordpress.org/wordpress-$new$LOCALE.zip unzip wordpress-$new$LOCALE.zip && rm wordpress-$new$LOCALE.zip mv wordpress wordpress-$new/ - chown -R root.root wordpress-$new/ + + if [ "$WHOAMI" == "root" ]; then + chown -R root.root wordpress-$new/ + fi } # Upgrade a wordpress instance using upstream source. @@ -107,7 +111,9 @@ function wordpress_upgrade { done # Fix permissions - chown -R root.root wordpress-$new/wp-content/{plugins,themes} + if [ "$WHOAMI" == "root" ]; then + chown -R root.root wordpress-$new/wp-content/{plugins,themes} + fi # Set sunrise symlink if [ -f "wordpress-$new/wp-content/plugins/wordpress-mu-domain-mapping/sunrise.php" ]; then -- cgit v1.2.3