wordpress/update-app.sh
2023-12-07 21:55:15 +00:00

40 lines
642 B
Bash
Executable file

#!/bin/sh
# 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 1 ]
then
echo "usage: ./update-app.sh \$app"
exit 0
fi
APP=$1
# download app
cd ~/wp-content/plugins
wget https://downloads.wordpress.org/plugin/$APP.zip
# install app
rm -rf $APP
unzip $APP.zip
# clean up
rm $APP.zip