From 1f1e9f6f9c8ea046a8c9a04ef1d81cd3a6d85766 Mon Sep 17 00:00:00 2001 From: The_miro Date: Thu, 21 May 2026 21:18:46 +0200 Subject: [PATCH] fix(installer): fix tui-install on bare console + add network check to archiso installers tui-install.sh: dialog height=40 apps checklist and height=24 confirm dialog both exceeded the standard 24-row VT console, causing dialog to exit with code 1 and silently skip all apps. Make both heights terminal-adaptive via tput lines/cols. Also extend the EXIT trap to reset the terminal so Ctrl-C during a dialog doesn't leave the console in raw/no-echo mode. arch-autoinstall.sh, archbaseos-guided-install.sh: add a ping 1.1.1.1 check early in both scripts. In interactive mode, launches nmtui if offline, then re-checks; prompts to abort if still down. Answerfile mode logs a warning and continues. Co-Authored-By: Claude Sonnet 4.6 --- setup/arch-autoinstall.sh | 17 +++++++++++++++++ setup/archbaseos-guided-install.sh | 17 +++++++++++++++++ setup/tui-install.sh | 13 ++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/setup/arch-autoinstall.sh b/setup/arch-autoinstall.sh index b08b12b..42da19e 100755 --- a/setup/arch-autoinstall.sh +++ b/setup/arch-autoinstall.sh @@ -99,6 +99,23 @@ if $AF_MODE; then command -v jq &>/dev/null || pacman -Sy --noconfirm jq fi +############################################ +# NETWORK CHECK +############################################ +if ! ping -c1 -W3 1.1.1.1 &>/dev/null; then + if $AF_MODE; then + echo "Warning: no internet connection detected — continuing in answerfile mode." + else + echo "No internet connection detected. Launching nmtui..." + nmtui + if ! ping -c1 -W3 1.1.1.1 &>/dev/null; then + echo "Warning: still offline. Packages cannot be downloaded without network." + read -rp "Continue anyway? [y/N]: " _net_ans + [[ "${_net_ans,,}" == "y" ]] || { echo "Aborted — no network."; exit 1; } + fi + fi +fi + ############################################ # KEYMAP # To add more layouts: append "code|Display Name" to KEYMAPS diff --git a/setup/archbaseos-guided-install.sh b/setup/archbaseos-guided-install.sh index 947faad..1f55e0b 100755 --- a/setup/archbaseos-guided-install.sh +++ b/setup/archbaseos-guided-install.sh @@ -118,6 +118,23 @@ else echo "== Arch Linux FIDO2-Ready Installer ==" fi +############################################ +# NETWORK CHECK +############################################ +if ! ping -c1 -W3 1.1.1.1 &>/dev/null; then + if $AF_MODE; then + echo "Warning: no internet connection detected — continuing in answerfile mode." + else + echo "No internet connection detected. Launching nmtui..." + nmtui + if ! ping -c1 -W3 1.1.1.1 &>/dev/null; then + echo "Warning: still offline. Packages cannot be downloaded without network." + read -rp "Continue anyway? [y/N]: " _net_ans + [[ "${_net_ans,,}" == "y" ]] || { echo "Aborted — no network."; exit 1; } + fi + fi +fi + ############################################ # Begin ############################################ diff --git a/setup/tui-install.sh b/setup/tui-install.sh index c7612aa..bb551f7 100755 --- a/setup/tui-install.sh +++ b/setup/tui-install.sh @@ -10,7 +10,7 @@ MODULES="$DOTFILES_DIR/setup/modules" APPS="$MODULES/optional-Modules/apps" LOG="$HOME/dotfiles-install.log" TMP_D="$(mktemp -d)" -trap 'rm -rf "$TMP_D"' EXIT +trap 'rm -rf "$TMP_D"; tput reset 2>/dev/null || stty sane 2>/dev/null || true' EXIT INT TERM HUP ANSWERFILE="${ANSWERFILE:-/answerfile.json}" ANSWERFILE_MODE=false @@ -18,6 +18,10 @@ ANSWERFILE_MODE=false BACKTITLE="the_miro's Arch Dotfiles" +# ── Terminal dimensions (bare console safe) ─────────────────────────────────── +TERM_H=$(tput lines 2>/dev/null || echo 24) +TERM_W=$(tput cols 2>/dev/null || echo 80) + # ── Cyberqueer dialog theme ─────────────────────────────────────────────────── export DIALOGRC="$TMP_D/dialogrc" cat > "$DIALOGRC" <<'EOF' @@ -302,9 +306,11 @@ fi if $ANSWERFILE_MODE; then SELECTED_APPS="$AF_APPS" else + _APP_H=$(( TERM_H - 2 < 40 ? TERM_H - 2 : 40 )) + _APP_LIST_H=$(( _APP_H - 8 < 4 ? 4 : _APP_H - 8 )) SELECTED_APPS=$(dialog --backtitle "$BACKTITLE" \ --title " Applications " \ - --checklist "Optional applications — installed after base components:" 40 76 32 \ + --checklist "Optional applications — installed after base components:" "$_APP_H" 76 "$_APP_LIST_H" \ "ollama" "Ollama local LLM runner + API server" off \ "llama-cpp" "llama.cpp standalone inference CLI + server" off \ "open-webui" "Open WebUI browser UI for Ollama / LLM backends" off \ @@ -435,10 +441,11 @@ if ! $ANSWERFILE_MODE; then [[ "$SELECTED_APPS" == *"qemu"* ]] && SUMMARY+=" ✦ QEMU/KVM + virt-manager\n" fi + _CONF_H=$(( TERM_H - 2 < 24 ? TERM_H - 2 : 24 )) dialog --backtitle "$BACKTITLE" \ --title " Confirm Installation " \ --yesno "\n Components to install:\n\n${SUMMARY}\n Log: $LOG\n\n Proceed?" \ - 24 62 || { clear; echo "Aborted."; exit 0; } + "$_CONF_H" 62 || { clear; echo "Aborted."; exit 0; } fi count_steps "$COMPONENTS" "$DE" "$SELECTED_APPS"