]> gitweb.fluxo.info Git - puppet-wordpress.git/commitdiff
Script: support for non-root user
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 19 Jan 2016 18:29:38 +0000 (16:29 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 19 Jan 2016 18:29:38 +0000 (16:29 -0200)
files/wordpress.sh

index 773eab78e7144d64e160107ab90205be89553c59..055f2041373ef95f0e80d7ac794a8bfaf7d17b79 100644 (file)
@@ -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