-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebinstall.sh
93 lines (83 loc) · 2.03 KB
/
webinstall.sh
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
#!/bin/bash
#init
initVar() {
installType='yum -y install'
removeType='yum -y remove'
upgrade="yum -y update"
echoType='echo -e'
version='3.3.0'
}
initVar
export LANG=en_US.UTF-8
#the color of font
echoContent() {
case $1 in
"red")
# shellcheck disable=SC2154
${echoType} "\033[31m${printN}$2 \033[0m"
;;
"skyBlue")
${echoType} "\033[1;36m${printN}$2 \033[0m"
;;
"green")
${echoType} "\033[32m${printN}$2 \033[0m"
;;
"white")
${echoType} "\033[37m${printN}$2 \033[0m"
;;
"magenta")
${echoType} "\033[31m${printN}$2 \033[0m"
;;
"yellow")
${echoType} "\033[33m${printN}$2 \033[0m"
;;
esac
}
#start
menu() {
echoContent red " _ _ _____ _ _ "
echoContent red "| | | | | ___| (_) ___ | |__ "
echoContent red "| |_| | | |_ | | / __| | '_ \ "
echoContent red "| _ | | _| | | \__ \ | | | |"
echoContent red "|_| |_| |_| |_| |___/ |_| |_| v${version}"
echoContent green "https://hfish.net\n\n"
echoContent white "Press 1 : Install and run HFish"
# echoContent yellow "Press 2 : Add mgmt ports to the firewall(coming soon)"
# echoContent yellow "Press 3 : Install as service(coming soon)"
# echoContent yellow "Press 4 : Post error logfile to HFish team(coming soon)"
# echoContent yellow "Press 9 : Uninstall HFish(coming soon)"
echoContent white "Press 0 : Exit"
echoContent white "----------"
while [ 1 ]; do
read -r -p "Input: " selectMenuType
case ${selectMenuType} in
1):
serverInstall
;;
0)
exitInstall
;;
*)
continue
;;
esac
break
done
}
serverInstall() {
cd /opt
if [ $(uname -s) = 'Linux' ] && [ $(uname -m) = 'x86_64' ] && [ $(getconf LONG_BIT) = '64' ]; then
curl -k http://hfish.cn-bj.ufileos.com/hfish-${version}-linux-amd64.tgz -o hfish-${version}-linux-amd64.tgz
else
echoContent red "No OS version is detected. Please refer to https://hfish.net for manual installation\n" && exit 1
fi
mkdir -p hfish
tar -zxvf /opt/hfish-${version}*.tgz -C hfish
cd hfish
sudo ./install.sh
}
exitInstall() {
exit 1
}
cd /opt
menu