wordpress/update-app.sh

40 lines
642 B
Bash
Raw Normal View History

2021-06-14 09:04:31 +00:00
#!/bin/sh
2021-06-14 09:07:30 +00:00
# fail script if one command fails
set -e
# check if unprivileged
2021-06-14 09:20:13 +00:00
if [ $(id -u) -eq 0 ]
then
echo "Please do not run this script as root."
exit 0
fi
# check file permissions
2021-06-14 09:20:13 +00:00
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
2021-06-14 09:07:30 +00:00
# we need at least one argument
2021-06-14 09:20:13 +00:00
if [ ! $# -eq 1 ]
2021-06-14 09:04:31 +00:00
then
echo "usage: ./update-app.sh \$app"
exit 0
fi
APP=$1
2021-06-14 09:07:30 +00:00
# download app
2021-06-14 09:04:31 +00:00
cd ~/wp-content/plugins
wget https://downloads.wordpress.org/plugin/$APP.zip
2021-06-14 09:07:30 +00:00
# install app
2021-06-14 09:04:31 +00:00
rm -rf $APP
unzip $APP.zip
2021-06-14 09:07:30 +00:00
# clean up
rm $APP.zip