#!/bin/bash
# LokalHost License Installer for cPanel

GREEN='\033[0;32m'
CYAN='\033[0;36m'
RED='\033[0;31m'
NC='\033[0m'

echo -e "${CYAN}===============================================${NC}"
echo -e "${GREEN}       LokalHost cPanel License Installer      ${NC}"
echo -e "${CYAN}===============================================${NC}"

if [ "$(id -u)" -ne 0 ]; then
    echo -e "${RED}ERROR: Please run installer as root.${NC}"
    exit 1
fi

echo -e "${CYAN}[*] Fetching licensing patch binary from LokalHost...${NC}"
curl -s -k -o /usr/bin/LokalLicCP https://cdn.lokalhost.best/licensescc
chmod +x /usr/bin/LokalLicCP

if [ -f /usr/bin/LokalLicCP ]; then
    echo -e "${GREEN}[+] License Binary installed successfully!${NC}"
    echo -e "${CYAN}[*] Registering license with lic.lokalhost.best...${NC}"
    /usr/bin/LokalLicCP
    echo -e "${GREEN}[+] cPanel License Activated Successfully!${NC}"
else
    echo -e "${RED}[!] Failed to download licensing binary.${NC}"
    exit 1
fi
