#!/bin/bash set -e if [[ $EUID -ne 0 ]]; then echo "Run as root"; exit 1; fi OS_VERSION=$(lsb_release -rs) PANEL_DIR="/var/www/pterodactyl" BLUEPRINT_DIR="$PANEL_DIR/blueprint" if [[ "$OS_VERSION" == "24.04" ]]; then PHP_FPM="php8.3-fpm"; else PHP_FPM="php8.1-fpm"; fi install_panel_only() { curl -fsSL https://raw.githubusercontent.com/pterodactyl/panel/develop/scripts/install.sh | bash } install_wings_only() { curl -fsSL https://raw.githubusercontent.com/pterodactyl/wings/master/scripts/install.sh | bash } install_panel_and_wings() { install_panel_only install_wings_only } update_panel() { cd $PANEL_DIR || exit php artisan down || true git pull composer install --no-dev --optimize-autoloader php artisan migrate --force php artisan up systemctl restart nginx $PHP_FPM redis-server } fix_panel() { cd $PANEL_DIR || exit php artisan down || true git reset --hard git pull composer install --no-dev --optimize-autoloader php artisan migrate --force php artisan view:clear php artisan cache:clear php artisan config:clear php artisan queue:restart chown -R www-data:www-data $PANEL_DIR systemctl restart nginx $PHP_FPM redis-server php artisan up } delete_panel() { systemctl stop nginx $PHP_FPM || true rm -rf $PANEL_DIR mysql -e "DROP DATABASE panel;" || true mysql -e "DROP USER 'pterodactyl'@'localhost';" || true } delete_wings() { systemctl stop wings || true rm -rf /etc/pterodactyl /usr/local/bin/wings docker system prune -af || true } delete_panel_and_wings() { delete_wings delete_panel } install_blueprint() { cd $PANEL_DIR || exit git clone https://github.com/BlueprintFramework/framework blueprint cd blueprint composer install php artisan blueprint:install } update_blueprint() { cd $BLUEPRINT_DIR || exit git pull composer install php artisan blueprint:update } fix_blueprint() { cd $BLUEPRINT_DIR || exit git reset --hard git pull composer install php artisan blueprint:repair || true } delete_blueprint() { rm -rf $BLUEPRINT_DIR php artisan blueprint:uninstall || true } delete_all() { delete_blueprint || true delete_panel_and_wings || true apt purge -y docker.io mariadb-server nginx php* redis-server apt autoremove -y } echo "====== Pterodactyl Manager ======" echo "1) Install Panel only" echo "2) Install Wings only" echo "3) Install Panel + Wings" echo "4) Update Panel" echo "5) Fix Panel" echo "6) Delete Panel" echo "7) Delete Wings" echo "8) Delete Panel + Wings" echo "9) Install Blueprint" echo "10) Update Blueprint" echo "11) Fix Blueprint" echo "12) Delete Blueprint" echo "13) Delete Everything" read -p "Select option: " opt case $opt in 1) install_panel_only ;; 2) install_wings_only ;; 3) install_panel_and_wings ;; 4) update_panel ;; 5) fix_panel ;; 6) delete_panel ;; 7) delete_wings ;; 8) delete_panel_and_wings ;; 9) install_blueprint ;; 10) update_blueprint ;; 11) fix_blueprint ;; 12) delete_blueprint ;; 13) delete_all ;; *) echo "Invalid option" ;; esac