Fix captive portal detection and restore MOTD

This commit is contained in:
v3d 2026-06-29 17:29:00 +02:00
parent 3b7a16564b
commit 34b4c4b036
9 changed files with 153 additions and 59 deletions

View file

@ -3,21 +3,11 @@ 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)
pivilion_print_motd
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
Web root: $PIVILION_WEBROOT
Commands:
pivilion show this status
@ -28,4 +18,5 @@ Commands:
static convert the current gallery to static files
hotglue install or restore Hotglue
htaccess reset or remove captive redirect rules
pivilion-diagnose check captive DNS, HTTP redirects, and services
EOF

View file

@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail
[ "$(id -u)" -eq 0 ] || exec sudo "$0" "$@"
exec /usr/local/lib/pivilion/mode.sh diagnose