Skip to content

Commit 823997c

Browse files
authored
Create build.sh
1 parent 400254d commit 823997c

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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+
#### Variables ####
16+
SUPPORT_LINK="https://discord.gg/buDBbSGJmQ"
17+
18+
19+
print_brake() {
20+
for ((n = 0; n < $1; n++)); do
21+
echo -n "#"
22+
done
23+
echo ""
24+
}
25+
26+
27+
hyperlink() {
28+
echo -e "\e]8;;${1}\a${1}\e]8;;\a"
29+
}
30+
31+
32+
#### Colors ####
33+
34+
GREEN="\e[0;92m"
35+
YELLOW="\033[1;33m"
36+
reset="\e[0m"
37+
38+
39+
#### OS check ####
40+
41+
check_distro() {
42+
if [ -f /etc/os-release ]; then
43+
. /etc/os-release
44+
OS=$(echo "$ID")
45+
OS_VER=$VERSION_ID
46+
elif type lsb_release >/dev/null 2>&1; then
47+
OS=$(lsb_release -si)
48+
OS_VER=$(lsb_release -sr)
49+
elif [ -f /etc/lsb-release ]; then
50+
. /etc/lsb-release
51+
OS=$(echo "$DISTRIB_ID")
52+
OS_VER=$DISTRIB_RELEASE
53+
elif [ -f /etc/debian_version ]; then
54+
OS="debian"
55+
OS_VER=$(cat /etc/debian_version)
56+
elif [ -f /etc/SuSe-release ]; then
57+
OS="SuSE"
58+
OS_VER="?"
59+
elif [ -f /etc/redhat-release ]; then
60+
OS="Red Hat/CentOS"
61+
OS_VER="?"
62+
else
63+
OS=$(uname -s)
64+
OS_VER=$(uname -r)
65+
fi
66+
67+
OS=$(echo "$OS")
68+
OS_VER_MAJOR=$(echo "$OS_VER" | cut -d. -f1)
69+
}
70+
71+
72+
#### Install Dependencies ####
73+
74+
dependencies() {
75+
print_brake 20
76+
echo -e "* ${GREEN}Installing dependencies...${reset}"
77+
print_brake 20
78+
case "$OS" in
79+
debian | ubuntu)
80+
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - && apt-get install -y nodejs
81+
;;
82+
83+
centos)
84+
[ "$OS_VER_MAJOR" == "7" ] && curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash - && sudo yum install -y nodejs yarn
85+
[ "$OS_VER_MAJOR" == "8" ] && curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash - && sudo dnf install -y nodejs yarn
86+
;;
87+
esac
88+
}
89+
90+
91+
#### Donwload Files ####
92+
print_brake 25
93+
echo -e "* ${GREEN}Downloading files...${reset}"
94+
print_brake 25
95+
download_files() {
96+
cd /var/www/pterodactyl/resources/scripts
97+
curl -o user.css https://raw.githubusercontent.com/Ferks-FK/Pterodactyl-AutoThemes/main/themes/version1.x/Twilight/user.css
98+
curl -o admin.css https://raw.githubusercontent.com/Ferks-FK/Pterodactyl-AutoThemes/main/themes/version1.x/Twilight/admin.css
99+
rm -R index.tsx
100+
curl -o index.tsx https://raw.githubusercontent.com/Ferks-FK/Pterodactyl-AutoThemes/main/themes/version1.x/Twilight/index.tsx
101+
cd
102+
cd /var/www/pterodactyl/resources/views/layouts
103+
rm -R admin.blade.php
104+
curl -o admin.blade.php https://raw.githubusercontent.com/Ferks-FK/Pterodactyl-AutoThemes/main/themes/version1.x/Twilight/admin.blade.php
105+
}
106+
107+
#### Panel Production ####
108+
109+
production() {
110+
DIR=/var/www/pterodactyl
111+
112+
if [ -d "$DIR" ]; then
113+
print_brake 25
114+
echo -e "* ${GREEN}Producing panel...${reset}"
115+
print_brake 25
116+
npm i -g yarn
117+
cd /var/www/pterodactyl
118+
yarn install
119+
yarn add @emotion/react
120+
yarn build:production
121+
fi
122+
}
123+
124+
125+
bye() {
126+
print_brake 40
127+
echo
128+
echo -e "* ${GREEN}The theme ${YELLOW}Dracula${GREEN} was successfully installed.${reset}"
129+
echo -e "* ${GREEN}Thank you for using this script.${reset}"
130+
echo -e "* ${GREEN}Support group: $(hyperlink "$SUPPORT_LINK")${reset}"
131+
echo
132+
print_brake 40
133+
}
134+
135+
136+
#### Exec Script ####
137+
check_distro
138+
dependencies
139+
download_files
140+
production
141+
bye

0 commit comments

Comments
 (0)