Fix configuration detection in update mode
- Skip Transmission configuration prompt when updating an existing installation - Automatically detect remote/local setting from existing config - Properly export update-related variables to environment file - Fix indentation issues in conditional statements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
2dcd4becef
commit
eaed045323
@ -1197,14 +1197,37 @@ fi
|
||||
# Launch the main installer
|
||||
echo -e "${GREEN}Launching main installer...${NC}"
|
||||
|
||||
# Ask about remote Transmission before launching main installer
|
||||
# This ensures the TRANSMISSION_REMOTE variable is set correctly
|
||||
echo -e "${BOLD}Transmission Configuration:${NC}"
|
||||
echo -e "Configure connection to your Transmission client:"
|
||||
echo
|
||||
# Skip Transmission configuration if we're in update mode
|
||||
if [ "$IS_UPDATE" = "true" ] && [ -n "$EXISTING_CONFIG_PATH" ]; then
|
||||
echo -e "${GREEN}Existing configuration detected, skipping Transmission configuration...${NC}"
|
||||
|
||||
# If stdin is not a terminal (pipe or redirect), read from stdin
|
||||
if [ ! -t 0 ]; then
|
||||
# Extract Transmission remote setting from existing config
|
||||
if [ -f "$EXISTING_CONFIG_PATH" ]; then
|
||||
# Try to extract remoteConfig.isRemote value from config.json
|
||||
if command -v grep &> /dev/null && command -v sed &> /dev/null; then
|
||||
IS_REMOTE=$(grep -o '"isRemote":[^,}]*' "$EXISTING_CONFIG_PATH" | sed 's/"isRemote"://; s/[[:space:]]//g')
|
||||
if [ "$IS_REMOTE" = "true" ]; then
|
||||
export TRANSMISSION_REMOTE=true
|
||||
echo -e "${GREEN}Using existing remote Transmission configuration.${NC}"
|
||||
else
|
||||
export TRANSMISSION_REMOTE=false
|
||||
echo -e "${GREEN}Using existing local Transmission configuration.${NC}"
|
||||
fi
|
||||
else
|
||||
# Default to false if we can't extract it
|
||||
export TRANSMISSION_REMOTE=false
|
||||
echo -e "${YELLOW}Could not determine Transmission remote setting, using local configuration.${NC}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# Ask about remote Transmission before launching main installer
|
||||
# This ensures the TRANSMISSION_REMOTE variable is set correctly
|
||||
echo -e "${BOLD}Transmission Configuration:${NC}"
|
||||
echo -e "Configure connection to your Transmission client:"
|
||||
echo
|
||||
|
||||
# If stdin is not a terminal (pipe or redirect), read from stdin
|
||||
if [ ! -t 0 ]; then
|
||||
# Save all input to a temporary file
|
||||
INPUT_FILE=$(mktemp)
|
||||
cat > "$INPUT_FILE"
|
||||
@ -1225,12 +1248,13 @@ if [ "$input_remote" = "y" ] || [ "$input_remote" = "Y" ]; then
|
||||
export TRANSMISSION_REMOTE=true
|
||||
echo -e "${GREEN}Remote Transmission selected.${NC}"
|
||||
else
|
||||
export TRANSMISSION_REMOTE=false
|
||||
echo -e "${GREEN}Local Transmission selected.${NC}"
|
||||
export TRANSMISSION_REMOTE=false
|
||||
echo -e "${GREEN}Local Transmission selected.${NC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# If remote mode is selected, collect remote details here and pass to main installer
|
||||
if [ "$TRANSMISSION_REMOTE" = "true" ]; then
|
||||
# If remote mode is selected and not an update, collect remote details here and pass to main installer
|
||||
if [ "$TRANSMISSION_REMOTE" = "true" ] && [ "$IS_UPDATE" != "true" ]; then
|
||||
# Get remote transmission details
|
||||
if [ ! -t 0 ]; then
|
||||
# Non-interactive mode - we already have input saved to INPUT_FILE
|
||||
@ -1312,6 +1336,13 @@ chmod +x "${SCRIPT_DIR}/.env.install"
|
||||
# Ensure the environment file is world-readable to avoid permission issues
|
||||
chmod 644 "${SCRIPT_DIR}/.env.install"
|
||||
|
||||
# If we're in update mode, add the existing installation path to the environment file
|
||||
if [ "$IS_UPDATE" = "true" ] && [ -n "$EXISTING_CONFIG_PATH" ]; then
|
||||
echo "export EXISTING_CONFIG_PATH=\"$EXISTING_CONFIG_PATH\"" >> "${SCRIPT_DIR}/.env.install"
|
||||
echo "export EXISTING_INSTALL_DIR=\"$EXISTING_INSTALL_DIR\"" >> "${SCRIPT_DIR}/.env.install"
|
||||
echo "export IS_UPDATE=true" >> "${SCRIPT_DIR}/.env.install"
|
||||
fi
|
||||
|
||||
# Force inclusion in the main installer - modify the main installer temporarily if needed
|
||||
if ! grep -q "source.*\.env\.install" "${SCRIPT_DIR}/main-installer.sh"; then
|
||||
# Backup the main installer
|
||||
|
Loading…
x
Reference in New Issue
Block a user