Improve handling of non-interactive and piped input

- Add detection for non-interactive terminal (piped input)
- Properly read input from pipe in install-script.sh
- Use pre-set environment variables when available
- Add better fallbacks for script usage
- Fix syntax error in main installer script
- More detailed logging of input handling process

This ensures the installer can be used both interactively and in scripts/automated setups.
This commit is contained in:
2025-03-05 09:59:41 +00:00
parent 4e4fd09811
commit a3924912f1
2 changed files with 49 additions and 18 deletions
+7 -1
View File
@@ -1173,7 +1173,13 @@ echo -e "${BOLD}Transmission Configuration:${NC}"
echo -e "Configure connection to your Transmission client:"
echo
read -p "Is Transmission running on a remote server? (y/n) [n]: " input_remote
# If stdin is not a terminal (pipe or redirect), assume default
if [ ! -t 0 ]; then
input_remote=$(head -n 1) # Read first line from stdin
echo "DEBUG: Non-interactive mode detected, read input: '$input_remote'"
else
read -p "Is Transmission running on a remote server? (y/n) [n]: " input_remote
fi
echo "DEBUG: Input received for remote in install-script.sh: '$input_remote'"
# Explicitly check for "y" or "Y" response
if [ "$input_remote" = "y" ] || [ "$input_remote" = "Y" ]; then