#!/bin/bash
set -euo pipefail
source /usr/local/lib/pivilion/common.sh
pivilion_load_config

mode=$(pivilion_current_mode)
torname="not generated yet"
[ ! -s "$PIVILION_DIR/torname" ] || torname=$(tr -d '\r\n' < "$PIVILION_DIR/torname")
uptime_text=$(uptime -p 2>/dev/null || true)

cat <<EOF

Welcome to Pivilion!

Host...............: $(uname -n)
System.............: $(uname -srmo)
Uptime.............: ${uptime_text:-unknown}
Mode after reboot..: $mode
Onion address......: $torname
Web root...........: $PIVILION_WEBROOT

Commands:
  pivilion   show this status
  onion      select Tor onion mode for the next reboot
  hotspot    select open captive-hotspot mode for the next reboot
  pikey      save upstream Wi-Fi credentials for onion mode
  generator  enable or disable the gallery generator on port 81
  static     convert the current gallery to static files
  hotglue    install or restore Hotglue
  htaccess   reset or remove captive redirect rules
EOF
