forked from Ferks-FK/Pterodactyl-AutoThemes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
153 lines (124 loc) · 2.82 KB
/
build.sh
File metadata and controls
153 lines (124 loc) · 2.82 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
set -e
########################################################
#
# Pterodactyl-AutoThemes Installation
#
# Created and maintained by Ferks-FK
#
# Protected by GPL 3.0 License
#
########################################################
#### Variables ####
SCRIPT_VERSION="v0.8.2"
print_brake() {
for ((n = 0; n < $1; n++)); do
echo -n "#"
done
echo ""
}
hyperlink() {
echo -e "\e]8;;${1}\a${1}\e]8;;\a"
}
#### Colors ####
GREEN="\e[0;92m"
YELLOW="\033[1;33m"
reset="\e[0m"
#### OS check ####
check_distro() {
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$(echo "$ID")
OS_VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
OS=$(lsb_release -si)
OS_VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
. /etc/lsb-release
OS=$(echo "$DISTRIB_ID")
OS_VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
OS="debian"
OS_VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
OS="SuSE"
OS_VER="?"
elif [ -f /etc/redhat-release ]; then
OS="Red Hat/CentOS"
OS_VER="?"
else
OS=$(uname -s)
OS_VER=$(uname -r)
fi
OS=$(echo "$OS")
OS_VER_MAJOR=$(echo "$OS_VER" | cut -d. -f1)
}
#### Install Dependencies ####
dependencies() {
echo
print_brake 30
echo -e "* ${GREEN}Installing dependencies...${reset}"
print_brake 30
echo
case "$OS" in
debian | ubuntu)
apt-get install -y zip
;;
esac
if [ "$OS_VER_MAJOR" == "7" ]; then
sudo yum install -y zip
fi
if [ "$OS_VER_MAJOR" == "8" ]; then
sudo dnf install -y zip
fi
}
#### Panel Backup ####
backup() {
echo
print_brake 32
echo -e "* ${GREEN}Performing security backup...${reset}"
print_brake 32
if [ -f "/var/www/pterodactyl/PanelBackup/PanelBackup.zip" ]; then
echo
print_brake 45
echo -e "* ${GREEN}There is already a backup, skipping step...${reset}"
print_brake 45
echo
else
cd /var/www/pterodactyl
mkdir -p PanelBackup
zip -r PanelBackup.zip app config public resources routes storage database .env
mv PanelBackup.zip PanelBackup
fi
}
#### Donwload Files ####
download_files() {
print_brake 25
echo -e "* ${GREEN}Downloading files...${reset}"
print_brake 25
cd /var/www/pterodactyl
mkdir -p temp
cd temp
curl -sSLo NothingButGraphite.tar.gz https://raw.githubusercontent.com/Ferks-FK/Pterodactyl-AutoThemes/${SCRIPT_VERSION}/themes/version0.7.19/NothingButGraphite/NothingButGraphite.tar.gz
tar -xzvf NothingButGraphite.tar.gz
cd NothingButGraphite
cp -rf -- * /var/www/pterodactyl
cd
cd /var/www/pterodactyl
rm -rf temp
}
bye() {
print_brake 50
echo
echo -e "* ${GREEN}The theme ${YELLOW}Nothing But Graphite${GREEN} was successfully installed."
echo -e "* A security backup of your panel has been created."
echo -e "* Thank you for using this script."
echo
print_brake 50
}
#### Exec Script ####
check_distro
dependencies
backup
download_files
bye