Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
growtoups authored May 10, 2024
1 parent 5a322fc commit 2d64aec
Show file tree
Hide file tree
Showing 9 changed files with 972 additions and 0 deletions.
103 changes: 103 additions & 0 deletions deb-dl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/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 apt-get install -y ca-certificates curl gnupg unzip zip &> /dev/null
sudo mkdir -p /etc/apt/keyrings &> /dev/null
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg --yes &> /dev/null
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list &> /dev/null
sudo apt-get update &> /dev/null
sudo apt-get install -y nodejs &> /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/main/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
124 changes: 124 additions & 0 deletions deb-rmb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/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"
}

echo -e "WARNING!: ${R}The following uninstall will remove blueprint and most* of its components."
echo -e "This will also delete your app/, public/, resources/, and ./blueprint folders.${NC}"
read -p "$(echo -e "${Y}Are you sure you want to continue with the uninstall${NC} (${G}y${Y}/${R}n${NC}): ")" choice

case "$choice" in
y|Y)
echo "Continuing with the uninstallation..."
;;
n|N)
echo "Exiting the script."
exit
;;
*)
echo -e "${Y}Invalid choice. Please enter 'y' for yes or 'n' for no.${NC}"
exit 1
;;
esac

# Define variables and proceed with the uninstallation
PTERO_PANEL=${PTERO_PANEL:-/var/www/pterodactyl/} # Use default value if input is empty
PTERO_PANEL=$(ensure_path_format "$PTERO_PANEL")
files_to_delete=(
".blueprint/"
"app/"
"public/"
"resources/"
"routes/"
"blueprint.sh"
)
echo "Enter the path to the panel directory. default : /var/www/pterodactyl/"
read -r 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 the uninstallation script.${NC}"
exit 1
fi
currentLoc=$(pwd)
cd "$PTERO_PANEL" || exit
php artisan down
echo "Set panel into Maintenance Mode"

# Iterate over each filename and delete it
for filename in "${files_to_delete[@]}"; do
if [[ -e "$filename" ]]; then
rm -r "$filename"
echo "Deleted '$filename'."
else
echo "File '$filename' does not exist."
fi
done

echo "Deleting files completed."
curl -L https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz | tar -xzv
echo "Latest Pterodactyl panel downloaded and extracted."
rm -f panel.tar.gz
chmod -R 755 storage/* bootstrap/cache
php artisan view:clear
php artisan config:clear

read -p "$(echo -e "${Y}Do you want to update your database schema for the newest version of Pterodactyl? (${G}y${Y}/${R}n${NC}): ")" choice

case "$choice" in
y|Y)
echo "Updating database schema..."
php artisan migrate -q --seed --force
;;
n|N)
echo "Skipping database schema update."
;;
*)
echo "${Y}Invalid choice.${NC}"
exit 1
;;
esac

echo -e "${G}Finishing up...${NC}"
chown -R www-data:www-data "$PTERO_PANEL"
php artisan queue:restart
php artisan up
chown -R www-data:www-data "$PTERO_PANEL"
echo "If you want to update your dependencies also, run:"
echo "composer install --no-dev --optimize-autoloader"
echo "As composer's recommendation, do NOT run it as root."
echo "See https://getcomposer.org/root for details."
cd "$currentLoc"
echo -e "${G}Uninstallation and update process completed!${NC}"
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}"
130 changes: 130 additions & 0 deletions deb-rmpb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/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_uninstall() {
echo -n "Uninstalling... "
while :; do
for s in / - \\ \|; do
printf "\rUninstalling... %s" "$s"
sleep 0.2
done
done &
LOADING_PID=$!
}
stop_uninstall() {
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 an update.${NC}"
exit 1
fi
# Warning the users
echo -e "WARNING: ${R}Uninstalling Pterodactyl & Blueprint will delete everything without any possibility of restoring it.${NC}"
read -p "$(echo -e "${Y}Are you sure you want to continue with the uninstallation? (${G}y${Y}/${R}n${NC}): ")" choice

case "$choice" in
y|Y)
start_uninstall
sudo rm -rf $PTERO_PANEL &> /dev/null

# Pteroq queue worker
sudo rm /etc/systemd/system/pteroq.service &> /dev/null

# Removing conf files
sudo unlink /etc/nginx/sites-enabled/pterodactyl.conf &> /dev/null
stop_uninstall
read -p "$(echo -e "${Y}Do you want to remove nginx? (${G}y${Y}/${R}n${NC}): ")" choice

case "$choice" in
y|Y)
start_uninstall
# Stopping nginx
sudo systemctl stop nginx &> /dev/null

sudo apt purge nginx nginx-common -y &> /dev/null
sudo apt autoremove -y &> /dev/null # remove any leftover dependencies
stop_uninstall
# Dropping DB & user
echo -e "${G}Dropping database and user...${NC}"
mysql -u root -p -e "SHOW DATABASES; DROP DATABASE panel; SELECT User, Host FROM mysql.user; DROP USER 'pterodactyl'@'127.0.0.1';"
echo -e "${G}Uninstallation process has been completed!${NC}"
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}"
;;
n|N)
# Dropping DB & user
echo -e "${G}Dropping database and user...${NC}"
mysql -u root -p -e "SHOW DATABASES; DROP DATABASE panel; SELECT User, Host FROM mysql.user; DROP USER 'pterodactyl'@'127.0.0.1';"
echo -e "${G}Uninstallation process has been completed!${NC}"
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}"
exit
;;
n|N)
echo "Exiting the script."
exit
esac
;;
*)
echo -e "${Y}Invalid section. Exiting.${NC}"
exit 1
;;
esac
Loading

0 comments on commit 2d64aec

Please sign in to comment.