mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 13:24:25 -07:00
new web template scheme
This commit is contained in:
parent
0c25d7f4ae
commit
bcc02c858d
1 changed files with 39 additions and 36 deletions
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# info: updates web templates
|
# info: update web templates
|
||||||
# options: [RESTART]
|
# options: [RESTART]
|
||||||
#
|
#
|
||||||
# The function for obtaining updated pack of web templates.
|
# The function for obtaining updated pack of web templates.
|
||||||
|
@ -21,37 +21,40 @@ source $VESTA/conf/vesta.conf
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Find out OS name
|
# Defining config host
|
||||||
if [ -e "/etc/redhat-release" ]; then
|
chost='c.vestacp.com'
|
||||||
os="rhel"
|
|
||||||
else
|
# Detcing OS
|
||||||
os="ubuntu"
|
case $(head -n1 /etc/issue |cut -f 1 -d ' ') in
|
||||||
|
Debian) version="debian" ;;
|
||||||
|
Ubuntu) version="ubuntu" ;;
|
||||||
|
*) version="rhel" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Detecting release
|
||||||
|
if [ "$version" = 'rhel' ]; then
|
||||||
|
release=$(grep -o "[0-9]" /etc/redhat-release |head -n1)
|
||||||
|
fi
|
||||||
|
if [ "$version" = 'ubuntu' ]; then
|
||||||
|
release=$(lsb_release -r |awk '{print $2}')
|
||||||
|
fi
|
||||||
|
if [ "$version" = 'debian' ]; then
|
||||||
|
release=$(cat /etc/issue|grep -o [0-9]|head -n1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get new archive
|
# Defining download url
|
||||||
tmpdir=$(mktemp -d --dry-run)
|
vestacp="http://$chost/$version/$release"
|
||||||
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
|
# Downloading template archive
|
||||||
|
cd $(mktemp -d)
|
||||||
|
wget $vestacp/templates.tar.gz -q
|
||||||
|
|
||||||
|
check_result $? "can't download template.tar.gz" $E_CONNECT
|
||||||
|
|
||||||
|
# Updating templates
|
||||||
tar -xzpf templates.tar.gz -C $VESTA/data/ templates/web
|
tar -xzpf templates.tar.gz -C $VESTA/data/ templates/web
|
||||||
|
|
||||||
# Replace includes for apache2.4
|
# Rebuilding web domains
|
||||||
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
|
for user in $($BIN/v-list-sys-users plain); do
|
||||||
$BIN/v-rebuild-web-domains $user no
|
$BIN/v-rebuild-web-domains $user no
|
||||||
done
|
done
|
||||||
|
@ -61,20 +64,20 @@ done
|
||||||
# Vesta #
|
# Vesta #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Restart web server
|
# Restarting web server
|
||||||
if [ "$restart" != 'no' ]; then
|
if [ "$restart" != 'no' ]; then
|
||||||
$BIN/v-restart-web
|
$BIN/v-restart-web
|
||||||
if [ $? -ne 0 ]; then
|
check_result $? "restart" >/dev/null 2>&1
|
||||||
exit $E_RESTART
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
if [ ! -z "$PROXY_SYSTTEM" ]; then
|
||||||
$BIN/v-restart-proxy
|
$BIN/v-restart-proxy
|
||||||
if [ $? -ne 0 ]; then
|
check_result $? "restart" >/dev/null 2>&1
|
||||||
exit $E_RESTART
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Delete tmpdir
|
if [ ! -z "$WEB_BACKEND" ]; then
|
||||||
rm -rf $tmpdir
|
$BIN/v-restart-proxy
|
||||||
|
check_result $? "restart" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue