Просмотр исходного кода

Create Migration Script (Vesta -> Hestia).

Raphael Schneeberger 7 лет назад
Родитель
Сommit
b58daa3dac
1 измененных файлов с 96 добавлено и 0 удалено
  1. 96 0
      install/hst-migration.sh

+ 96 - 0
install/hst-migration.sh

@@ -0,0 +1,96 @@
+#!/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 \))
+
+# 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
+    echo "Vesta exists"
+    source /usr/local/vesta/conf/vesta.conf
+else
+    echo "Vesta not found, stopping here."
+    exit 1
+fi
+
+# Check the Vesta Version
+if [ ! "$VESRION" = "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 -y
+
+# Move Vesta to Hestia Folder
+mv /usr/local/vesta $HESTIA
+
+# Install hestia packages
+echo "Update System Repository and install HestiaCP Packages..."
+apt-get -qq update
+apt-get -qq install hestia hestia-nginx hestia-php
+
+# 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"