Skip to content

Commit b58daa3

Browse files
committed
Create Migration Script (Vesta -> Hestia).
1 parent dc1da30 commit b58daa3

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

install/hst-migration.sh

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/bin/bash
2+
# Hestia installation wrapper
3+
# https://www.hestiacp.com
4+
5+
#
6+
# Currently Supported Operating Systems:
7+
#
8+
# Debian 8, 9
9+
# Ubuntu 14.04, 16.04, 18.04
10+
#
11+
12+
HESTIA="/usr/local/hestia"
13+
os=$(head -n1 /etc/issue | cut -f 1 -d ' ')
14+
codename=$(cat /etc/os-release |grep VERSION= |cut -f 2 -d \(|cut -f 1 -d \))
15+
16+
# Am I root?
17+
if [ "x$(id -u)" != 'x0' ]; then
18+
echo 'Error: this script can only be executed by root'
19+
exit 1
20+
fi
21+
22+
# Detect OS
23+
case $os in
24+
Debian) type="debian" ;;
25+
Ubuntu) type="ubuntu" ;;
26+
*) type="NoSupport" ;;
27+
esac
28+
29+
# Check if OS is supported
30+
if [ "$type" = "NoSupport" ]; then
31+
echo "Your OS is currently not supported."
32+
exit 1;
33+
fi
34+
35+
# Check if Vesta is installed
36+
if [ -f /usr/local/vesta/conf/vesta.conf ]; then
37+
echo "Vesta exists"
38+
source /usr/local/vesta/conf/vesta.conf
39+
else
40+
echo "Vesta not found, stopping here."
41+
exit 1
42+
fi
43+
44+
# Check the Vesta Version
45+
if [ ! "$VESRION" = "0.9.8" ]; then
46+
echo "Wrong Vesta Version, stopping here."
47+
exit 1
48+
fi
49+
50+
# Update apt repository
51+
echo "Updating system repository..."
52+
apt-get -qq update
53+
54+
# Check if apt-transport-https is installed
55+
if [ ! -e '/usr/lib/apt/methods/https' ]; then
56+
apt-get -y install apt-transport-https
57+
check_result $? "Can't install apt-transport-https"
58+
fi
59+
60+
# Remove Vesta Repository if it exists.
61+
echo "Removeing VestaCP Repository..."
62+
if [ -f /usr/local/vesta/conf/vesta.conf ]; then
63+
rm /etc/apt/sources.list.d/vesta.list*
64+
fi
65+
66+
# Installing sury php repo
67+
echo "deb https://packages.sury.org/php/ $codename main" > $apt/php.list
68+
wget https://packages.sury.org/php/apt.gpg -O /tmp/php_signing.key
69+
apt-key add /tmp/php_signing.key
70+
71+
# Installing hestia repo
72+
echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
73+
wget https://gpg.hestiacp.com/deb_signing.key -O deb_signing.key
74+
apt-key add deb_signing.key
75+
76+
# Remove vesta packages
77+
echo "Remove VestaCP packages..."
78+
apt-get -qq remove vesta vesta-nginx vesta-php -y
79+
80+
# Move Vesta to Hestia Folder
81+
mv /usr/local/vesta $HESTIA
82+
83+
# Install hestia packages
84+
echo "Update System Repository and install HestiaCP Packages..."
85+
apt-get -qq update
86+
apt-get -qq install hestia hestia-nginx hestia-php
87+
88+
# Restart hestia service once
89+
systemctl restart hestia
90+
91+
# Create compatiblity symlinks
92+
ln -s $HESTIA /usr/local/vesta
93+
ln -s $HESTIA/conf/hestia.conf /usr/local/vesta/conf/vesta.conf
94+
95+
echo "Migration is finished, you're running now HestiaCP instead VestaCP."
96+
echo "Please contact us if you've any troubles using our forum: https://forum.hestiacp.com"

0 commit comments

Comments
 (0)