Skip to content

Commit 2dd18db

Browse files
committed
Rewrite template update scripts to copy from dep package as source.
1 parent eac4f66 commit 2dd18db

File tree

2 files changed

+38
-37
lines changed

2 files changed

+38
-37
lines changed

bin/v-update-dns-templates

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,31 @@ restart=$1
1616
source $HESTIA/func/main.sh
1717
source $HESTIA/conf/hestia.conf
1818

19+
# Detect OS
20+
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
21+
Debian) type="debian" ;;
22+
Ubuntu) type="ubuntu" ;;
23+
*) type="NoSupport" ;;
24+
esac
25+
26+
# Detect version
27+
if [ "$type" = "ubuntu" ]; then
28+
release="$(lsb_release -s -r)"
29+
elif [ "$type" = "ubuntu" ]; then
30+
release=$(cat /etc/debian_version|grep -o [0-9]|head -n1)
31+
else
32+
echo "Error: can't detect supported os"
33+
log_event "$E_NOTEXIST"
34+
exit $E_NOTEXIST
35+
fi
36+
1937

2038
#----------------------------------------------------------#
2139
# Action #
2240
#----------------------------------------------------------#
2341

24-
# Get new archive
25-
tmpdir=$(mktemp -d --dry-run)
26-
mkdir $tmpdir
27-
cd $tmpdir
28-
wget http://c.hestiacp.com/rhel/7/templates.tar.gz -q
29-
if [ "$?" -ne 0 ]; then
30-
echo "Error: can't download template.tar.gz"
31-
log_event "$E_CONNECT" "$ARGUMENTS"
32-
rm -rf $tmpdir
33-
exit $E_CONNECT
34-
fi
35-
3642
# Update templates
37-
tar -xzpf templates.tar.gz -C $HESTIA/data/ templates/dns
43+
cp -rf $HESTIA/install/$type/$release/templates/dns $HESTIA/data/templates/
3844

3945

4046
#----------------------------------------------------------#

bin/v-update-web-templates

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,31 @@ restart=$1
1616
source $HESTIA/func/main.sh
1717
source $HESTIA/conf/hestia.conf
1818

19-
20-
#----------------------------------------------------------#
21-
# Action #
22-
#----------------------------------------------------------#
23-
24-
# Detcing OS
25-
case $(head -n1 /etc/issue |cut -f 1 -d ' ') in
26-
Debian) version="debian" ;;
27-
Ubuntu) version="ubuntu" ;;
28-
*) version="NotSupported" ;;
19+
# Detect OS
20+
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
21+
Debian) type="debian" ;;
22+
Ubuntu) type="ubuntu" ;;
23+
*) type="NoSupport" ;;
2924
esac
3025

31-
# Detecting release
32-
if [ "$version" = 'ubuntu' ]; then
33-
release=$(lsb_release -r |awk '{print $2}')
34-
fi
35-
if [ "$version" = 'debian' ]; then
36-
release=$(cat /etc/issue|grep -o [0-9]|head -n1)
37-
fi
38-
if [ "$version" = 'NotSupported' ]; then
39-
echo "No Supported OS Version found, abort."
40-
exit 1
26+
# Detect version
27+
if [ "$type" = "ubuntu" ]; then
28+
release="$(lsb_release -s -r)"
29+
elif [ "$type" = "ubuntu" ]; then
30+
release=$(cat /etc/debian_version|grep -o [0-9]|head -n1)
31+
else
32+
echo "Error: can't detect supported os"
33+
log_event "$E_NOTEXIST"
34+
exit $E_NOTEXIST
4135
fi
4236

43-
# Defining template path
44-
hestiacp="$HESTIA/install/$version/$release"
4537

46-
# Updating templates
47-
cp -rf $hestiacp/templates/web $HESTIA/data/templates/
38+
#----------------------------------------------------------#
39+
# Action #
40+
#----------------------------------------------------------#
4841

42+
# Update templates
43+
cp -rf $HESTIA/install/$type/$release/templates/web $HESTIA/data/templates/
4944

5045
# Rebuilding web domains
5146
for user in $($BIN/v-list-sys-users plain); do

0 commit comments

Comments
 (0)