diff --git a/deploy/bootstrap.sh b/deploy/bootstrap.sh index b2dbf99..eff72f3 100644 --- a/deploy/bootstrap.sh +++ b/deploy/bootstrap.sh @@ -2240,8 +2240,9 @@ prompt_install_mode() { # No override: ask on the controlling terminal. Under `curl | sudo bash` stdin # is the script, so we must read /dev/tty, not stdin. No tty (CI/cloud-init) → - # take the default. - if [ ! -r /dev/tty ]; then + # take the default. Open it to find out: /dev/tty is mode 0666 on every Linux host, so + # `-r` passes even when there is no controlling terminal and only the open fails. + if ! (: /dev/null; then INSTALL_MODE="$def" log "no terminal for a prompt; defaulting to a ${def} install (set FELIS_INSTALL_MODE=full or nano to override)" return 0 diff --git a/deploy/bootstrap_test.sh b/deploy/bootstrap_test.sh index 0b462f3..d5af411 100644 --- a/deploy/bootstrap_test.sh +++ b/deploy/bootstrap_test.sh @@ -363,8 +363,9 @@ else "$(run_mode "$sdir/felis-nano.service" "$sdir/absent.done")" expect "a host with the full install re-runs as full" "MODE: full" \ "$(run_mode "$sdir/felis-nano.service" "$sdir/bootstrap.done")" - expect "a fresh host defaults to full" "MODE: full" \ - "$(run_mode "$sdir/absent.service" "$sdir/absent.done")" + out="$(run_mode "$sdir/absent.service" "$sdir/absent.done")" + expect "a fresh host defaults to full" "MODE: full" "$out" + expect "no controlling terminal takes the no-prompt path" "LOG: no terminal for a prompt" "$out" # felis setup goes on to need the control plane, so under it nano is refused, and the # nano-only default above must not apply either. expect "felis setup refuses FELIS_INSTALL_MODE=nano" "DIE: felis setup installs the full control plane" \