install: force interactive prompts to read from /dev/tty so hostname/layout/TZ/profile prompts pause reliably

This commit is contained in:
Don Williams
2025-09-19 17:09:07 -04:00
parent a63f822870
commit fff38cef1d
3 changed files with 9 additions and 8 deletions

View File

@@ -98,7 +98,7 @@ sleep 1
echo "-----"
read -rp "$CAT Enter Your New Hostname: [ default ] " hostName
read -rp "$CAT Enter Your New Hostname: [ default ] " hostName </dev/tty
if [ -z "$hostName" ]; then
hostName="default"
fi
@@ -119,7 +119,7 @@ if type nhl_detect_gpu_and_toggle >/dev/null 2>&1; then
fi
echo "-----"
read -rp "$CAT Enter your keyboard layout: [ us ] " keyboardLayout
read -rp "$CAT Enter your keyboard layout: [ us ] " keyboardLayout </dev/tty
if [ -z "$keyboardLayout" ]; then
keyboardLayout="us"
fi

View File

@@ -70,7 +70,8 @@ sleep 1
echo "-----"
read -rp "$CAT Enter Your New Hostname: [ default ] " hostName
# Read from the controlling TTY to ensure interactivity even if stdin is redirected
read -rp "$CAT Enter Your New Hostname: [ default ] " hostName </dev/tty
if [ -z "$hostName" ]; then
hostName="default"
fi
@@ -92,7 +93,7 @@ if type nhl_detect_gpu_and_toggle >/dev/null 2>&1; then
fi
echo "-----"
read -rp "$CAT Enter your keyboard layout: [ us ] " keyboardLayout
read -rp "$CAT Enter your keyboard layout: [ us ] " keyboardLayout </dev/tty
if [ -z "$keyboardLayout" ]; then
keyboardLayout="us"
fi

View File

@@ -43,14 +43,14 @@ nhl_detect_gpu_and_toggle() {
local profile="$detected"
if [ -n "$detected" ]; then
printf "Detected GPU profile: %s. Use this? (Y/n): " "$detected"
read -r _ans || true
read -r _ans </dev/tty || true
if [ -n "$_ans" ] && ! echo "$_ans" | grep -qi '^y'; then
profile=""
fi
fi
if [ -z "$profile" ]; then
printf "Enter your GPU profile (amd|intel|nvidia|nvidia-laptop|vm): [amd] "
read -r profile || true
read -r profile </dev/tty || true
profile=${profile:-amd}
fi
@@ -94,7 +94,7 @@ nhl_prompt_timezone_console() {
# Timezone prompt (default: auto-detect)
local timeZone
read -rp "Enter your timezone (e.g. America/New_York) or leave blank for auto-detect: [auto-detect] " timeZone
read -rp "Enter your timezone (e.g. America/New_York) or leave blank for auto-detect: [auto-detect] " timeZone </dev/tty
if [ -z "$timeZone" ]; then
# Prefer automatic time zone
if grep -q 'services\.automatic-timezoned\.enable' "$cfg"; then
@@ -120,7 +120,7 @@ nhl_prompt_timezone_console() {
# Console keymap prompt (defaults to keyboardLayout)
local consoleKeyMap
read -rp "Enter your console keymap: [$defKb] " consoleKeyMap
read -rp "Enter your console keymap: [$defKb] " consoleKeyMap </dev/tty
consoleKeyMap=${consoleKeyMap:-$defKb}
# Replace any existing console.keyMap assignment
if grep -q 'console\.keyMap' "$cfg"; then