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
+19 -21
View File
@@ -34,16 +34,16 @@ run_sibling() {
local temp_file exit_code local temp_file exit_code
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh") 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 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}" chmod +x "${temp_file}"
"${temp_file}" "$@" "${temp_file}" "$@"
exit_code=$? exit_code=$?
rm -f "${temp_file}" rm -f "${temp_file}"
return $exit_code return $exit_code
else else
echo -e "${RED}[] Failed to download ${script_path}${NC}" echo -e "${RED}[KO] Failed to download ${script_path}${NC}"
rm -f "${temp_file}" rm -f "${temp_file}"
return 1 return 1
fi fi
@@ -52,31 +52,29 @@ run_sibling() {
menu_apps() { menu_apps() {
while true; do while true; do
clear clear
echo -e "${WHITE}╔═══════════════════════════════════════════════════════╗${NC}" show_title "APPLICATIONS" "APP_REPOSITORY"
echo -e "${WHITE}║ APPLICATIONS ║${NC}"
echo -e "${WHITE}╚═══════════════════════════════════════════════════════╝${NC}"
echo "" echo ""
echo -e " ${GREEN}[1]${NC} Coolify" echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}Coolify${NC}"
echo -e " ${GREEN}[2]${NC} Pterodactyl Panel" echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}Pterodactyl Panel${NC}"
echo -e " ${GREEN}[3]${NC} Uptime Kuma" echo -e " ${YELLOW}◢ 03${NC} ${GRAY}${NC} ${WHITE}Uptime Kuma${NC}"
echo -e " ${GREEN}[4]${NC} CloudPanel" echo -e " ${YELLOW}◢ 04${NC} ${GRAY}${NC} ${WHITE}CloudPanel${NC}"
echo -e " ${GREEN}[5]${NC} Proxmox VE Tools" echo -e " ${YELLOW}◢ 05${NC} ${GRAY}${NC} ${WHITE}Proxmox VE Tools${NC}"
echo -e " ${RED}[0]${NC} Back" echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}BACK${NC}"
echo "" echo ""
echo -e -n "${BOLD}Choice [0-5]: ${NC}" echo -e -n "${YELLOW}${NC}${MAGENTA}_${NC} "
read -r choice read -r choice
case $choice in case $choice in
1) run_sibling "apps/coolify.sh" ;; 1|01) run_sibling "apps/coolify.sh" ;;
2) run_sibling "apps/pterodactyl.sh" ;; 2|02) run_sibling "apps/pterodactyl.sh" ;;
3) run_sibling "apps/uptime-kuma.sh" ;; 3|03) run_sibling "apps/uptime-kuma.sh" ;;
4) run_sibling "apps/cloudpanel.sh" ;; 4|04) run_sibling "apps/cloudpanel.sh" ;;
5) run_sibling "apps/proxmox.sh" ;; 5|05) run_sibling "apps/proxmox.sh" ;;
0) return ;; 0|00) return ;;
*) echo -e "${RED}[] Invalid option. Please select 0-5.${NC}"; sleep 1; continue ;; *) echo -e "${RED}[KO] Invalid protocol. Select 0-5.${NC}"; sleep 1; continue ;;
esac esac
if [ "$choice" != "0" ]; then if [ "$choice" != "0" ] && [ "$choice" != "00" ]; then
echo "" echo ""
read -r -p "Press Enter to continue..." read -r -p "Press Enter to continue..."
fi fi
+38 -22
View File
@@ -7,31 +7,47 @@
# Repo: https://git.hyko.cx/hykocx/lxs # Repo: https://git.hyko.cx/hykocx/lxs
# ═══════════════════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════════════════
# Colors # Colors — Cyberpunk 2077 neon palette
# ═══════════════════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════════════════
RED='\033[0;31m' RED='\033[1;91m' # ICE alert
GREEN='\033[0;32m' GREEN='\033[1;92m' # phosphor green
YELLOW='\033[1;33m' YELLOW='\033[1;93m' # signature electric yellow
PURPLE='\033[1;94m' MAGENTA='\033[1;95m' # hot pink neon
CYAN='\033[0;36m' CYAN='\033[1;96m' # neon cyan
WHITE='\033[1;37m' WHITE='\033[1;97m' # bold white
GRAY='\033[0;37m' GRAY='\033[0;90m' # dark gray
PURPLE='\033[1;95m' # alias on MAGENTA for legacy sub-scripts
NC='\033[0m' NC='\033[0m'
BOLD='\033[1m' BOLD='\033[1m'
DIM='\033[2m'
BLINK='\033[5m'
REV='\033[7m'
# ═══════════════════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════════════════
# UI helpers # UI helpers
# ═══════════════════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════════════════
show_separator() { 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} $*"; } show_title() {
ok() { echo -e "${GREEN}[✓]${NC} $*"; } local title="$1"
warn() { echo -e "${YELLOW}[!]${NC} $*"; } local subtitle="${2:-SYS_MODULE}"
err() { echo -e "${RED}[✗]${NC} $*" >&2; } 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 # Spinner — runs a shell command, redirects output to a log file, shows
@@ -51,13 +67,13 @@ run_spinner() {
local spinstr='|/-\' local spinstr='|/-\'
local log="${LXS_LOG_FILE:-/tmp/lxs.log}" local log="${LXS_LOG_FILE:-/tmp/lxs.log}"
echo -e "${PURPLE}[*] ${message}${NC}" echo -e "${MAGENTA}[··] ${message}${NC}"
eval "$command" > "$log" 2>&1 & eval "$command" > "$log" 2>&1 &
local pid=$! local pid=$!
while kill -0 "$pid" 2>/dev/null; do while kill -0 "$pid" 2>/dev/null; do
local temp=${spinstr#?} local temp=${spinstr#?}
printf "\r${PURPLE}[%c]${NC} ${message}" "$spinstr" printf "\r${MAGENTA}[%c·]${NC} ${message}" "$spinstr"
spinstr=$temp${spinstr%"$temp"} spinstr=$temp${spinstr%"$temp"}
sleep 0.15 sleep 0.15
done done
@@ -65,9 +81,9 @@ run_spinner() {
wait "$pid" wait "$pid"
local exit_code=$? local exit_code=$?
if [ $exit_code -eq 0 ]; then if [ $exit_code -eq 0 ]; then
printf "\r${GREEN}[]${NC} ${message}\n" printf "\r${GREEN}[OK]${NC} ${message}\n"
else else
printf "\r${RED}[]${NC} ${message}\n" printf "\r${RED}[KO]${NC} ${message}\n"
fi fi
return $exit_code return $exit_code
} }
@@ -138,7 +154,7 @@ ufw_allow() {
else else
ufw allow "$rule" >/dev/null ufw allow "$rule" >/dev/null
fi 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. # 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 fuser /var/lib/apt/lists/lock >/dev/null 2>&1; do
[ "$lock_detected" = false ] && lock_detected=true && \ [ "$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=$((wait_count + 1))
[ $wait_count -ge $max_wait ] && \ [ $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 sleep 1
done done
[ "$lock_detected" = true ] && \ [ "$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 return 0
} }
+54 -61
View File
@@ -120,18 +120,15 @@ check_remote_version() {
} }
show_lxs_logo() { show_lxs_logo() {
echo -e "${WHITE}${BOLD}" local cols head tail_len
echo -e "╔═══════════════════════════════════════════════════════╗" cols=$(tput cols 2>/dev/null || echo 64)
echo -e "║ ║" head=" L X S // v${LXS_VERSION} "
echo -e "║ ██╗ ██╗ ██╗███████╗ ║" tail_len=$(( cols - ${#head} - 12 ))
echo -e "║ ██║ ╚██╗██╔╝██╔════╝ ║" [ "$tail_len" -lt 4 ] && tail_len=4
echo -e "║ ██║ ╚███╔╝ ███████╗ ║" local bar
echo -e "║ ██║ ██╔██╗ ╚════██║ ║" bar=$(printf '▀%.0s' $(seq 1 "$tail_len"))
echo -e "║ ███████╗██╔╝ ██╗███████║ ║" echo ""
echo -e "║ ╚══════╝╚═╝ ╚═╝╚══════╝ v${LXS_VERSION}" echo -e "${YELLOW}▀▀▀${WHITE}${BOLD}${head}${NC}${YELLOW}${bar}${NC} ${GREEN}[ONLINE]${NC}"
echo -e "║ ║"
echo -e "╚═══════════════════════════════════════════════════════╝"
echo -e "${NC}"
} }
show_header() { show_header() {
@@ -139,37 +136,31 @@ show_header() {
show_lxs_logo show_lxs_logo
if [ "${LXS_UPDATE_AVAILABLE:-0}" = "1" ]; then if [ "${LXS_UPDATE_AVAILABLE:-0}" = "1" ]; then
echo -e "${YELLOW}[!] Nouvelle version disponible: ${LXS_REMOTE_VERSION} (actuelle: ${LXS_VERSION})${NC}" echo -e "${YELLOW}▲ UPDATE_AVAILABLE :: v${LXS_REMOTE_VERSION}${NC} ${GRAY}// run \`lxs update\`${NC}"
echo -e "${GRAY} Lance: lxs update${NC}"
echo ""
fi 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}") 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) os_version=$(lsb_release -ds 2>/dev/null || grep PRETTY_NAME /etc/os-release 2>/dev/null | cut -d'"' -f2)
kernel=$(uname -r) 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) ip_address=$(get_public_ip)
cpu_model=$(grep "model name" /proc/cpuinfo | head -1 | cut -d':' -f2 | xargs)
cpu_cores=$(nproc) cpu_cores=$(nproc)
total_mem=$(free -h | awk '/^Mem:/ {print $2}') total_mem=$(free -h | awk '/^Mem:/ {print $2}')
used_mem=$(free -h | awk '/^Mem:/ {print $3}') used_mem=$(free -h | awk '/^Mem:/ {print $3}')
disk_usage=$(df -h / | awk 'NR==2 {print $3 "/" $2 " (" $5 ")"}') disk_usage=$(df -h / | awk 'NR==2 {print $3 "/" $2 " (" $5 ")"}')
echo -e "${GRAY}Hostname:${NC} $hostname" echo ""
echo -e "${GRAY}IP Address:${NC} $ip_address" printf " ${CYAN}NODE${NC} %-22s ${CYAN}KERN${NC} %s\n" "$hostname" "$kernel"
echo -e "${GRAY}OS:${NC} $os_version" printf " ${CYAN}ADDR${NC} %-22s ${CYAN}UP${NC} %s\n" "$ip_address" "$uptime_info"
echo -e "${GRAY}Kernel:${NC} $kernel" printf " ${CYAN}OS${NC} %-22s ${CYAN}CPU${NC} %s cores\n" "$os_version" "$cpu_cores"
echo -e "${GRAY}Uptime:${NC} $uptime_info" printf " ${CYAN}DISK${NC} %-22s ${CYAN}MEM${NC} %s / %s\n" "$disk_usage" "$used_mem" "$total_mem"
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 "" echo ""
} }
check_os() { check_os() {
if ! grep -qiE 'debian|ubuntu' /etc/os-release 2>/dev/null; then 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 read -r -p "Continue anyway? [y/N] " reply
case "$reply" in case "$reply" in
[yY]|[yY][eE][sS]) ;; [yY]|[yY][eE][sS]) ;;
@@ -195,9 +186,9 @@ download_and_run() {
echo "" echo ""
show_separator show_separator
if [ $exit_code -eq 0 ]; then if [ $exit_code -eq 0 ]; then
echo -e "${GREEN}[] Script completed successfully${NC}" echo -e "${GREEN}[OK] Script completed successfully${NC}"
else else
echo -e "${YELLOW}[!] Script exited with code: $exit_code${NC}" echo -e "${YELLOW}[!!] Script exited with code: $exit_code${NC}"
fi fi
return $exit_code return $exit_code
fi fi
@@ -206,12 +197,12 @@ download_and_run() {
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh") temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh")
echo "" 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" \ if curl -fsSL -H "Cache-Control: no-cache" \
-o "${temp_file}" \ -o "${temp_file}" \
"${LXS_RAW_BASE}/${script_path}"; then "${LXS_RAW_BASE}/${script_path}"; then
echo -e "${GREEN}[✓] Downloaded${NC}" echo -e "${GREEN}[OK] Payload acquired${NC}"
chmod +x "${temp_file}" chmod +x "${temp_file}"
echo "" echo ""
@@ -226,14 +217,14 @@ download_and_run() {
echo "" echo ""
show_separator show_separator
if [ $exit_code -eq 0 ]; then if [ $exit_code -eq 0 ]; then
echo -e "${GREEN}[] Script completed successfully${NC}" echo -e "${GREEN}[OK] Script completed successfully${NC}"
else else
echo -e "${YELLOW}[!] Script exited with code: $exit_code${NC}" echo -e "${YELLOW}[!!] Script exited with code: $exit_code${NC}"
fi fi
return $exit_code return $exit_code
else else
echo -e "${RED}[] Failed to download ${script_path}${NC}" echo -e "${RED}[KO] Failed to download ${script_path}${NC}"
echo -e "${RED} URL: ${LXS_RAW_BASE}/${script_path}${NC}" echo -e "${RED} URL: ${LXS_RAW_BASE}/${script_path}${NC}"
rm -f "${temp_file}" rm -f "${temp_file}"
return 1 return 1
fi fi
@@ -275,8 +266,8 @@ cmd_install() {
uptime-kuma) download_and_run "apps/uptime-kuma.sh" ;; uptime-kuma) download_and_run "apps/uptime-kuma.sh" ;;
cloudpanel) download_and_run "apps/cloudpanel.sh" ;; cloudpanel) download_and_run "apps/cloudpanel.sh" ;;
proxmox) download_and_run "apps/proxmox.sh" ;; proxmox) download_and_run "apps/proxmox.sh" ;;
"") echo -e "${RED}[] Missing app name. Try: lxs help${NC}"; return 1 ;; "") echo -e "${RED}[KO] 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] Unknown app: $app. Try: lxs help${NC}"; return 1 ;;
esac esac
} }
@@ -291,8 +282,8 @@ cmd_tool() {
update) download_and_run "tools/update-server.sh" "$@" ;; update) download_and_run "tools/update-server.sh" "$@" ;;
root-ssh-login) download_and_run "tools/root-ssh-login.sh" "$@" ;; root-ssh-login) download_and_run "tools/root-ssh-login.sh" "$@" ;;
welcome|motd) download_and_run "tools/welcome-message.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}[KO] 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] Unknown tool: $tool. Try: lxs help${NC}"; return 1 ;;
esac esac
} }
@@ -300,7 +291,7 @@ lxs_sync_install() {
local action="${1:-update}" local action="${1:-update}"
if lxs_need_root_for "$LXS_INSTALL_DIR" || lxs_need_root_for "$LXS_BIN_PATH"; then 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" \ 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" \ LXS_BRANCH="$LXS_BRANCH" LXS_REPO_URL="$LXS_REPO_URL" \
bash "$(lxs_self_path)" "$action" bash "$(lxs_self_path)" "$action"
@@ -308,25 +299,25 @@ lxs_sync_install() {
local work local work
work=$(mktemp -d /tmp/lxs.install.XXXXXX) || { 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 return 1
} }
trap 'rm -rf "$work"' RETURN 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 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 return 1
fi fi
mkdir -p "${work}/extracted" mkdir -p "${work}/extracted"
if ! tar -xzf "${work}/lxs.tgz" --strip-components=1 -C "${work}/extracted"; then 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 return 1
fi fi
if [ ! -f "${work}/extracted/lxs.sh" ] || [ ! -f "${work}/extracted/VERSION" ]; then 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 return 1
fi fi
@@ -334,7 +325,7 @@ lxs_sync_install() {
if command -v rsync >/dev/null 2>&1; then if command -v rsync >/dev/null 2>&1; then
rsync -a --delete "${work}/extracted/" "${LXS_INSTALL_DIR}/" || { rsync -a --delete "${work}/extracted/" "${LXS_INSTALL_DIR}/" || {
echo -e "${RED}[] rsync failed${NC}" echo -e "${RED}[KO] rsync failed${NC}"
return 1 return 1
} }
else else
@@ -342,7 +333,7 @@ lxs_sync_install() {
[ -d "$LXS_INSTALL_DIR" ] && mv "$LXS_INSTALL_DIR" "${LXS_INSTALL_DIR}.old" [ -d "$LXS_INSTALL_DIR" ] && mv "$LXS_INSTALL_DIR" "${LXS_INSTALL_DIR}.old"
mkdir -p "$LXS_INSTALL_DIR" mkdir -p "$LXS_INSTALL_DIR"
if ! cp -a "${work}/extracted/." "${LXS_INSTALL_DIR}/"; then 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" rm -rf "$LXS_INSTALL_DIR"
[ -d "${LXS_INSTALL_DIR}.old" ] && mv "${LXS_INSTALL_DIR}.old" "$LXS_INSTALL_DIR" [ -d "${LXS_INSTALL_DIR}.old" ] && mv "${LXS_INSTALL_DIR}.old" "$LXS_INSTALL_DIR"
return 1 return 1
@@ -362,8 +353,8 @@ lxs_sync_install() {
local new_version local new_version
new_version=$(head -n1 "${LXS_INSTALL_DIR}/VERSION" 2>/dev/null | tr -d '[:space:]') 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}[OK] 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] Symlink: ${LXS_BIN_PATH}${LXS_INSTALL_DIR}/lxs.sh${NC}"
} }
cmd_update() { cmd_update() {
@@ -381,38 +372,40 @@ cmd_install_self() {
main_menu() { main_menu() {
check_os check_os
check_remote_version check_remote_version
local hostname
hostname=$(hostname 2>/dev/null || echo "${HOSTNAME:-node}")
while true; do while true; do
show_header show_header
echo -e "${WHITE}${BOLD}MAIN MENU${NC}" echo -e "${MAGENTA}>> SELECT_PROTOCOL <<${NC}"
echo "" echo ""
echo -e " ${GREEN}[1]${NC} Applications" echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}APPLICATIONS${NC} ${GRAY}// deploy stacks${NC}"
echo -e " ${CYAN}[2]${NC} Tools" echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}TOOLS${NC} ${GRAY}// sysadmin daemons${NC}"
echo -e " ${GRAY}[u]${NC} Update lxs" echo -e " ${YELLOW}◢ UU${NC} ${GRAY}${NC} ${WHITE}FETCH_UPDATE${NC} ${GRAY}// sync remote${NC}"
echo -e " ${RED}[0]${NC} Exit" echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}JACK_OUT${NC} ${GRAY}// exit shell${NC}"
echo "" echo ""
echo -e -n "${BOLD}Choice: ${NC}" echo -e -n "${MAGENTA}jack_in${NC}@${CYAN}${hostname}${NC} ${YELLOW}${NC}${MAGENTA}_${NC} "
read -r choice read -r choice
case $choice in case $choice in
1) download_and_run "apps/index.sh" ;; 1) download_and_run "apps/index.sh" ;;
2) download_and_run "tools/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 if cmd_update && [ -x "${LXS_INSTALL_DIR}/lxs.sh" ]; then
echo "" echo ""
read -r -p "Press Enter to reload with the new version..." read -r -p "Press Enter to reload with the new version..."
exec bash "${LXS_INSTALL_DIR}/lxs.sh" exec bash "${LXS_INSTALL_DIR}/lxs.sh"
fi fi
;; ;;
0) 0|00)
clear clear
show_lxs_logo show_lxs_logo
echo -e "${GREEN}Bye.${NC}\n" echo -e "${MAGENTA}JACK_OUT${NC} ${GRAY}// session terminated${NC}\n"
exit 0 exit 0
;; ;;
*) echo -e "${RED}[] Invalid option.${NC}"; sleep 1 ;; *) echo -e "${RED}[KO] Invalid protocol.${NC}"; sleep 1 ;;
esac esac
if [[ "$choice" != "0" && "$choice" != "1" && "$choice" != "2" ]]; then if [[ "$choice" != "0" && "$choice" != "00" && "$choice" != "1" && "$choice" != "2" ]]; then
echo "" echo ""
read -r -p "Press Enter to continue..." read -r -p "Press Enter to continue..."
fi fi
@@ -432,5 +425,5 @@ case "${1:-}" in
version|-v|--version) cmd_version ;; version|-v|--version) cmd_version ;;
help|-h|--help) cmd_help ;; help|-h|--help) cmd_help ;;
"") main_menu ;; "") 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 esac
+23 -25
View File
@@ -35,16 +35,16 @@ run_sibling() {
local temp_file exit_code local temp_file exit_code
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh") 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 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}" chmod +x "${temp_file}"
"${temp_file}" "$@" "${temp_file}" "$@"
exit_code=$? exit_code=$?
rm -f "${temp_file}" rm -f "${temp_file}"
return $exit_code return $exit_code
else else
echo -e "${RED}[] Failed to download ${script_path}${NC}" echo -e "${RED}[KO] Failed to download ${script_path}${NC}"
rm -f "${temp_file}" rm -f "${temp_file}"
return 1 return 1
fi fi
@@ -53,35 +53,33 @@ run_sibling() {
menu_tools() { menu_tools() {
while true; do while true; do
clear clear
echo -e "${WHITE}╔═══════════════════════════════════════════════════════╗${NC}" show_title "TOOLS" "SYS_DAEMONS"
echo -e "${WHITE}║ TOOLS ║${NC}"
echo -e "${WHITE}╚═══════════════════════════════════════════════════════╝${NC}"
echo "" echo ""
echo -e " ${CYAN}[1]${NC} System Infos" echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}System Infos${NC}"
echo -e " ${PURPLE}[2]${NC} Server Benchmark" echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}Server Benchmark${NC}"
echo -e " ${YELLOW}[3]${NC} Harden Server" echo -e " ${YELLOW}◢ 03${NC} ${GRAY}${NC} ${WHITE}Harden Server${NC}"
echo -e " ${GREEN}[4]${NC} Change Root Password" echo -e " ${YELLOW}◢ 04${NC} ${GRAY}${NC} ${WHITE}Change Root Password${NC}"
echo -e " ${CYAN}[5]${NC} Update Server" echo -e " ${YELLOW}◢ 05${NC} ${GRAY}${NC} ${WHITE}Update Server${NC}"
echo -e " ${YELLOW}[6]${NC} Root SSH Password Login" echo -e " ${YELLOW}◢ 06${NC} ${GRAY}${NC} ${WHITE}Root SSH Password Login${NC}"
echo -e " ${PURPLE}[7]${NC} Welcome Message (MOTD)" echo -e " ${YELLOW}◢ 07${NC} ${GRAY}${NC} ${WHITE}Welcome Message (MOTD)${NC}"
echo -e " ${RED}[0]${NC} Back" echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}BACK${NC}"
echo "" echo ""
echo -e -n "${BOLD}Choice [0-7]: ${NC}" echo -e -n "${YELLOW}${NC}${MAGENTA}_${NC} "
read -r choice read -r choice
case $choice in case $choice in
1) run_sibling "tools/system-infos.sh" ;; 1|01) run_sibling "tools/system-infos.sh" ;;
2) run_sibling "tools/server-benchmark.sh" ;; 2|02) run_sibling "tools/server-benchmark.sh" ;;
3) run_sibling "tools/harden.sh" ;; 3|03) run_sibling "tools/harden.sh" ;;
4) run_sibling "tools/root-password.sh" ;; 4|04) run_sibling "tools/root-password.sh" ;;
5) run_sibling "tools/update-server.sh" ;; 5|05) run_sibling "tools/update-server.sh" ;;
6) run_sibling "tools/root-ssh-login.sh" ;; 6|06) run_sibling "tools/root-ssh-login.sh" ;;
7) run_sibling "tools/welcome-message.sh" ;; 7|07) run_sibling "tools/welcome-message.sh" ;;
0) return ;; 0|00) return ;;
*) echo -e "${RED}[] Invalid option. Please select 0-7.${NC}"; sleep 1; continue ;; *) echo -e "${RED}[KO] Invalid protocol. Select 0-7.${NC}"; sleep 1; continue ;;
esac esac
if [ "$choice" != "0" ]; then if [ "$choice" != "0" ] && [ "$choice" != "00" ]; then
echo "" echo ""
read -r -p "Press Enter to continue..." read -r -p "Press Enter to continue..."
fi fi