#!/bin/bash # ============= MAIN INSTALLER SCRIPT ============= # Premium Panel Installer # ================================================= # Check if running as root if [ "$EUID" -ne 0 ]; then echo "Please run as root (use: sudo bash $0)" exit 1 fi # ========= CONFIGURATION ========= CACHE_DIR="/etc/panel_installer" # ========= INITIAL SETUP ========= # Create cache directory mkdir -p "$CACHE_DIR" chmod 700 "$CACHE_DIR" # Colors for output RED='\033[1;31m' GREEN='\033[1;32m' YELLOW='\033[1;33m' BLUE='\033[1;34m' CYAN='\033[1;36m' NC='\033[0m' # ========= CONTINUE WITH NORMAL INSTALLER ========= # Define module directory MODULE_DIR="/tmp/panel_installer_modules" # Clean up previous modules rm -rf "$MODULE_DIR" mkdir -p "$MODULE_DIR" # Download all modules from GitHub download_module() { local module_name="$1" local url="https://raw.githubusercontent.com/TS-25/SRJ-THEME/main/${module_name}.sh" echo "Downloading $module_name..." if curl -s "$url" -o "$MODULE_DIR/$module_name.sh"; then chmod +x "$MODULE_DIR/$module_name.sh" echo "✓ $module_name downloaded" return 0 else echo "✗ Failed to download $module_name" return 1 fi } # Simple logging functions (will be overridden by core_setup) print_success() { echo -e "${GREEN}✓${NC} $1"; } print_error() { echo -e "${RED}✗${NC} $1"; } print_warning() { echo -e "${YELLOW}⚠${NC} $1"; } print_info() { echo -e "${BLUE}ℹ${NC} $1"; } # Simple display header (will be overridden by core_setup) display_header() { clear echo -e "${CYAN}" echo "╔══════════════════════════════════════╗" echo "║ PREMIUM PANEL INSTALLER ║" echo "╚══════════════════════════════════════╝${NC}" echo -e "${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo "" } # Simple main menu (will be overridden by loaded modules) show_main_menu() { echo "Main Menu:" echo "1) Install Panels" echo "2) Install Themes" echo "3) Install Addons" echo "4) System Information" echo "5) Exit" echo -e "${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" } # Download required modules echo "" print_info "Downloading installer modules..." if download_module "core_setup" && \ download_module "panel_installer" && \ download_module "theme_installer" && \ download_module "addon_installer"; then # Load all modules if source "$MODULE_DIR/core_setup.sh" 2>/dev/null; then print_success "Core module loaded" else print_error "Failed to load core module" exit 1 fi if source "$MODULE_DIR/panel_installer.sh" 2>/dev/null; then print_success "Panel module loaded" else print_warning "Panel module failed to load" fi if source "$MODULE_DIR/theme_installer.sh" 2>/dev/null; then print_success "Theme module loaded" else print_warning "Theme module failed to load" fi if source "$MODULE_DIR/addon_installer.sh" 2>/dev/null; then print_success "Addon module loaded" else print_warning "Addon module failed to load" fi print_success "All modules loaded successfully!" echo "" else print_error "Failed to download required modules" echo "Please check your internet connection and try again." exit 1 fi # ========= MAIN LOOP ========= while true; do display_header show_main_menu read -rp "Select option: " main_choice case $main_choice in 1) # Panels if type show_panel_menu &>/dev/null && type handle_panel_choice &>/dev/null; then while true; do display_header show_panel_menu if ! handle_panel_choice; then break fi echo -e "\n${YELLOW}Press Enter to continue...${NC}" read -r done else print_error "Panel installer module not available" sleep 2 fi ;; 2) # Themes if type show_theme_menu &>/dev/null && type handle_theme_choice &>/dev/null; then while true; do display_header show_theme_menu if ! handle_theme_choice; then break fi echo -e "\n${YELLOW}Press Enter to continue...${NC}" read -r done else print_error "Theme installer module not available" sleep 2 fi ;; 3) # Addons if type show_addon_menu &>/dev/null && type handle_addon_choice &>/dev/null; then while true; do display_header show_addon_menu if ! handle_addon_choice; then break fi echo -e "\n${YELLOW}Press Enter to continue...${NC}" read -r done else print_error "Addon installer module not available" sleep 2 fi ;; 4) # System Info display_header echo -e "${CYAN}=== SYSTEM INFORMATION ===${NC}" # Detect panel PANEL_PATH="" if [ -d "/var/www/pterodactyl" ]; then PANEL_PATH="/var/www/pterodactyl" PANEL_TYPE="Pterodactyl" elif [ -d "/var/www/reviactyl" ]; then PANEL_PATH="/var/www/reviactyl" PANEL_TYPE="Reviactyl" elif [ -d "/var/www/panel" ]; then PANEL_PATH="/var/www/panel" PANEL_TYPE="Generic" fi echo "Panel Type: ${PANEL_TYPE:-Not detected}" echo "Panel Path: ${PANEL_PATH:-Not found}" echo "Blueprint: $(command -v blueprint >/dev/null && echo "Installed" || echo "Not installed")" echo "System: $(uname -s -r)" echo "Hostname: $(hostname)" echo "IP Address: $(hostname -I | awk '{print $1}' 2>/dev/null || echo "Not available")" echo -e "\n${YELLOW}Press Enter to continue...${NC}" read -r ;; 5) # Exit display_header echo "Thank you for using Premium Panel Installer!" echo "" print_success "Goodbye!" exit 0 ;; *) print_error "Invalid option" sleep 1 ;; esac done