-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathf5.sh
More file actions
50 lines (47 loc) · 1.58 KB
/
f5.sh
File metadata and controls
50 lines (47 loc) · 1.58 KB
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
#!/bin/bash
# Script to install any node:
# . <(wget -qO- sh.f5nodes.com) [name] [-y]
# -y automatic yes to prompt; skip confirmation.
#
# See instructions here:
# github.com/f5nodes/root
# Default vars & funcs
script_link="https://raw.githubusercontent.com/f5nodes/$1/main/setup.sh"
logo_link="https://raw.githubusercontent.com/f5nodes/root/main/logo/$2.sh"
logo_link_d="https://raw.githubusercontent.com/f5nodes/root/main/logo/logo.sh"
available_nodes="https://raw.githubusercontent.com/f5nodes/root/main/available.sh"
skip=false; [ "$2" == "-y" ] && skip=true
confirm() {
[ $skip == true ] && return 0
read -r -p "${1:-Continue? [y/n]} " response
case "$response" in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
# ARG 1: if node name is empty
if [ -z "$1" ]; then
echo -e "🖇️ \e[91mUSAGE: . <(wget -qO- sh.f5nodes.com) [name] [-y]\e[0m"
echo -e "🖇️ \e[91m-y automatic yes to prompt; skip confirmation.\e[0m"
. <(wget -qO- $available_nodes)
return 1 2>/dev/null; exit 1
fi
# script execute
if wget -q --spider $script_link; then
if wget -q --spider $logo_link; then
. <(wget -qO- $logo_link)
else
. <(wget -qO- $logo_link_d)
fi
echo -e "\e[93mYou select installing \e[92m${1^}\e[0m ⏳"
confirm && . <(wget -qO- $script_link)
else
echo -e "\e[91m❌ This node doesn't exist!\e[0m"
echo -e "\e[91m⭕ Available nodes: \e[4mgithub.com/f5nodes\e[0m"
confirm 'See available nodes list? [y/n]' && . <(wget -qO- $available_nodes)
return 1 2>/dev/null; exit 1
fi