-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugins.sh
70 lines (51 loc) · 2.15 KB
/
plugins.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
##############################################################################################
# WORDPRESS PLUGINS
##############################################################################################
# Chown Contnet Folder
# sudo chown -R www-data:www-data /var/www/html/wp-content
sudo chown -R www-data:www-data /usr/src/wordpress/wp-content
if [ "$1" ]; then
printf "=> Checking plugins...\n"
while read line; do
# ignore commented and empty lines
case $line in
''|\#*) continue ;; # skip blank lines and lines starting with #
esac
plugin=$(echo $line | awk '{print $1}')
version=$(echo $line | awk '{print $2}')
printf "=> Downloading $plugin"
download="$plugin"
# Download from URL
if [[ $download =~ .*https.* ]]; then
# get the filename to extract ( handles github download where the filename is master.zip )
plugindirname="${download##*/}"
# download and unzip
# wget $download && unzip -o $plugindirname -d /var/www/html/wp-content/plugins/
wget $download && unzip -o $plugindirname -d /usr/src/wordpress/wp-content/plugins/
# delete zip file
rm $plugindirname
# Download from Wordpress
else
if [ ! "$version" ]; then
printf " [latest] ...\n"
download="$download.zip"
else
printf " $version ...\n"
download="$download.$version.zip"
fi
# download and unzip
# wget https://downloads.wordpress.org/plugin/$download && unzip -o $download -d /var/www/html/wp-content/plugins/
wget https://downloads.wordpress.org/plugin/$download && unzip -o $download -d /usr/src/wordpress/wp-content/plugins/
# delete zip file
rm $download
fi
# printf "=> Extracted Plugin to /var/www/html/wp-content/plugins/$plugin \n"
printf "=> Extracted Plugin to /usr/src/wordpress/wp-content/plugins/$plugin \n"
done <$1
else
printf "=> No plugin dependencies listed. SKIPPING...\n"
fi
# Chown Contnet Folder Again
# sudo chown -R www-data:www-data /var/www/html/wp-content
sudo chown -R www-data:www-data /usr/src/wordpress/wp-content