forked from outroll/vesta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathv-update-web-templates
executable file
·80 lines (63 loc) · 1.86 KB
/
v-update-web-templates
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
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# info: updates web templates
# options: [RESTART]
#
# The function for obtaining updated pack of web templates.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
restart=$1
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Find out OS name
if [ -e "/etc/redhat-release" ]; then
os="rhel"
else
os="ubuntu"
fi
# Get new archive
tmpdir=$(mktemp -d --dry-run)
mkdir $tmpdir
cd $tmpdir
wget http://c.vestacp.com/$VERSION/$os/templates.tar.gz -q
if [ "$?" -ne 0 ]; then
echo "Error: can't download template.tar.gz"
log_event "$E_CONNECT" "$EVENT"
rm -rf $tmpdir
exit $E_CONNECT
fi
# Update templates
tar -xzpf templates.tar.gz -C $VESTA/data/ templates/web
# Replace includes for apache2.4
if [ "$WEB_SYSTEM" = 'httpd' ] || [ "$WEB_SYSTEM" = 'apache2' ]; then
if [ ! -z "$(/usr/sbin/apachectl -v | grep 'Apache/2.4')" ]; then
sed -i "s/Include /IncludeOptional /g" \
$VESTA/data/templates/web/$WEB_SYSTEM/*tpl
fi
fi
# Rebuild web domains
for user in $($BIN/v-list-sys-users plain); do
$BIN/v-rebuild-web-domains $user no
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restart web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
$BIN/v-restart-proxy
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
fi
# Delete tmpdir
rm -rf $tmpdir
exit