feat(installer): 10s reboot countdown with per-tick redraw

v0.5 used `sleep 5` after a static "System will reboot in 5 seconds."
box, which left the operator guessing how much time was left to grab
the USB stick. The new loop runs 10 → 1, clearing + redrawing the
gum-style success box each tick with the remaining-seconds figure,
giving the operator a visible window to act.

10 seconds (vs 5) because real hardware operators were missing the
window — laptops with the USB on the far side of the dock take
4-5 seconds to physically reach. 10 is comfortable, not annoying.
This commit is contained in:
veilor-org 2026-05-06 10:32:11 +01:00
parent 44f0c787a7
commit 816fc0ee68

View file

@ -1037,12 +1037,23 @@ run_install() {
--show-output \
-- bash -c 'anaconda --cmdline --kickstart=/run/install/veilor-generated.ks 2>&1 | tee /tmp/anaconda-cmdline.log' || rc=$?
if [[ $rc -eq 0 ]]; then
gum style --foreground 2 --border rounded --margin "1 2" --padding "1 3" \
"✓ Install complete" \
"" \
"System will reboot in 5 seconds." \
"Remove the install media."
sleep 5
# v0.6: 10-second redraw countdown so the operator knows
# exactly when the reboot will fire (and has time to grab
# the USB stick before it boots back into the live ISO).
# Each tick clears + redraws the styled box with the new
# remaining-seconds figure — no fancy in-place repaint, just
# a clean re-render via clear+gum-style which the linux
# fbcon handles without flicker.
local secs
for secs in 10 9 8 7 6 5 4 3 2 1; do
clear
gum style --foreground 2 --border rounded --margin "1 2" --padding "1 3" \
"✓ Install complete" \
"" \
"Rebooting in ${secs}s..." \
"Remove the install media."
sleep 1
done
systemctl reboot
else
prompt_error "Anaconda exited non-zero (status $rc).