-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrhel-dl.sh
104 lines (92 loc) · 3.59 KB
/
rhel-dl.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
#!/bin/bash
R='\033[0;31m'
G='\033[0;32m'
P="\033[38;2;217;18;251m"
Y='\033[1;33m'
NC='\033[0m'
ensure_path_format() {
local path="$1"
# Add a leading slash if it's not present
[[ "$path" != /* ]] && path="/$path"
# Add a trailing slash if it's not present
[[ "$path" != */ ]] && path="$path/"
echo "$path"
}
start_loading() {
echo -n "Installing Dependencies... "
while :; do
for s in / - \\ \|; do
printf "\rInstalling Dependencies... %s" "$s"
sleep 0.2
done
done &
LOADING_PID=$!
}
stop_loading() {
kill "$LOADING_PID" &>/dev/null
printf "\r\033[K"
}
echo "Enter the path to the panel directory. default : /var/www/pterodactyl/"
read -r PTERO_PANEL
PTERO_PANEL=${PTERO_PANEL:-/var/www/pterodactyl/} # Use default value if input is empty
PTERO_PANEL=$(ensure_path_format "$PTERO_PANEL")
# Check if the panel directory exists
if [[ ! -d "$PTERO_PANEL" ]]; then
echo -e "${R}[!] The panel directory does not exist. Please ensure that the panel directory is correct before running Blueprint.${NC}"
exit 1
fi
start_loading
# Installing dependencies
sudo yum install -y ca-certificates curl gnupg unzip zip &> /dev/null
yum install wget -y &> /dev/null
curl -sL https://rpm.nodesource.com/setup_20.x | sudo bash - &> /dev/null
sudo yum update &> /dev/null
yum install nodejs -y &> /dev/null
sudo npm i -g yarn &> /dev/null
stop_loading
cd "$PTERO_PANEL" || exit
# Yarn install with silent mode to reduce output noise
yarn install --silent
IS_MODIFIED=false
if diff -q <(curl -s https://raw.githubusercontent.com/pterodactyl/panel/develop/routes/admin.php) "${PTERO_PANEL}routes/admin.php" &> /dev/null; then
IS_MODIFIED=true
fi
if diff -q <(curl -s https://raw.githubusercontent.com/pterodactyl/panel/develop/resources/scripts/routers/routes.ts) "${PTERO_PANEL}resources/scripts/routers/routes.ts" &> /dev/null; then
IS_MODIFIED=true
fi
if [[ $IS_MODIFIED == "true" ]]; then
echo -e "${R}[!] Blueprint has detected that the panel has been modified. Please ensure that the panel is not modified before running Blueprint.${NC}"
exit 1
fi
# Validate and handle the download URL securely
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/BlueprintFramework/framework/releases/latest | grep 'browser_download_url' | cut -d '"' -f 4)
if [[ -n $DOWNLOAD_URL ]]; then
wget "$DOWNLOAD_URL" -O latest_release.zip &> /dev/null
unzip -o latest_release.zip &> /dev/null
chmod +x blueprint.sh
./blueprint.sh
echo -e "${P}Thanks for using our script!"
echo -e "If you found it helpful, please consider sharing and/or starring our GitHub repo."
printf "\n"
cat << "EOF"
,ad8PPPP88b, ,d88PPPP8ba,
d8P" "Y8b, ,d8P" "Y8b
dP' "8a8" `Yd
8( " )8
I8 8I
Yb, ,dP
"8a, ,a8"
"8a, ,a8"
"Yba adP"
`Y8a a8P'
`88, ,88'
"8b d8"
"8b d8"
`888'
"
EOF
echo -e "${NC}"
else
echo -e "${R}[!] Failed to retrieve the latest release of Blueprint. Please check your internet connection and try again.${NC}"
exit 1
fi