secubox-deb/image/sbin/secubox-mode
CyberMind-FR a2fd0e0cd6 feat(boot): CRT-style banners with colors and emoji indicators
Boot Banner Improvements:
- /etc/issue: Gold ASCII art pre-login banner with credentials
- /etc/motd: Colorful LIVE USB banner with access info
- secubox-status: New command showing system overview with CRT colors
- secubox-help: Quick reference for all secubox commands
- secubox-logs: Live security log viewer shortcut
- profile.d: Login status display with mode/service/IP indicators

Mode Switching:
- cmdline-handler: Fixed TUI mode to start (not just enable) service
- secubox-mode: Updated with CRT colors and emoji status indicators

GRUB Menu:
- Kiosk GUI is now default when --kiosk flag used
- All entries have emoji indicators (🖼️📟🌉🛡️💾🚀🔧🚨🐛)
- CRT-style menu colors (cyan on black, yellow highlights)

CI Workflows:
- build-live-usb.yml: Updated boot options and credentials in release notes
- release.yml: Updated to 93 packages, new boot options, correct credentials

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-04 12:16:40 +02:00

183 lines
5.8 KiB
Bash
Executable File

#!/bin/bash
# ══════════════════════════════════════════════════════════════════
# SecuBox Mode Switcher — Switch between Kiosk (GUI) and TUI modes
# CRT-style output with emoji status indicators
# ══════════════════════════════════════════════════════════════════
set -u
# CRT-style colors
GOLD='\033[38;5;214m'
CYAN='\033[38;5;45m'
GREEN='\033[38;5;82m'
RED='\033[38;5;196m'
GRAY='\033[38;5;242m'
WHITE='\033[38;5;250m'
NC='\033[0m'
log() { echo -e "${CYAN}${NC} $*"; }
ok() { echo -e "${GREEN}${NC} $*"; }
err() { echo -e "${RED}${NC} $*" >&2; }
warn() { echo -e "${GOLD}${NC} $*"; }
usage() {
cat <<EOF
SecuBox Mode Switcher
Usage: secubox-mode <command>
Commands:
kiosk Switch to Kiosk mode (GUI with Chromium)
tui Switch to TUI mode (Console dashboard)
console Drop to console (disable both modes)
status Show current mode
The mode switch takes effect on next boot, or immediately with --now flag.
Examples:
secubox-mode kiosk # Enable kiosk mode
secubox-mode tui --now # Switch to TUI immediately
secubox-mode console # Disable both, drop to login shell
EOF
exit 1
}
current_mode() {
if [[ -f /var/lib/secubox/.kiosk-enabled ]]; then
echo "kiosk"
elif [[ -f /var/lib/secubox/.tui-enabled ]]; then
echo "tui"
else
echo "console"
fi
}
switch_to_kiosk() {
local now="${1:-}"
log "Switching to Kiosk mode..."
mkdir -p /var/lib/secubox
touch /var/lib/secubox/.kiosk-enabled
rm -f /var/lib/secubox/.tui-enabled
systemctl enable secubox-kiosk.service 2>/dev/null || true
systemctl disable secubox-console-tui.service 2>/dev/null || true
ok "Kiosk mode enabled"
if [[ "$now" == "--now" ]]; then
log "Restarting display services..."
systemctl stop secubox-console-tui.service 2>/dev/null || true
systemctl restart secubox-kiosk.service
else
log "Reboot to apply changes: sudo reboot"
fi
}
switch_to_tui() {
local now="${1:-}"
log "Switching to TUI mode..."
mkdir -p /var/lib/secubox
touch /var/lib/secubox/.tui-enabled
rm -f /var/lib/secubox/.kiosk-enabled
systemctl disable secubox-kiosk.service 2>/dev/null || true
systemctl enable secubox-console-tui.service 2>/dev/null || true
ok "TUI mode enabled"
if [[ "$now" == "--now" ]]; then
log "Stopping kiosk, starting TUI..."
systemctl stop secubox-kiosk.service 2>/dev/null || true
# Kill X11 if running
pkill -9 Xorg 2>/dev/null || true
pkill -9 chromium 2>/dev/null || true
sleep 1
# Start TUI on tty1
systemctl start secubox-console-tui.service
else
log "Reboot to apply changes: sudo reboot"
fi
}
switch_to_console() {
log "Switching to Console mode (no GUI/TUI)..."
rm -f /var/lib/secubox/.kiosk-enabled
rm -f /var/lib/secubox/.tui-enabled
systemctl disable secubox-kiosk.service 2>/dev/null || true
systemctl disable secubox-console-tui.service 2>/dev/null || true
systemctl stop secubox-kiosk.service 2>/dev/null || true
systemctl stop secubox-console-tui.service 2>/dev/null || true
# Kill X11 if running
pkill -9 Xorg 2>/dev/null || true
pkill -9 chromium 2>/dev/null || true
ok "Console mode enabled - you'll get a login prompt"
}
show_status() {
local mode=$(current_mode)
echo
echo -e "${GOLD}╭─────────────────────────────────────────────────────────╮${NC}"
echo -e "${GOLD}${NC} ${WHITE}⚡ SecuBox Display Mode${NC} ${GOLD}${NC}"
echo -e "${GOLD}╰─────────────────────────────────────────────────────────╯${NC}"
echo
case "$mode" in
kiosk)
echo -e " ${GREEN}${NC} Current: ${CYAN}Kiosk GUI${NC} 🖼️"
echo
echo -e " ${GRAY}Chromium browser in fullscreen on tty7${NC}"
echo -e " ${GRAY}Press ${WHITE}Ctrl+Alt+F2${GRAY} to access console${NC}"
echo -e " ${GRAY}Use ${WHITE}secubox-mode tui${GRAY} to switch to TUI${NC}"
;;
tui)
echo -e " ${GREEN}${NC} Current: ${CYAN}Console TUI${NC} 📟"
echo
echo -e " ${GRAY}Text-based dashboard on tty1${NC}"
echo -e " ${GRAY}Press ${WHITE}q${GRAY} to exit TUI${NC}"
echo -e " ${GRAY}Use ${WHITE}secubox-mode kiosk${GRAY} for GUI mode${NC}"
;;
console)
echo -e " ${GREEN}${NC} Current: ${CYAN}Console Shell${NC} 🖥️"
echo
echo -e " ${GRAY}Standard login shell${NC}"
echo -e " ${GRAY}Use ${WHITE}secubox-mode kiosk${GRAY} or ${WHITE}tui${GRAY} to switch${NC}"
;;
esac
echo
echo -e " ${GRAY}────────────────────────────────────────────────────${NC}"
echo -e " ${WHITE}Modes:${NC}"
echo -e " ${CYAN}kiosk${NC} 🖼️ Full-screen browser GUI"
echo -e " ${CYAN}tui${NC} 📟 Console text dashboard"
echo -e " ${CYAN}console${NC} 🖥️ Standard shell login"
echo
}
# Main
case "${1:-}" in
kiosk)
switch_to_kiosk "${2:-}"
;;
tui)
switch_to_tui "${2:-}"
;;
console)
switch_to_console
;;
status)
show_status
;;
*)
usage
;;
esac