style(ui): apply cyberpunk neon theme across all menus

- 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
This commit is contained in:
2026-05-12 22:01:57 -04:00
parent e0bd8e0a97
commit ade8e76a68
4 changed files with 134 additions and 129 deletions
+54 -61
View File
@@ -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