From dfc68c275aea9c98262cd4ff17375153e8a3590b Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Fri, 8 Nov 2024 14:17:14 +0100 Subject: [PATCH] ensures interactive input for terminal prompts in setup.sh --- setup.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/setup.sh b/setup.sh index 63125d7..14a5fe5 100755 --- a/setup.sh +++ b/setup.sh @@ -33,6 +33,14 @@ die() { exit 1 } +# Ensure we're running interactively +ensure_interactive() { + # If stdin is not a terminal, reconnect stdin to /dev/tty + if [ ! -t 0 ]; then + exec < /dev/tty || die "Failed to connect to terminal. Please run the script directly instead of piping from curl" + fi +} + confirm_symlink() { local link="$1" local msg="$2" @@ -88,6 +96,9 @@ EOF log_success "Hardware configuration created successfully." log_info "Consider adding additional hardware configuration to $config_file" + # Ensure interactive input before system type selection + ensure_interactive + # System type selection local systemType while true; do @@ -256,6 +267,9 @@ prepare_hostname() { return fi + # Ensure interactive input before hostname prompt + ensure_interactive + while true; do log_info "Enter the hostname for this machine:" read -r hostname