#!/bin/bash # KernelPanel Universal Installer Bootstrap Script # https://install.kernelpanel.com set -e # Define color codes for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo -e "${GREEN}Starting KernelPanel Installation Bootstrap...${NC}" # Check for root privileges if [ "$EUID" -ne 0 ]; then echo -e "${RED}Error: Please run this script as root (sudo bash install.sh)${NC}" exit 1 fi # Detect OS if [ -f /etc/os-release ]; then . /etc/os-release OS=$ID VER=$VERSION_ID else echo -e "${RED}Error: Cannot detect OS. /etc/os-release not found.${NC}" exit 1 fi echo -e "Detected OS: ${YELLOW}${OS} ${VER}${NC}" # Define the base URL for scripts BASE_URL="https://install.kernelpanel.com" # Determine the correct script based on OS and version SCRIPT_URL="" case "$OS" in ubuntu) if [ "$VER" == "24.04" ]; then SCRIPT_NAME="install-ubuntu-24.04.sh" else echo -e "${RED}Error: Ubuntu version ${VER} is not currently supported by KernelPanel.${NC}" echo "Supported versions: 24.04" exit 1 fi ;; *) echo -e "${RED}Error: OS '${OS}' is not currently supported by KernelPanel.${NC}" exit 1 ;; esac SCRIPT_URL="${BASE_URL}/${SCRIPT_NAME}" # Temporary file for the downloaded script TMP_SCRIPT=$(mktemp) echo -e "${GREEN}Downloading installation script for your OS...${NC}" if ! curl -sSL -f "$SCRIPT_URL" -o "$TMP_SCRIPT"; then echo -e "${RED}Error: Failed to download the installation script from ${SCRIPT_URL}${NC}" rm -f "$TMP_SCRIPT" exit 1 fi # In a production environment, you would also download a checksum file and verify it here # Example: # curl -sSL "${SCRIPT_URL}.sha256" -o "${TMP_SCRIPT}.sha256" # sha256sum -c "${TMP_SCRIPT}.sha256" echo -e "${GREEN}Executing the installation script...${NC}" bash "$TMP_SCRIPT" # Clean up rm -f "$TMP_SCRIPT"