Created
November 19, 2018 12:35
-
-
Save wabson/d0395777918a3d7430b4eb4854add263 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z "$1" -o -z "$2" ]; then | |
echo "Usage: $0 <target-dir> 1|0" | |
exit 1 | |
fi | |
targets="$1/wp-content/plugins $1/wp-content/themes"; | |
if [ "$2" -eq 1 ]; then | |
owner="www-data:www-data" | |
elif [ "$2" -eq 0 ]; then | |
owner="wabson:wabson" | |
else | |
echo "Unsupported action $2" | |
exit 1 | |
fi | |
if [ ! -d "$1/wp-content/plugins" ]; then | |
echo "Cannot find wp-content/plugins folder" | |
exit 1 | |
fi | |
if [ ! -d "$1/wp-content/themes" ]; then | |
echo "Cannot find wp-content/themes folder" | |
exit 1 | |
fi | |
if [ ! -d "$1/wp-content/upgrade" ]; then | |
echo "Warning: Cannot find wp-content/upgrade folder" | |
else | |
targets="$targets $1/wp-content/upgrade" | |
fi | |
chown -R $owner $targets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment