From ade8e76a689ed25b5bd509dab4690e6e60c9ca04 Mon Sep 17 00:00:00 2001 From: Hyko Date: Tue, 12 May 2026 22:01:57 -0400 Subject: [PATCH] style(ui): apply cyberpunk neon theme across all menus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - replace color palette with Cyberpunk 2077 neon variants in lib/common.sh - add DIM, BLINK, REV attributes and show_title ui helper - make show_separator terminal-width-aware via tput cols - restyle menus with ◢ numbered items and ▸_ prompt indicator - support two-digit input aliases (01-05, 00) alongside single-digit - update status tokens: [✓]/[✗] → [OK]/[KO], PURPLE → MAGENTA - apply consistent ui changes to lxs.sh and tools/index.sh --- apps/index.sh | 40 ++++++++--------- lib/common.sh | 60 ++++++++++++++++---------- lxs.sh | 115 +++++++++++++++++++++++-------------------------- tools/index.sh | 48 ++++++++++----------- 4 files changed, 134 insertions(+), 129 deletions(-) diff --git a/apps/index.sh b/apps/index.sh index 668ae67..bb534de 100755 --- a/apps/index.sh +++ b/apps/index.sh @@ -34,16 +34,16 @@ run_sibling() { local temp_file exit_code temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh") - echo -e "${PURPLE}[*] Downloading ${BOLD}${script_name}${NC}${PURPLE}...${NC}" + echo -e "${MAGENTA}[··] Fetching ${BOLD}${script_name}${NC}${MAGENTA}...${NC}" if curl -fsSL -H "Cache-Control: no-cache" -o "${temp_file}" "${LXS_RAW_BASE}/${script_path}"; then - echo -e "${GREEN}[✓] Downloaded${NC}" + echo -e "${GREEN}[OK] Payload acquired${NC}" chmod +x "${temp_file}" "${temp_file}" "$@" exit_code=$? rm -f "${temp_file}" return $exit_code else - echo -e "${RED}[✗] Failed to download ${script_path}${NC}" + echo -e "${RED}[KO] Failed to download ${script_path}${NC}" rm -f "${temp_file}" return 1 fi @@ -52,31 +52,29 @@ run_sibling() { menu_apps() { while true; do clear - echo -e "${WHITE}╔═══════════════════════════════════════════════════════╗${NC}" - echo -e "${WHITE}║ APPLICATIONS ║${NC}" - echo -e "${WHITE}╚═══════════════════════════════════════════════════════╝${NC}" + show_title "APPLICATIONS" "APP_REPOSITORY" echo "" - echo -e " ${GREEN}[1]${NC} Coolify" - echo -e " ${GREEN}[2]${NC} Pterodactyl Panel" - echo -e " ${GREEN}[3]${NC} Uptime Kuma" - echo -e " ${GREEN}[4]${NC} CloudPanel" - echo -e " ${GREEN}[5]${NC} Proxmox VE Tools" - echo -e " ${RED}[0]${NC} Back" + echo -e " ${YELLOW}◢ 01${NC} ${GRAY}│${NC} ${WHITE}Coolify${NC}" + echo -e " ${YELLOW}◢ 02${NC} ${GRAY}│${NC} ${WHITE}Pterodactyl Panel${NC}" + echo -e " ${YELLOW}◢ 03${NC} ${GRAY}│${NC} ${WHITE}Uptime Kuma${NC}" + echo -e " ${YELLOW}◢ 04${NC} ${GRAY}│${NC} ${WHITE}CloudPanel${NC}" + echo -e " ${YELLOW}◢ 05${NC} ${GRAY}│${NC} ${WHITE}Proxmox VE Tools${NC}" + echo -e " ${RED}◢ 00${NC} ${GRAY}│${NC} ${WHITE}BACK${NC}" echo "" - echo -e -n "${BOLD}Choice [0-5]: ${NC}" + echo -e -n "${YELLOW}▸${NC}${MAGENTA}_${NC} " read -r choice case $choice in - 1) run_sibling "apps/coolify.sh" ;; - 2) run_sibling "apps/pterodactyl.sh" ;; - 3) run_sibling "apps/uptime-kuma.sh" ;; - 4) run_sibling "apps/cloudpanel.sh" ;; - 5) run_sibling "apps/proxmox.sh" ;; - 0) return ;; - *) echo -e "${RED}[✗] Invalid option. Please select 0-5.${NC}"; sleep 1; continue ;; + 1|01) run_sibling "apps/coolify.sh" ;; + 2|02) run_sibling "apps/pterodactyl.sh" ;; + 3|03) run_sibling "apps/uptime-kuma.sh" ;; + 4|04) run_sibling "apps/cloudpanel.sh" ;; + 5|05) run_sibling "apps/proxmox.sh" ;; + 0|00) return ;; + *) echo -e "${RED}[KO] Invalid protocol. Select 0-5.${NC}"; sleep 1; continue ;; esac - if [ "$choice" != "0" ]; then + if [ "$choice" != "0" ] && [ "$choice" != "00" ]; then echo "" read -r -p "Press Enter to continue..." fi diff --git a/lib/common.sh b/lib/common.sh index 38b2fd1..b23b257 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -7,31 +7,47 @@ # Repo: https://git.hyko.cx/hykocx/lxs # ═══════════════════════════════════════════════════════════════════════════ -# Colors +# Colors — Cyberpunk 2077 neon palette # ═══════════════════════════════════════════════════════════════════════════ -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -PURPLE='\033[1;94m' -CYAN='\033[0;36m' -WHITE='\033[1;37m' -GRAY='\033[0;37m' +RED='\033[1;91m' # ICE alert +GREEN='\033[1;92m' # phosphor green +YELLOW='\033[1;93m' # signature electric yellow +MAGENTA='\033[1;95m' # hot pink neon +CYAN='\033[1;96m' # neon cyan +WHITE='\033[1;97m' # bold white +GRAY='\033[0;90m' # dark gray +PURPLE='\033[1;95m' # alias on MAGENTA for legacy sub-scripts NC='\033[0m' BOLD='\033[1m' +DIM='\033[2m' +BLINK='\033[5m' +REV='\033[7m' # ═══════════════════════════════════════════════════════════════════════════ # UI helpers # ═══════════════════════════════════════════════════════════════════════════ show_separator() { - echo -e "${GRAY}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" + local cols + cols=$(tput cols 2>/dev/null || echo 64) + printf "${YELLOW}" + printf '▀%.0s' $(seq 1 "$cols") + printf "${NC}\n" } -info() { echo -e "${PURPLE}[*]${NC} $*"; } -ok() { echo -e "${GREEN}[✓]${NC} $*"; } -warn() { echo -e "${YELLOW}[!]${NC} $*"; } -err() { echo -e "${RED}[✗]${NC} $*" >&2; } +show_title() { + local title="$1" + local subtitle="${2:-SYS_MODULE}" + echo "" + echo -e "${YELLOW}${REV} ${title} ${NC} ${MAGENTA}// ${subtitle}${NC}" + show_separator +} + +info() { echo -e "${MAGENTA}[··]${NC} $*"; } +ok() { echo -e "${GREEN}[OK]${NC} $*"; } +warn() { echo -e "${YELLOW}[!!]${NC} $*"; } +err() { echo -e "${RED}[KO]${NC} $*" >&2; } # ═══════════════════════════════════════════════════════════════════════════ # Spinner — runs a shell command, redirects output to a log file, shows @@ -51,13 +67,13 @@ run_spinner() { local spinstr='|/-\' local log="${LXS_LOG_FILE:-/tmp/lxs.log}" - echo -e "${PURPLE}[*] ${message}${NC}" + echo -e "${MAGENTA}[··] ${message}${NC}" eval "$command" > "$log" 2>&1 & local pid=$! while kill -0 "$pid" 2>/dev/null; do local temp=${spinstr#?} - printf "\r${PURPLE}[%c]${NC} ${message}" "$spinstr" + printf "\r${MAGENTA}[%c·]${NC} ${message}" "$spinstr" spinstr=$temp${spinstr%"$temp"} sleep 0.15 done @@ -65,9 +81,9 @@ run_spinner() { wait "$pid" local exit_code=$? if [ $exit_code -eq 0 ]; then - printf "\r${GREEN}[✓]${NC} ${message}\n" + printf "\r${GREEN}[OK]${NC} ${message}\n" else - printf "\r${RED}[✗]${NC} ${message}\n" + printf "\r${RED}[KO]${NC} ${message}\n" fi return $exit_code } @@ -138,7 +154,7 @@ ufw_allow() { else ufw allow "$rule" >/dev/null fi - ok "UFW: allowed ${rule}${comment:+ (${comment})}" + ok "UFW :: allowed ${rule}${comment:+ (${comment})}" } # Wait for other apt/dpkg processes to release their locks. Up to 120s. @@ -154,17 +170,17 @@ wait_for_apt() { fuser /var/lib/apt/lists/lock >/dev/null 2>&1; do [ "$lock_detected" = false ] && lock_detected=true && \ - echo -e "${YELLOW}[!] Waiting for other package manager to finish...${NC}" + echo -e "${YELLOW}[!!] Waiting for other package manager to finish...${NC}" wait_count=$((wait_count + 1)) [ $wait_count -ge $max_wait ] && \ - echo -e "${RED}[✗] Timeout waiting for package manager${NC}" && return 1 + echo -e "${RED}[KO] Timeout waiting for package manager${NC}" && return 1 - printf "\r${GRAY}[i] Waiting... (%ds/%ds)${NC}" $wait_count $max_wait + printf "\r${GRAY}[··] Waiting... (%ds/%ds)${NC}" $wait_count $max_wait sleep 1 done [ "$lock_detected" = true ] && \ - echo -e "\n${GREEN}[✓] Package manager is now available${NC}" + echo -e "\n${GREEN}[OK] Package manager is now available${NC}" return 0 } diff --git a/lxs.sh b/lxs.sh index 2ecdf18..4a81b7c 100755 --- a/lxs.sh +++ b/lxs.sh @@ -120,18 +120,15 @@ check_remote_version() { } show_lxs_logo() { - echo -e "${WHITE}${BOLD}" - echo -e "╔═══════════════════════════════════════════════════════╗" - echo -e "║ ║" - echo -e "║ ██╗ ██╗ ██╗███████╗ ║" - echo -e "║ ██║ ╚██╗██╔╝██╔════╝ ║" - echo -e "║ ██║ ╚███╔╝ ███████╗ ║" - echo -e "║ ██║ ██╔██╗ ╚════██║ ║" - echo -e "║ ███████╗██╔╝ ██╗███████║ ║" - echo -e "║ ╚══════╝╚═╝ ╚═╝╚══════╝ v${LXS_VERSION} ║" - echo -e "║ ║" - echo -e "╚═══════════════════════════════════════════════════════╝" - echo -e "${NC}" + local cols head tail_len + cols=$(tput cols 2>/dev/null || echo 64) + head=" L X S // v${LXS_VERSION} " + tail_len=$(( cols - ${#head} - 12 )) + [ "$tail_len" -lt 4 ] && tail_len=4 + local bar + bar=$(printf '▀%.0s' $(seq 1 "$tail_len")) + echo "" + echo -e "${YELLOW}▀▀▀${WHITE}${BOLD}${head}${NC}${YELLOW}${bar}${NC} ${GREEN}[ONLINE]${NC}" } show_header() { @@ -139,37 +136,31 @@ show_header() { show_lxs_logo if [ "${LXS_UPDATE_AVAILABLE:-0}" = "1" ]; then - echo -e "${YELLOW}[!] Nouvelle version disponible: ${LXS_REMOTE_VERSION} (actuelle: ${LXS_VERSION})${NC}" - echo -e "${GRAY} Lance: lxs update${NC}" - echo "" + echo -e "${YELLOW}▲ UPDATE_AVAILABLE :: v${LXS_REMOTE_VERSION}${NC} ${GRAY}// run \`lxs update\`${NC}" fi - local hostname os_version kernel uptime_info ip_address cpu_model cpu_cores total_mem used_mem disk_usage + local hostname os_version kernel uptime_info ip_address cpu_cores total_mem used_mem disk_usage hostname=$(hostname 2>/dev/null || cat /etc/hostname 2>/dev/null || echo "${HOSTNAME:-unknown}") os_version=$(lsb_release -ds 2>/dev/null || grep PRETTY_NAME /etc/os-release 2>/dev/null | cut -d'"' -f2) kernel=$(uname -r) - uptime_info=$(uptime -p 2>/dev/null || uptime | awk -F'up ' '{print $2}' | awk -F',' '{print $1}') + uptime_info=$(uptime -p 2>/dev/null | sed 's/^up //' || uptime | awk -F'up ' '{print $2}' | awk -F',' '{print $1}') ip_address=$(get_public_ip) - cpu_model=$(grep "model name" /proc/cpuinfo | head -1 | cut -d':' -f2 | xargs) cpu_cores=$(nproc) total_mem=$(free -h | awk '/^Mem:/ {print $2}') used_mem=$(free -h | awk '/^Mem:/ {print $3}') disk_usage=$(df -h / | awk 'NR==2 {print $3 "/" $2 " (" $5 ")"}') - echo -e "${GRAY}Hostname:${NC} $hostname" - echo -e "${GRAY}IP Address:${NC} $ip_address" - echo -e "${GRAY}OS:${NC} $os_version" - echo -e "${GRAY}Kernel:${NC} $kernel" - echo -e "${GRAY}Uptime:${NC} $uptime_info" - echo -e "${GRAY}CPU:${NC} $cpu_model ($cpu_cores cores)" - echo -e "${GRAY}Memory:${NC} $used_mem / $total_mem" - echo -e "${GRAY}Disk:${NC} $disk_usage" + echo "" + printf " ${CYAN}NODE${NC} %-22s ${CYAN}KERN${NC} %s\n" "$hostname" "$kernel" + printf " ${CYAN}ADDR${NC} %-22s ${CYAN}UP${NC} %s\n" "$ip_address" "$uptime_info" + printf " ${CYAN}OS${NC} %-22s ${CYAN}CPU${NC} %s cores\n" "$os_version" "$cpu_cores" + printf " ${CYAN}DISK${NC} %-22s ${CYAN}MEM${NC} %s / %s\n" "$disk_usage" "$used_mem" "$total_mem" echo "" } check_os() { if ! grep -qiE 'debian|ubuntu' /etc/os-release 2>/dev/null; then - echo -e "${YELLOW}[!] LXS is tested on Debian/Ubuntu. Other distros may not work.${NC}" + echo -e "${YELLOW}[!!] LXS is tested on Debian/Ubuntu. Other distros may not work.${NC}" read -r -p "Continue anyway? [y/N] " reply case "$reply" in [yY]|[yY][eE][sS]) ;; @@ -195,9 +186,9 @@ download_and_run() { echo "" show_separator if [ $exit_code -eq 0 ]; then - echo -e "${GREEN}[✓] Script completed successfully${NC}" + echo -e "${GREEN}[OK] Script completed successfully${NC}" else - echo -e "${YELLOW}[!] Script exited with code: $exit_code${NC}" + echo -e "${YELLOW}[!!] Script exited with code: $exit_code${NC}" fi return $exit_code fi @@ -206,12 +197,12 @@ download_and_run() { temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh") echo "" - echo -e "${PURPLE}[*] Downloading ${BOLD}${script_name}${NC}${PURPLE}...${NC}" + echo -e "${MAGENTA}[··] Fetching ${BOLD}${script_name}${NC}${MAGENTA}...${NC}" if curl -fsSL -H "Cache-Control: no-cache" \ -o "${temp_file}" \ "${LXS_RAW_BASE}/${script_path}"; then - echo -e "${GREEN}[✓] Downloaded${NC}" + echo -e "${GREEN}[OK] Payload acquired${NC}" chmod +x "${temp_file}" echo "" @@ -226,14 +217,14 @@ download_and_run() { echo "" show_separator if [ $exit_code -eq 0 ]; then - echo -e "${GREEN}[✓] Script completed successfully${NC}" + echo -e "${GREEN}[OK] Script completed successfully${NC}" else - echo -e "${YELLOW}[!] Script exited with code: $exit_code${NC}" + echo -e "${YELLOW}[!!] Script exited with code: $exit_code${NC}" fi return $exit_code else - echo -e "${RED}[✗] Failed to download ${script_path}${NC}" - echo -e "${RED} URL: ${LXS_RAW_BASE}/${script_path}${NC}" + echo -e "${RED}[KO] Failed to download ${script_path}${NC}" + echo -e "${RED} URL: ${LXS_RAW_BASE}/${script_path}${NC}" rm -f "${temp_file}" return 1 fi @@ -275,8 +266,8 @@ cmd_install() { uptime-kuma) download_and_run "apps/uptime-kuma.sh" ;; cloudpanel) download_and_run "apps/cloudpanel.sh" ;; proxmox) download_and_run "apps/proxmox.sh" ;; - "") echo -e "${RED}[✗] Missing app name. Try: lxs help${NC}"; return 1 ;; - *) echo -e "${RED}[✗] Unknown app: $app. Try: lxs help${NC}"; return 1 ;; + "") echo -e "${RED}[KO] Missing app name. Try: lxs help${NC}"; return 1 ;; + *) echo -e "${RED}[KO] Unknown app: $app. Try: lxs help${NC}"; return 1 ;; esac } @@ -291,8 +282,8 @@ cmd_tool() { update) download_and_run "tools/update-server.sh" "$@" ;; root-ssh-login) download_and_run "tools/root-ssh-login.sh" "$@" ;; welcome|motd) download_and_run "tools/welcome-message.sh" "$@" ;; - "") echo -e "${RED}[✗] Missing tool name. Try: lxs help${NC}"; return 1 ;; - *) echo -e "${RED}[✗] Unknown tool: $tool. Try: lxs help${NC}"; return 1 ;; + "") echo -e "${RED}[KO] Missing tool name. Try: lxs help${NC}"; return 1 ;; + *) echo -e "${RED}[KO] Unknown tool: $tool. Try: lxs help${NC}"; return 1 ;; esac } @@ -300,7 +291,7 @@ lxs_sync_install() { local action="${1:-update}" if lxs_need_root_for "$LXS_INSTALL_DIR" || lxs_need_root_for "$LXS_BIN_PATH"; then - echo -e "${YELLOW}[!] Need sudo to write ${LXS_INSTALL_DIR}; re-running with sudo...${NC}" + echo -e "${YELLOW}[!!] Need sudo to write ${LXS_INSTALL_DIR}; re-running with sudo...${NC}" exec sudo -E LXS_INSTALL_DIR="$LXS_INSTALL_DIR" LXS_BIN_PATH="$LXS_BIN_PATH" \ LXS_BRANCH="$LXS_BRANCH" LXS_REPO_URL="$LXS_REPO_URL" \ bash "$(lxs_self_path)" "$action" @@ -308,25 +299,25 @@ lxs_sync_install() { local work work=$(mktemp -d /tmp/lxs.install.XXXXXX) || { - echo -e "${RED}[✗] Failed to create temp dir${NC}" + echo -e "${RED}[KO] Failed to create temp dir${NC}" return 1 } trap 'rm -rf "$work"' RETURN - echo -e "${PURPLE}[*] Downloading ${LXS_TARBALL_URL}...${NC}" + echo -e "${MAGENTA}[··] Fetching ${LXS_TARBALL_URL}...${NC}" if ! curl -fsSL -H "Cache-Control: no-cache" -o "${work}/lxs.tgz" "$LXS_TARBALL_URL"; then - echo -e "${RED}[✗] Download failed${NC}" + echo -e "${RED}[KO] Download failed${NC}" return 1 fi mkdir -p "${work}/extracted" if ! tar -xzf "${work}/lxs.tgz" --strip-components=1 -C "${work}/extracted"; then - echo -e "${RED}[✗] Extraction failed${NC}" + echo -e "${RED}[KO] Extraction failed${NC}" return 1 fi if [ ! -f "${work}/extracted/lxs.sh" ] || [ ! -f "${work}/extracted/VERSION" ]; then - echo -e "${RED}[✗] Tarball is missing lxs.sh or VERSION${NC}" + echo -e "${RED}[KO] Tarball is missing lxs.sh or VERSION${NC}" return 1 fi @@ -334,7 +325,7 @@ lxs_sync_install() { if command -v rsync >/dev/null 2>&1; then rsync -a --delete "${work}/extracted/" "${LXS_INSTALL_DIR}/" || { - echo -e "${RED}[✗] rsync failed${NC}" + echo -e "${RED}[KO] rsync failed${NC}" return 1 } else @@ -342,7 +333,7 @@ lxs_sync_install() { [ -d "$LXS_INSTALL_DIR" ] && mv "$LXS_INSTALL_DIR" "${LXS_INSTALL_DIR}.old" mkdir -p "$LXS_INSTALL_DIR" if ! cp -a "${work}/extracted/." "${LXS_INSTALL_DIR}/"; then - echo -e "${RED}[✗] Copy failed; restoring previous install${NC}" + echo -e "${RED}[KO] Copy failed; restoring previous install${NC}" rm -rf "$LXS_INSTALL_DIR" [ -d "${LXS_INSTALL_DIR}.old" ] && mv "${LXS_INSTALL_DIR}.old" "$LXS_INSTALL_DIR" return 1 @@ -362,8 +353,8 @@ lxs_sync_install() { local new_version new_version=$(head -n1 "${LXS_INSTALL_DIR}/VERSION" 2>/dev/null | tr -d '[:space:]') - echo -e "${GREEN}[✓] lxs ${new_version} installed in ${LXS_INSTALL_DIR}${NC}" - echo -e "${GREEN}[✓] Symlink: ${LXS_BIN_PATH} → ${LXS_INSTALL_DIR}/lxs.sh${NC}" + echo -e "${GREEN}[OK] lxs ${new_version} installed in ${LXS_INSTALL_DIR}${NC}" + echo -e "${GREEN}[OK] Symlink: ${LXS_BIN_PATH} → ${LXS_INSTALL_DIR}/lxs.sh${NC}" } cmd_update() { @@ -381,38 +372,40 @@ cmd_install_self() { main_menu() { check_os check_remote_version + local hostname + hostname=$(hostname 2>/dev/null || echo "${HOSTNAME:-node}") while true; do show_header - echo -e "${WHITE}${BOLD}MAIN MENU${NC}" + echo -e "${MAGENTA}>> SELECT_PROTOCOL <<${NC}" echo "" - echo -e " ${GREEN}[1]${NC} Applications" - echo -e " ${CYAN}[2]${NC} Tools" - echo -e " ${GRAY}[u]${NC} Update lxs" - echo -e " ${RED}[0]${NC} Exit" + echo -e " ${YELLOW}◢ 01${NC} ${GRAY}│${NC} ${WHITE}APPLICATIONS${NC} ${GRAY}// deploy stacks${NC}" + echo -e " ${YELLOW}◢ 02${NC} ${GRAY}│${NC} ${WHITE}TOOLS${NC} ${GRAY}// sysadmin daemons${NC}" + echo -e " ${YELLOW}◢ UU${NC} ${GRAY}│${NC} ${WHITE}FETCH_UPDATE${NC} ${GRAY}// sync remote${NC}" + echo -e " ${RED}◢ 00${NC} ${GRAY}│${NC} ${WHITE}JACK_OUT${NC} ${GRAY}// exit shell${NC}" echo "" - echo -e -n "${BOLD}Choice: ${NC}" + echo -e -n "${MAGENTA}jack_in${NC}@${CYAN}${hostname}${NC} ${YELLOW}▸${NC}${MAGENTA}_${NC} " read -r choice case $choice in 1) download_and_run "apps/index.sh" ;; 2) download_and_run "tools/index.sh" ;; - u|U) + u|U|uu|UU) if cmd_update && [ -x "${LXS_INSTALL_DIR}/lxs.sh" ]; then echo "" read -r -p "Press Enter to reload with the new version..." exec bash "${LXS_INSTALL_DIR}/lxs.sh" fi ;; - 0) + 0|00) clear show_lxs_logo - echo -e "${GREEN}Bye.${NC}\n" + echo -e "${MAGENTA}JACK_OUT${NC} ${GRAY}// session terminated${NC}\n" exit 0 ;; - *) echo -e "${RED}[✗] Invalid option.${NC}"; sleep 1 ;; + *) echo -e "${RED}[KO] Invalid protocol.${NC}"; sleep 1 ;; esac - if [[ "$choice" != "0" && "$choice" != "1" && "$choice" != "2" ]]; then + if [[ "$choice" != "0" && "$choice" != "00" && "$choice" != "1" && "$choice" != "2" ]]; then echo "" read -r -p "Press Enter to continue..." fi @@ -432,5 +425,5 @@ case "${1:-}" in version|-v|--version) cmd_version ;; help|-h|--help) cmd_help ;; "") main_menu ;; - *) echo -e "${RED}[✗] Unknown command: $1${NC}"; cmd_help; exit 1 ;; + *) echo -e "${RED}[KO] Unknown command: $1${NC}"; cmd_help; exit 1 ;; esac diff --git a/tools/index.sh b/tools/index.sh index 9e05fa4..1e26ba3 100755 --- a/tools/index.sh +++ b/tools/index.sh @@ -35,16 +35,16 @@ run_sibling() { local temp_file exit_code temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh") - echo -e "${PURPLE}[*] Downloading ${BOLD}${script_name}${NC}${PURPLE}...${NC}" + echo -e "${MAGENTA}[··] Fetching ${BOLD}${script_name}${NC}${MAGENTA}...${NC}" if curl -fsSL -H "Cache-Control: no-cache" -o "${temp_file}" "${LXS_RAW_BASE}/${script_path}"; then - echo -e "${GREEN}[✓] Downloaded${NC}" + echo -e "${GREEN}[OK] Payload acquired${NC}" chmod +x "${temp_file}" "${temp_file}" "$@" exit_code=$? rm -f "${temp_file}" return $exit_code else - echo -e "${RED}[✗] Failed to download ${script_path}${NC}" + echo -e "${RED}[KO] Failed to download ${script_path}${NC}" rm -f "${temp_file}" return 1 fi @@ -53,35 +53,33 @@ run_sibling() { menu_tools() { while true; do clear - echo -e "${WHITE}╔═══════════════════════════════════════════════════════╗${NC}" - echo -e "${WHITE}║ TOOLS ║${NC}" - echo -e "${WHITE}╚═══════════════════════════════════════════════════════╝${NC}" + show_title "TOOLS" "SYS_DAEMONS" echo "" - echo -e " ${CYAN}[1]${NC} System Infos" - echo -e " ${PURPLE}[2]${NC} Server Benchmark" - echo -e " ${YELLOW}[3]${NC} Harden Server" - echo -e " ${GREEN}[4]${NC} Change Root Password" - echo -e " ${CYAN}[5]${NC} Update Server" - echo -e " ${YELLOW}[6]${NC} Root SSH Password Login" - echo -e " ${PURPLE}[7]${NC} Welcome Message (MOTD)" - echo -e " ${RED}[0]${NC} Back" + echo -e " ${YELLOW}◢ 01${NC} ${GRAY}│${NC} ${WHITE}System Infos${NC}" + echo -e " ${YELLOW}◢ 02${NC} ${GRAY}│${NC} ${WHITE}Server Benchmark${NC}" + echo -e " ${YELLOW}◢ 03${NC} ${GRAY}│${NC} ${WHITE}Harden Server${NC}" + echo -e " ${YELLOW}◢ 04${NC} ${GRAY}│${NC} ${WHITE}Change Root Password${NC}" + echo -e " ${YELLOW}◢ 05${NC} ${GRAY}│${NC} ${WHITE}Update Server${NC}" + echo -e " ${YELLOW}◢ 06${NC} ${GRAY}│${NC} ${WHITE}Root SSH Password Login${NC}" + echo -e " ${YELLOW}◢ 07${NC} ${GRAY}│${NC} ${WHITE}Welcome Message (MOTD)${NC}" + echo -e " ${RED}◢ 00${NC} ${GRAY}│${NC} ${WHITE}BACK${NC}" echo "" - echo -e -n "${BOLD}Choice [0-7]: ${NC}" + echo -e -n "${YELLOW}▸${NC}${MAGENTA}_${NC} " read -r choice case $choice in - 1) run_sibling "tools/system-infos.sh" ;; - 2) run_sibling "tools/server-benchmark.sh" ;; - 3) run_sibling "tools/harden.sh" ;; - 4) run_sibling "tools/root-password.sh" ;; - 5) run_sibling "tools/update-server.sh" ;; - 6) run_sibling "tools/root-ssh-login.sh" ;; - 7) run_sibling "tools/welcome-message.sh" ;; - 0) return ;; - *) echo -e "${RED}[✗] Invalid option. Please select 0-7.${NC}"; sleep 1; continue ;; + 1|01) run_sibling "tools/system-infos.sh" ;; + 2|02) run_sibling "tools/server-benchmark.sh" ;; + 3|03) run_sibling "tools/harden.sh" ;; + 4|04) run_sibling "tools/root-password.sh" ;; + 5|05) run_sibling "tools/update-server.sh" ;; + 6|06) run_sibling "tools/root-ssh-login.sh" ;; + 7|07) run_sibling "tools/welcome-message.sh" ;; + 0|00) return ;; + *) echo -e "${RED}[KO] Invalid protocol. Select 0-7.${NC}"; sleep 1; continue ;; esac - if [ "$choice" != "0" ]; then + if [ "$choice" != "0" ] && [ "$choice" != "00" ]; then echo "" read -r -p "Press Enter to continue..." fi