|
| 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 - 18.04 |
| 10 | +# |
| 11 | + |
| 12 | +# Am I root? |
| 13 | +if [ "x$(id -u)" != 'x0' ]; then |
| 14 | + echo 'Error: this script can only be executed by root' |
| 15 | + exit 1 |
| 16 | +fi |
| 17 | + |
| 18 | +# Check admin user account |
| 19 | +if [ ! -z "$(grep ^admin: /etc/passwd)" ] && [ -z "$1" ]; then |
| 20 | + echo "Error: user admin exists" |
| 21 | + echo |
| 22 | + echo 'Please remove admin user before proceeding.' |
| 23 | + echo 'If you want to do it automatically run installer with -f option:' |
| 24 | + echo "Example: bash $0 --force" |
| 25 | + exit 1 |
| 26 | +fi |
| 27 | + |
| 28 | +# Check admin group |
| 29 | +if [ ! -z "$(grep ^admin: /etc/group)" ] && [ -z "$1" ]; then |
| 30 | + echo "Error: group admin exists" |
| 31 | + echo |
| 32 | + echo 'Please remove admin group before proceeding.' |
| 33 | + echo 'If you want to do it automatically run installer with -f option:' |
| 34 | + echo "Example: bash $0 --force" |
| 35 | + exit 1 |
| 36 | +fi |
| 37 | + |
| 38 | +# Detect OS |
| 39 | +case $(head -n1 /etc/issue | cut -f 1 -d ' ') in |
| 40 | + Debian) type="debian" ;; |
| 41 | + Ubuntu) type="ubuntu" ;; |
| 42 | + *) type="NoSupport" ;; |
| 43 | +esac |
| 44 | + |
| 45 | +# Check if OS is supported |
| 46 | +if [ "$type" = "NoSupport" ]; then |
| 47 | + echo "Your OS is currently not supported." |
| 48 | + exit 1; |
| 49 | +fi |
| 50 | + |
| 51 | +# Check wget |
| 52 | +if [ -e '/usr/bin/wget' ]; then |
| 53 | + wget https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh -O hst-install-$type.sh |
| 54 | + if [ "$?" -eq '0' ]; then |
| 55 | + bash hst-install-$type.sh $* |
| 56 | + exit |
| 57 | + else |
| 58 | + echo "Error: hst-install-$type.sh download failed." |
| 59 | + exit 1 |
| 60 | + fi |
| 61 | +fi |
| 62 | + |
| 63 | +# Check curl |
| 64 | +if [ -e '/usr/bin/curl' ]; then |
| 65 | + curl -O https://raw.githubusercontent.com/hestiacp/hestiacp/master/install/hst-install-$type.sh |
| 66 | + if [ "$?" -eq '0' ]; then |
| 67 | + bash hst-install-$type.sh $* |
| 68 | + exit |
| 69 | + else |
| 70 | + echo "Error: hst-install-$type.sh download failed." |
| 71 | + exit 1 |
| 72 | + fi |
| 73 | +fi |
| 74 | + |
| 75 | +exit |
0 commit comments