|
|
@@ -42,34 +42,62 @@ case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
|
|
|
*) type="NoSupport" ;;
|
|
|
esac
|
|
|
|
|
|
+no_support_message() {
|
|
|
+ echo "Your OS is currently not supported, please consider to use:"
|
|
|
+ echo " Debian: 8, 9"
|
|
|
+ echo " Ubuntu: 16.04, 18.04"
|
|
|
+ exit 1;
|
|
|
+}
|
|
|
+
|
|
|
# Check if OS is supported
|
|
|
if [ "$type" = "NoSupport" ]; then
|
|
|
- echo "Your OS is currently not supported."
|
|
|
- exit 1;
|
|
|
+ no_support_message
|
|
|
fi
|
|
|
|
|
|
-# Check wget
|
|
|
-if [ -e '/usr/bin/wget' ]; then
|
|
|
- wget -q https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh -O hst-install-$type.sh
|
|
|
- if [ "$?" -eq '0' ]; then
|
|
|
- bash hst-install-$type.sh $*
|
|
|
- exit
|
|
|
- else
|
|
|
- echo "Error: hst-install-$type.sh download failed."
|
|
|
- exit 1
|
|
|
+check_wget_curl(){
|
|
|
+ # Check wget
|
|
|
+ if [ -e '/usr/bin/wget' ]; then
|
|
|
+ wget -q https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh -O hst-install-$type.sh
|
|
|
+ if [ "$?" -eq '0' ]; then
|
|
|
+ bash hst-install-$type.sh $*
|
|
|
+ exit
|
|
|
+ else
|
|
|
+ echo "Error: hst-install-$type.sh download failed."
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
fi
|
|
|
-fi
|
|
|
|
|
|
-# Check curl
|
|
|
-if [ -e '/usr/bin/curl' ]; then
|
|
|
- curl -s -O https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh
|
|
|
- if [ "$?" -eq '0' ]; then
|
|
|
- bash hst-install-$type.sh $*
|
|
|
- exit
|
|
|
- else
|
|
|
- echo "Error: hst-install-$type.sh download failed."
|
|
|
- exit 1
|
|
|
+ # Check curl
|
|
|
+ if [ -e '/usr/bin/curl' ]; then
|
|
|
+ curl -s -O https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh
|
|
|
+ if [ "$?" -eq '0' ]; then
|
|
|
+ bash hst-install-$type.sh $*
|
|
|
+ exit
|
|
|
+ else
|
|
|
+ echo "Error: hst-install-$type.sh download failed."
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
fi
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+# Detect codename for debian
|
|
|
+if [ "$type" = "debian" ]; then
|
|
|
+ release=$(cat /etc/debian_version|grep -o [0-9]|head -n1)
|
|
|
+ VERSION='debian'
|
|
|
+fi
|
|
|
+
|
|
|
+# Detect codename for ubuntu
|
|
|
+if [ "$type" = "ubuntu" ]; then
|
|
|
+ release="$(lsb_release -s -r)"
|
|
|
+ VERSION='ubuntu'
|
|
|
+fi
|
|
|
+
|
|
|
+# Check Ubuntu Version Are Acceptable to install
|
|
|
+if [[ "$release" =~ ^(8|9|16.04|18.04)$ ]]; then
|
|
|
+ check_wget_curl
|
|
|
+else
|
|
|
+ no_support_message
|
|
|
fi
|
|
|
|
|
|
-exit
|
|
|
+exit
|