Skip to content

Commit a54f190

Browse files
committed
Update
1 parent a7c427f commit a54f190

File tree

10 files changed

+465
-220
lines changed

10 files changed

+465
-220
lines changed

backup.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ update_variables() {
2222
INFORMATIONS="/var/log/Pterodactyl-AutoThemes-informations"
2323
DET="$PTERO/public/themes/pterodactyl/css/admin.css"
2424
ZING="$PTERO/resources/scripts/components/SidePanel.tsx"
25-
if [ -f "${INFORMATIONS}/background.txt" ]; then
26-
BACKGROUND="$(cat "${INFORMATIONS}/background.txt")"
27-
fi
25+
if [ -f "${INFORMATIONS}/background.txt" ]; then BACKGROUND="$(cat "${INFORMATIONS}/background.txt")"; fi
2826
}
2927

3028
print_brake() {
@@ -102,7 +100,7 @@ fi
102100

103101
#### BACKGROUND VIDEO ####
104102
if [ -f "$PTERO/public/$BACKGROUND" ]; then
105-
cd "$PTERO/public" && rm -r "$BACKGROUND"
103+
rm -rf "$PTERO/public/$BACKGROUND"
106104
rm -rf "$PTERO/resources/scripts/user.css"
107105
rm -rf "$INFORMATIONS"
108106
fi
@@ -116,8 +114,8 @@ print "Checking for a backup..."
116114

117115
if [ -d "$PTERO/PanelBackup[Auto-Themes]" ]; then
118116
cd "$PTERO/PanelBackup[Auto-Themes]"
119-
tar -xzvf "PanelBackup[Auto-Themes].tar.gz"
120-
rm -R "PanelBackup[Auto-Themes].tar.gz"
117+
tar -xzvf "$PTERO/PanelBackup[Auto-Themes]/PanelBackup[Auto-Themes].tar.gz"
118+
rm -rf "$PTERO/PanelBackup[Auto-Themes]/PanelBackup[Auto-Themes].tar.gz"
121119
cp -r -- * .env "$PTERO"
122120
rm -rf "$PTERO/PanelBackup[Auto-Themes]"
123121
else

install.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ curl --silent \
2121
sed -E 's/.*"([^"]+)".*/\1/'
2222
}
2323

24+
GITHUB_STATUS_URL="https://www.githubstatus.com"
2425
SCRIPT_VERSION="$(get_release)"
2526

2627
# Visual Functions #
@@ -35,6 +36,7 @@ hyperlink() {
3536
echo -e "\e]8;;${1}\a${1}\e]8;;\a"
3637
}
3738

39+
YELLOW="\033[1;33m"
3840
RESET="\e[0m"
3941
RED='\033[0;31m'
4042

@@ -50,6 +52,14 @@ if [[ $EUID -ne 0 ]]; then
5052
exit 1
5153
fi
5254

55+
# Check Git #
56+
if [ -z "$SCRIPT_VERSION" ]; then
57+
error "Could not get the version of the script using GitHub."
58+
echo "* Please check on the site below if the 'API Requests' are as normal status."
59+
echo -e "${YELLOW}$(hyperlink "$GITHUB_STATUS_URL")${RESET}"
60+
exit 1
61+
fi
62+
5363
# Check Curl #
5464
if ! [ -x "$(command -v curl)" ]; then
5565
echo "* curl is required in order for this script to work."
@@ -105,6 +115,10 @@ BackgroundVideo() {
105115
bash <(curl -s https://raw.githubusercontent.com/Ferks-FK/Pterodactyl-AutoThemes/"${SCRIPT_VERSION}"/themes/version1.x/BackgroundVideo/build.sh)
106116
}
107117

118+
AnimatedGraphics() {
119+
bash <(curl -s https://raw.githubusercontent.com/Ferks-FK/Pterodactyl-AutoThemes/"${SCRIPT_VERSION}"/themes/version1.x/AnimatedGraphics/build.sh)
120+
}
121+
108122

109123
while [ "$done" == false ]; do
110124
options=(
@@ -115,6 +129,7 @@ while [ "$done" == false ]; do
115129
"Install Zing Theme (Only 1.6.6 and 1.7.0)"
116130
"Install Flanco Theme (Only 1.6.6 and 1.7.0)"
117131
"Install Background Video (Only 1.6.6 and 1.7.0)"
132+
"Install Animated Graphics (Only 1.6.6 and 1.7.0)"
118133

119134

120135
"Cancel Installation"
@@ -128,6 +143,7 @@ while [ "$done" == false ]; do
128143
"ZingTheme"
129144
"FlancoTheme"
130145
"BackgroundVideo"
146+
"AnimatedGraphics"
131147

132148

133149
"cancel"
1.69 KB
Binary file not shown.
Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
#!/bin/bash
2+
# shellcheck source=/dev/null
3+
4+
set -e
5+
6+
########################################################
7+
#
8+
# Pterodactyl-AutoThemes Installation
9+
#
10+
# Created and maintained by Ferks-FK
11+
#
12+
# Protected by MIT License
13+
#
14+
########################################################
15+
16+
# Get the latest version before running the script #
17+
get_release() {
18+
curl --silent \
19+
-H "Accept: application/vnd.github.v3+json" \
20+
https://api.github.com/repos/Ferks-FK/Pterodactyl-AutoThemes/releases/latest |
21+
grep '"tag_name":' |
22+
sed -E 's/.*"([^"]+)".*/\1/'
23+
}
24+
25+
# Fixed Variables #
26+
SCRIPT_VERSION="$(get_release)"
27+
SUPPORT_LINK="https://discord.gg/buDBbSGJmQ"
28+
29+
# Update Variables #
30+
update_variables() {
31+
CONFIG_FILE="$PTERO/config/app.php"
32+
PANEL_VERSION="$(grep "'version'" "$CONFIG_FILE" | cut -c18-25 | sed "s/[',]//g")"
33+
}
34+
35+
# Visual Functions #
36+
print_brake() {
37+
for ((n = 0; n < $1; n++)); do
38+
echo -n "#"
39+
done
40+
echo ""
41+
}
42+
43+
print_warning() {
44+
echo ""
45+
echo -e "* ${YELLOW}WARNING${RESET}: $1"
46+
echo ""
47+
}
48+
49+
print_error() {
50+
echo ""
51+
echo -e "* ${RED}ERROR${RESET}: $1"
52+
echo ""
53+
}
54+
55+
print() {
56+
echo ""
57+
echo -e "* ${GREEN}$1${RESET}"
58+
echo ""
59+
}
60+
61+
hyperlink() {
62+
echo -e "\e]8;;${1}\a${1}\e]8;;\a"
63+
}
64+
65+
GREEN="\e[0;92m"
66+
YELLOW="\033[1;33m"
67+
RED='\033[0;31m'
68+
RESET="\e[0m"
69+
70+
# OS check #
71+
check_distro() {
72+
if [ -f /etc/os-release ]; then
73+
. /etc/os-release
74+
OS=$(echo "$ID" | awk '{print tolower($0)}')
75+
OS_VER=$VERSION_ID
76+
elif type lsb_release >/dev/null 2>&1; then
77+
OS=$(lsb_release -si | awk '{print tolower($0)}')
78+
OS_VER=$(lsb_release -sr)
79+
elif [ -f /etc/lsb-release ]; then
80+
. /etc/lsb-release
81+
OS=$(echo "$DISTRIB_ID" | awk '{print tolower($0)}')
82+
OS_VER=$DISTRIB_RELEASE
83+
elif [ -f /etc/debian_version ]; then
84+
OS="debian"
85+
OS_VER=$(cat /etc/debian_version)
86+
elif [ -f /etc/SuSe-release ]; then
87+
OS="SuSE"
88+
OS_VER="?"
89+
elif [ -f /etc/redhat-release ]; then
90+
OS="Red Hat/CentOS"
91+
OS_VER="?"
92+
else
93+
OS=$(uname -s)
94+
OS_VER=$(uname -r)
95+
fi
96+
97+
OS=$(echo "$OS" | awk '{print tolower($0)}')
98+
OS_VER_MAJOR=$(echo "$OS_VER" | cut -d. -f1)
99+
}
100+
101+
# Find where pterodactyl is installed #
102+
find_pterodactyl() {
103+
print "Looking for your pterodactyl installation..."
104+
105+
sleep 2
106+
if [ -d "/var/www/pterodactyl" ]; then
107+
PTERO_INSTALL=true
108+
PTERO="/var/www/pterodactyl"
109+
elif [ -d "/var/www/panel" ]; then
110+
PTERO_INSTALL=true
111+
PTERO="/var/www/panel"
112+
elif [ -d "/var/www/ptero" ]; then
113+
PTERO_INSTALL=true
114+
PTERO="/var/www/ptero"
115+
else
116+
PTERO_INSTALL=false
117+
fi
118+
# Update the variables after detection of the pterodactyl installation #
119+
update_variables
120+
}
121+
122+
# Verify Compatibility #
123+
compatibility() {
124+
print "Checking if the addon is compatible with your panel..."
125+
126+
sleep 2
127+
if [ "$PANEL_VERSION" == "1.6.6" ] || [ "$PANEL_VERSION" == "1.7.0" ]; then
128+
print "Compatible Version!"
129+
else
130+
print_error "Incompatible Version!"
131+
exit 1
132+
fi
133+
}
134+
135+
# Install Dependencies #
136+
dependencies() {
137+
print "Installing dependencies..."
138+
139+
if node -v &>/dev/null; then
140+
print "The dependencies are already installed, skipping this step..."
141+
else
142+
case "$OS" in
143+
debian | ubuntu)
144+
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - && apt-get install -y nodejs
145+
;;
146+
centos)
147+
[ "$OS_VER_MAJOR" == "7" ] && curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash - && sudo yum install -y nodejs yarn
148+
[ "$OS_VER_MAJOR" == "8" ] && curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash - && sudo dnf install -y nodejs
149+
;;
150+
esac
151+
fi
152+
}
153+
154+
# Panel Backup #
155+
backup() {
156+
print "Performing security backup..."
157+
158+
if [ -d "$PTERO/PanelBackup[Auto-Addons]" ]; then
159+
print "There is already a backup, skipping step..."
160+
else
161+
cd $PTERO
162+
if [ -d "$PTERO/node_modules" ]; then
163+
tar -czvf "PanelBackup[Auto-Addons].tar.gz" --exclude "node_modules" -- * .env
164+
mkdir -p "$PTERO/PanelBackup[Auto-Addons]"
165+
mv "$PTERO/PanelBackup[Auto-Addons].tar.gz" "$PTERO/PanelBackup[Auto-Addons]"
166+
else
167+
tar -czvf "PanelBackup[Auto-Addons].tar.gz" -- * .env
168+
mkdir -p "$PTERO/PanelBackup[Auto-Addons]"
169+
mv "$PTERO/PanelBackup[Auto-Addons].tar.gz" "$PTERO/PanelBackup[Auto-Addons]"
170+
fi
171+
fi
172+
}
173+
174+
# Download Files #
175+
download_files() {
176+
print "Downloading files..."
177+
178+
mkdir -p $PTERO/temp
179+
curl -sSLo $PTERO/temp/AnimatedGraphics.tar.gz https://raw.githubusercontent.com/Ferks-FK/Pterodactyl-AutoThemes/"${SCRIPT_VERSION}"/themes/version1.x/AnimatedGraphics/AnimatedGraphics.tar.gz
180+
tar -xzvf $PTERO/temp/AnimatedGraphics.tar.gz -C $PTERO/temp
181+
cp -rf -- $PTERO/temp/AnimatedGraphics/* $PTERO
182+
rm -rf $PTERO/temp
183+
}
184+
185+
# Panel Production #
186+
production() {
187+
print "Producing panel..."
188+
print_warning "This process takes a few minutes, please do not cancel it."
189+
190+
if [ -d "$PTERO/node_modules" ]; then
191+
yarn --cwd $PTERO build:production
192+
else
193+
npm i -g yarn
194+
yarn --cwd $PTERO install
195+
yarn --cwd $PTERO build:production
196+
fi
197+
}
198+
199+
bye() {
200+
print_brake 50
201+
echo
202+
echo -e "${GREEN}* The theme ${YELLOW}Animated Graphics${GREEN} was successfully installed."
203+
echo -e "* A security backup of your panel has been created."
204+
echo -e "* Thank you for using this script."
205+
echo -e "* Support group: ${YELLOW}$(hyperlink "$SUPPORT_LINK")${RESET}"
206+
echo
207+
print_brake 50
208+
}
209+
210+
# Exec Script #
211+
check_distro
212+
find_pterodactyl
213+
if [ "$PTERO_INSTALL" == true ]; then
214+
print "Installation of the panel found, continuing the installation..."
215+
216+
compatibility
217+
dependencies
218+
backup
219+
download_files
220+
production
221+
bye
222+
elif [ "$PTERO_INSTALL" == false ]; then
223+
print_warning "The installation of your panel could not be located."
224+
echo -e "* ${GREEN}EXAMPLE${RESET}: ${YELLOW}/var/www/mypanel${RESET}"
225+
echo -ne "* Enter the pterodactyl installation directory manually: "
226+
read -r MANUAL_DIR
227+
if [ -d "$MANUAL_DIR" ]; then
228+
print "Directory has been found!"
229+
PTERO="$MANUAL_DIR"
230+
echo "$MANUAL_DIR" >> "$INFORMATIONS/custom_directory.txt"
231+
update_variables
232+
compatibility
233+
dependencies
234+
backup
235+
download_files
236+
production
237+
bye
238+
else
239+
print_error "The directory you entered does not exist."
240+
find_pterodactyl
241+
fi
242+
fi

0 commit comments

Comments
 (0)