forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhst-migration.sh
More file actions
102 lines (83 loc) · 2.7 KB
/
Copy pathhst-migration.sh
File metadata and controls
102 lines (83 loc) · 2.7 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# Hestia installation wrapper
# https://www.hestiacp.com
#
# Currently Supported Operating Systems:
#
# Debian 8, 9
# Ubuntu 14.04, 16.04, 18.04
#
HESTIA="/usr/local/hestia"
os=$(head -n1 /etc/issue | cut -f 1 -d ' ')
codename=$(cat /etc/os-release |grep VERSION= |cut -f 2 -d \(|cut -f 1 -d \))
apt="/etc/apt/sources.list.d"
# Am I root?
if [ "x$(id -u)" != 'x0' ]; then
echo 'Error: this script can only be executed by root'
exit 1
fi
# Detect OS
case $os in
Debian) type="debian" ;;
Ubuntu) type="ubuntu" ;;
*) type="NoSupport" ;;
esac
# Check if OS is supported
if [ "$type" = "NoSupport" ]; then
echo "Your OS is currently not supported."
exit 1;
fi
# Check if Vesta is installed
if [ -f /usr/local/vesta/conf/vesta.conf ]; then
source /usr/local/vesta/conf/vesta.conf
else
echo "Vesta not found, stopping here."
exit 1
fi
# Check the Vesta Version
if [ ! "$VERSION" = "0.9.8" ]; then
echo "Wrong Vesta Version, stopping here."
exit 1
fi
# Update apt repository
echo "Updating system repository..."
apt-get -qq update
# Check if apt-transport-https is installed
if [ ! -e '/usr/lib/apt/methods/https' ]; then
apt-get -y install apt-transport-https
check_result $? "Can't install apt-transport-https"
fi
# Remove Vesta Repository if it exists.
echo "Removeing VestaCP Repository..."
if [ -f /usr/local/vesta/conf/vesta.conf ]; then
rm /etc/apt/sources.list.d/vesta.list*
fi
# Installing sury php repo
echo "deb https://packages.sury.org/php/ $codename main" > $apt/php.list
wget https://packages.sury.org/php/apt.gpg -O /tmp/php_signing.key
apt-key add /tmp/php_signing.key
# Installing hestia repo
echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
wget https://gpg.hestiacp.com/deb_signing.key -O deb_signing.key
apt-key add deb_signing.key
# Remove vesta packages
echo "Remove VestaCP packages..."
apt-get -qq remove vesta vesta-nginx vesta-php vesta-ioncube vesta-softaculous -y
# Clear up softaculous
rm -fr /usr/local/vesta/softaculous
sed -i '/SOFTACULOUS/d' /usr/local/vesta/conf/vesta.conf
# Move Vesta to Hestia Folder
mv /usr/local/vesta $HESTIA
mv $HESTIA/conf/vesta.conf $HESTIA/conf/hestia.conf
# Install hestia packages
echo "Update System Repository and install HestiaCP Packages..."
apt-get -qq update
apt-get -qq upgrade -y
apt-get -qq install hestia hestia-nginx hestia-php -y
# Restart hestia service once
systemctl restart hestia
# Create compatiblity symlinks
ln -s $HESTIA /usr/local/vesta
ln -s $HESTIA/conf/hestia.conf /usr/local/vesta/conf/vesta.conf
echo "Migration is finished, you're running now HestiaCP instead VestaCP."
echo "Please contact us if you've any troubles using our forum: https://forum.hestiacp.com"