From 7f39930c561728ee3c262a3024d5722abbe8ff0d Mon Sep 17 00:00:00 2001 From: missytake Date: Mon, 14 Jun 2021 11:17:20 +0200 Subject: [PATCH] Make it easier to run this script if preconditions are missing --- update-app.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/update-app.sh b/update-app.sh index d0e65e9..52e39df 100755 --- a/update-app.sh +++ b/update-app.sh @@ -3,6 +3,21 @@ # fail script if one command fails set -e +# check if unprivileged +if [ $(id -u) -eq 0] + then + echo "Please do not run this script as root." + exit 0 +fi + +# check file permissions +if [[ -w ~/wp-content/plugins ]] + then + echo "Missing file permissions. To fix this, run this command as root:" + echo " chown $USER /home/$USER/wp-content/plugins -R" + exit 0 +fi + # we need at least one argument if [ $# -eq 0 ] then