add the offscale line, and fix a set -e bug the test exposed

The menu is one function now rather than being written out twice — it is shown
again after ? prints the long answer — and option 1 carries your line: offscale is
just tailscale and headscale, with our own sugar on top.

The bug it surfaced is the more useful half. load_answers used

    [[ -z "${MACHINE_ROLE:-}" ]] && MACHINE_ROLE="$value"

as the last statement in a while-read loop body. When the variable is already set
the test is false, the compound returns non-zero, and as the final statement in a
loop body under `set -e` that ends the script. The failure is silent about its
cause: the trap prints "Step: unknown" and a line number inside the library,
before pre-flight has run.

It needed both conditions to appear — an answers file on disk AND the variables
already set in the environment — which is why every earlier test missed it and
running with env overrides hit it immediately. Written as if/then now, and the
other lib files scanned for the same shape.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-12 19:45:19 +00:00
co-authored by Claude Opus 5
parent 6a29c39b74
commit 4d478cc0f1
3 changed files with 26 additions and 17 deletions
+2 -14
View File
@@ -441,13 +441,7 @@ if ! skip; then
SUMMARY+=("Tailscale: connected, unchanged ($(tailscale_ip))")
else
echo ""
info "Which network should this machine join?"
echo ""
echo " [1] set up your own network (offscale)"
echo " [2] use a network you already run (headscale, offscale)"
echo " [3] the easy route (tailscale.com)"
echo " [?] what are tailscale, headscale and offscale?"
echo ""
tailscale_network_menu
TS_LOGIN_SERVER=""
TS_PLANE=""
@@ -478,13 +472,7 @@ if ! skip; then
echo ""
tailscale_networks_help
echo ""
info "Which network should this machine join?"
echo ""
echo " [1] set up your own network (offscale)"
echo " [2] use a network you already run (headscale, offscale)"
echo " [3] the easy route (tailscale.com)"
echo " [?] what are tailscale, headscale and offscale?"
echo ""
tailscale_network_menu
;;
*) warn "Pick 1, 2, 3 or ?." ;;
esac