summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-01-19 16:29:38 -0200
committerSilvio Rhatto <rhatto@riseup.net>2016-01-19 16:29:38 -0200
commit38710eeeeaa94dfbddd0bf3f82bfb308b1c3bb7b (patch)
tree1b9f133336c43f061ab090689d9f163e85881cc8
parent8e4e953bcb71b0ba4776014cae86c015f11c9409 (diff)
downloadpuppet-wordpress-38710eeeeaa94dfbddd0bf3f82bfb308b1c3bb7b.tar.gz
puppet-wordpress-38710eeeeaa94dfbddd0bf3f82bfb308b1c3bb7b.tar.bz2
Script: support for non-root user
-rw-r--r--files/wordpress.sh10
1 files 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