Skip to content

Commit 144024e

Browse files
authored
Create install.sh
1 parent b558f63 commit 144024e

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed

install.sh

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
########################################################
6+
#
7+
# Pterodactyl-AutoThemes Installation
8+
#
9+
# Created and maintained by Ferks-FK
10+
#
11+
# Protected by GPL 3.0 License
12+
#
13+
########################################################
14+
15+
SCRIPT_VERSION="v0.1"
16+
17+
18+
print_brake() {
19+
for ((n = 0; n < $1; n++)); do
20+
echo -n "#"
21+
done
22+
echo ""
23+
}
24+
25+
hyperlink() {
26+
echo -e "\e]8;;${1}\a${1}\e]8;;\a"
27+
}
28+
29+
#### Colors ####
30+
31+
GREEN="\e[0;92m"
32+
YELLOW="\033[1;33m"
33+
reset="\e[0m"
34+
red='\033[0;31m'
35+
36+
error() {
37+
COLOR_RED='\033[0;31m'
38+
COLOR_NC='\033[0m'
39+
40+
echo ""
41+
echo -e "* ${COLOR_RED}ERROR${COLOR_NC}: $1"
42+
echo ""
43+
}
44+
45+
46+
#### Check Sudo ####
47+
48+
if [[ $EUID -ne 0 ]]; then
49+
echo "* This script must be executed with root privileges (sudo)." 1>&2
50+
exit 1
51+
fi
52+
53+
54+
#### Check Curl ####
55+
56+
if ! [ -x "$(command -v curl)" ]; then
57+
echo "* curl is required in order for this script to work."
58+
echo "* install using apt (Debian and derivatives) or yum/dnf (CentOS)"
59+
exit 1
60+
fi
61+
62+
cancel() {
63+
echo
64+
echo -e "* ${red}Installation Canceled!${reset}"
65+
done=true
66+
exit 1
67+
}
68+
69+
done=false
70+
71+
echo
72+
print_brake 70
73+
echo "* Pterodactyl-AutoThemes Script @ $SCRIPT_VERSION"
74+
echo
75+
echo "* Copyright (C) 2021 - 2021, Ferks-FK."
76+
echo "* https://github.com/Ferks-FK/Pterodactyl-AutoThemes"
77+
echo
78+
echo "* This script is not associated with the official Pterodactyl Project."
79+
print_brake 70
80+
echo
81+
82+
Dracula() {
83+
bash <(curl -s https://github.com/Ferks-FK/Pterodactyl-AutoThemes/tree/main/themes/version1.x/Dracula)
84+
}
85+
86+
Enola() {
87+
bash <(curl -s https://github.com/Ferks-FK/Pterodactyl-AutoThemes/tree/main/themes/version1.x/Enola)
88+
}
89+
90+
Twilight() {
91+
bash <(curl -s https://github.com/Ferks-FK/Pterodactyl-AutoThemes/tree/main/themes/version1.x/Twilight)
92+
}
93+
94+
while [ "$done" == false ]; do
95+
options=(
96+
"Install Dracula (Only 1.x)"
97+
"Install Enola (Only 1.x)"
98+
"Install Twilight (Only 1.x)"
99+
100+
"Cancel Installation"
101+
)
102+
103+
actions=(
104+
"Dracula"
105+
"Enola"
106+
"Twilight"
107+
108+
"cancel"
109+
)
110+
111+
echo "* Which theme do you want to install?"
112+
echo
113+
114+
for i in "${!options[@]}"; do
115+
echo "[$i] ${options[$i]}"
116+
done
117+
118+
echo
119+
echo -n "* Input 0-$((${#actions[@]} - 1)): "
120+
read -r action
121+
122+
[ -z "$action" ] && error "Input is required" && continue
123+
124+
valid_input=("$(for ((i = 0; i <= ${#actions[@]} - 1; i += 1)); do echo "${i}"; done)")
125+
[[ ! " ${valid_input[*]} " =~ ${action} ]] && error "Invalid option"
126+
[[ " ${valid_input[*]} " =~ ${action} ]] && done=true && eval "${actions[$action]}"
127+
done

0 commit comments

Comments
 (0)