forked from pterodactyl-installer/pterodactyl-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·136 lines (105 loc) · 4.97 KB
/
install.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
set -e
#############################################################################
# #
# Project 'pterodactyl-installer' #
# #
# Copyright (C) 2018 - 2021, Vilhelm Prytz, <[email protected]> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
# #
# https://github.com/vilhelmprytz/pterodactyl-installer/blob/master/LICENSE #
# #
# This script is not associated with the official Pterodactyl Project. #
# https://github.com/vilhelmprytz/pterodactyl-installer #
# #
#############################################################################
SCRIPT_VERSION="v0.8.1"
GITHUB_BASE_URL="https://raw.githubusercontent.com/vilhelmprytz/pterodactyl-installer"
LOG_PATH="/var/log/pterodactyl-installer.log"
# exit with error status code if user is not root
if [[ $EUID -ne 0 ]]; then
echo "* This script must be executed with root privileges (sudo)." 1>&2
exit 1
fi
# check for curl
if ! [ -x "$(command -v curl)" ]; then
echo "* curl is required in order for this script to work."
echo "* install using apt (Debian and derivatives) or yum/dnf (CentOS)"
exit 1
fi
output() {
echo -e "* ${1}"
}
error() {
COLOR_RED='\033[0;31m'
COLOR_NC='\033[0m'
echo ""
echo -e "* ${COLOR_RED}ERROR${COLOR_NC}: $1"
echo ""
}
execute() {
echo -e "\n\n* pterodactyl-installer $(date) \n\n" >> $LOG_PATH
bash <(curl -s "$1") | tee -a $LOG_PATH
[[ -n $2 ]] && execute "$2"
}
done=false
output "Pterodactyl installation script @ $SCRIPT_VERSION"
output
output "Copyright (C) 2018 - 2021, Vilhelm Prytz, <[email protected]>"
output "https://github.com/vilhelmprytz/pterodactyl-installer"
output
output "Sponsoring/Donations: https://github.com/vilhelmprytz/pterodactyl-installer?sponsor=1"
output "This script is not associated with the official Pterodactyl Project."
output
PANEL_LATEST="$GITHUB_BASE_URL/$SCRIPT_VERSION/install-panel.sh"
WINGS_LATEST="$GITHUB_BASE_URL/$SCRIPT_VERSION/install-wings.sh"
PANEL_LEGACY="$GITHUB_BASE_URL/$SCRIPT_VERSION/legacy/panel_0.7.sh"
WINGS_LEGACY="$GITHUB_BASE_URL/$SCRIPT_VERSION/legacy/daemon_0.6.sh"
PANEL_CANARY="$GITHUB_BASE_URL/master/install-panel.sh"
WINGS_CANARY="$GITHUB_BASE_URL/master/install-wings.sh"
while [ "$done" == false ]; do
options=(
"Install the panel"
"Install Wings"
"Install both [0] and [1] on the same machine (wings script runs after panel)\n"
"Install 0.7 version of panel (unsupported, no longer maintained!)"
"Install 0.6 version of daemon (works with panel 0.7, no longer maintained!)"
"Install both [3] and [4] on the same machine (daemon script runs after panel)\n"
"Install panel with canary version of the script (the versions that lives in master, may be broken!)"
"Install Wings with canary version of the script (the versions that lives in master, may be broken!)"
"Install both [5] and [6] on the same machine (wings script runs after panel)"
)
actions=(
"$PANEL_LATEST"
"$WINGS_LATEST"
"$PANEL_LATEST;$WINGS_LATEST"
"$PANEL_LEGACY"
"$WINGS_LEGACY"
"$PANEL_LEGACY;$WINGS_LEGACY"
"$PANEL_CANARY"
"$WINGS_CANARY"
"$PANEL_CANARY;$WINGS_CANARY"
)
output "What would you like to do?"
for i in "${!options[@]}"; do
output "[$i] ${options[$i]}"
done
echo -n "* Input 0-$((${#actions[@]} - 1)): "
read -r action
[ -z "$action" ] && error "Input is required" && continue
valid_input=("$(for ((i = 0; i <= ${#actions[@]} - 1; i += 1)); do echo "${i}"; done)")
[[ ! " ${valid_input[*]} " =~ ${action} ]] && error "Invalid option"
[[ " ${valid_input[*]} " =~ ${action} ]] && done=true && IFS=";" read -r i1 i2 <<< "${actions[$action]}" && execute "$i1" "$i2"
done