-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·107 lines (85 loc) · 2.89 KB
/
install
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
103
104
105
106
107
#!/usr/bin/env bash
set -efu
{ # this ensures the entire script is downloaded #
# METHODS #
color() {
echo -e "$1\e[39m\033[0;37m\e[0m"
}
error() {
color "\n\e[91m\033[41m\e[K"
color "\e[1;37m\033[41m\e[K ERROR"
color "\e[1;37m\033[41m\e[K $1\e[K"
color "\e[91m\033[41m\e[K \n"
}
detect_os() {
os_arch=`uname -m`
os_type=`uname -s`
case $os_arch in
i?86) os_arch="i386" ;;
*) : ;;
esac
if [ "$os_type" = 'Linux' ]; then
# Debian / Ubuntu
if [ -e '/etc/debian_version' ]; then
# Mostly ubuntu, but not debian
if [ -e '/etc/lsb-release' ]; then
. /etc/lsb-release
os_name=$DISTRIB_ID
os_version=$DISTRIB_RELEASE
os_code=$DISTRIB_CODENAME
else
. /etc/os-release
os_name='Debian'
os_version=`head -1 /etc/debian_version`
os_code=$VERSION_CODENAME
if [ "$os_version" = 'trixie/sid' ]; then
os_version=13.0
fi
fi
# RedHat
elif [ -e '/etc/redhat-release' ]; then
os_name=`awk '{print $1}' /etc/redhat-release`
os_version=`head -1 /etc/redhat-release | sed -e 's/[^0-9.]*\([0-9.]*\).*/\1/g' | awk -F'.' '{print $1}'`
os_code="?"
case $os_name$os_version$os_arch in
CentOS*|Cloud*|Virtuozzo*|AlmaLinux*|Rocky*)
;;
Red*)
os_name="RedHat";
;;
*)
error "Unknown OS is specified in /etc/redhat-release!"
;;
esac
fi
else
error "You've tried to install fruithost on \033[1;37m$os_type. 😒\nCurrently, fruithost can only installed on Linux-Systems, Sorry!"
fi
}
detect_host() {
ip_hostname=`hostname`
ip_address=`hostname -I | awk '{print $1}'`
ip_address_public=`curl -L -s -o- api.ipify.org`
}
# CALL #
color "\n\e[33mWelcome to 🍇 \e[1;95mfruithost\e[0;33m installer!"
if [ `id -u` -ne 0 ]; then
error "Please run the installation as root! "
exit
fi
detect_os
detect_host
color "\n \e[4;90mNetwork"
color " \e[1;94mHostname:\e[0;0m $ip_hostname"
color " \e[1;94mLocal IP:\e[0;0m $ip_address"
color " \e[1;94mPublic IP:\e[0;0m $ip_address_public"
color "\n \e[4;90mSystem"
color " \e[1;94mType:\e[0;0m $os_type"
color " \e[1;94mName:\e[0;0m $os_name"
color " \e[1;94mVersion:\e[0;0m $os_version"
color " \e[1;94mArchitecture:\e[0;0m $os_arch"
color " \e[1;94mCodename:\e[0;0m $os_code\n"
url="https://update.fruithost.de/installer/$os_type/$os_name/$os_version/$os_arch"
curl --connect-timeout 5 -IsL "$url" > /dev/null || ( error "Cannot connect to $url to download the fruithost-Installer.\n Check your firewall settings. If you are using a proxy, make sure you have set the HTTPS_PROXY environment variable." && exit 132 )
bash <(curl -H 'Cache-Control: no-cache, no-store' -L -s -o- $url || wget -q -O - $url)
} # this ensures the entire script is downloaded #