mirror of
https://github.com/myvesta/vesta.git
synced 2024-12-21 11:31:21 -08:00
82 lines
2.0 KiB
Bash
Executable File
82 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: update web templates
|
|
# options: [RESTART]
|
|
#
|
|
# The function for obtaining updated pack of web templates.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
restart=$1
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Defining config host
|
|
chost='c.myvestacp.com'
|
|
|
|
# Detcing OS
|
|
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
|
|
if [ -e '/etc/redhat-release' ]; then
|
|
release=$(grep -o "[0-9]" /etc/redhat-release |head -n1)
|
|
else
|
|
release=6
|
|
fi
|
|
fi
|
|
if [ "$version" = 'ubuntu' ]; then
|
|
release=$(lsb_release -r |awk '{print $2}')
|
|
fi
|
|
if [ "$version" = 'debian' ]; then
|
|
release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
|
|
fi
|
|
|
|
# Defining download url
|
|
vestacp="http://$chost/$version/$release"
|
|
|
|
# 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
|
|
|
|
# Rebuilding web domains
|
|
for user in $($BIN/v-list-sys-users plain); do
|
|
$BIN/v-rebuild-web-domains $user no
|
|
done
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Restarting web server
|
|
$BIN/v-restart-web $restart
|
|
check_result $? "restart" >/dev/null 2>&1
|
|
|
|
$BIN/v-restart-proxy $restart
|
|
check_result $? "restart" >/dev/null 2>&1
|
|
|
|
$BIN/v-restart-proxy $restart
|
|
check_result $? "restart" >/dev/null 2>&1
|
|
|
|
exit
|