#!/bin/bash set -e ###################################################################################### # # Script By RamaGans ID # # # This script is not associated with the official Pterodactyl Project. # # https://github.com/pterodactyl-installer/pterodactyl-installer # # # ###################################################################################### export GITHUB_SOURCE="v0.12.2" export SCRIPT_RELEASE="v0.12.2" export GITHUB_BASE_URL="https://raw.githubusercontent.com/pterodactyl-installer/pterodactyl-installer" LOG_PATH="/var/log/pterodactyl-installer.log" # check for curl if ! [ -x "$(command -v curl)" ]; then echo "* curl is required in order for this script to work." echo "* install using apt (Debian and derivatives) or yum/dnf (CentOS)" exit 1 fi # Always remove lib.sh, before downloading it rm -rf /tmp/lib.sh curl -sSL -o /tmp/lib.sh "$GITHUB_BASE_URL"/"$GITHUB_SOURCE"/lib/lib.sh # shellcheck source=lib/lib.sh source /tmp/lib.sh execute() { echo -e "\n\n* pterodactyl-installer $(date) \n\n" >>$LOG_PATH [[ "$1" == *"canary"* ]] && export GITHUB_SOURCE="master" && export SCRIPT_RELEASE="canary" update_lib_source run_ui "${1//_canary/}" |& tee -a $LOG_PATH if [[ -n $2 ]]; then echo -e -n "* Installation of $1 completed. Do you want to proceed to $2 installation? (y/N): " read -r CONFIRM if [[ "$CONFIRM" =~ [Yy] ]]; then execute "$2" else error "Installation of $2 aborted." exit 1 fi fi } welcome "" done=false while [ "$done" == false ]; do options=( "Install the panel" "Install Wings" "Install both [0] and [1] on the same machine (wings script runs after panel)" # "Uninstall panel or wings\n" "Install panel with canary version of the script (the versions that lives in master, may be broken!)" "Install Wings with canary version of the script (the versions that lives in master, may be broken!)" "Install both [3] and [4] on the same machine (wings script runs after panel)" "Uninstall panel or wings with canary version of the script (the versions that lives in master, may be broken!)" ) actions=( "panel" "wings" "panel;wings" # "uninstall" "panel_canary" "wings_canary" "panel_canary;wings_canary" "uninstall_canary" ) output "What would you like to do?" for i in "${!options[@]}"; do output "[$i] ${options[$i]}" done echo -n "* Input 0-$((${#actions[@]} - 1)): " read -r action [ -z "$action" ] && error "Input is required" && continue valid_input=("$(for ((i = 0; i <= ${#actions[@]} - 1; i += 1)); do echo "${i}"; done)") [[ ! " ${valid_input[*]} " =~ ${action} ]] && error "Invalid option" [[ " ${valid_input[*]} " =~ ${action} ]] && done=true && IFS=";" read -r i1 i2 <<<"${actions[$action]}" && execute "$i1" "$i2" done # Remove lib.sh, so next time the script is run the, newest version is downloaded. rm -rf /tmp/lib.sh