Direct prompt for remote Transmission in main installer

- Move the remote Transmission prompt to main installer before config module is called
- Modify config module to use the already-set TRANSMISSION_REMOTE variable
- Remove existing logic in config module that was causing issues
- Clean up environment variables when invoking installer from bootstrap
- Remove emergency fallback since we now handle it in the right order

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MasterDraco 2025-03-05 08:52:46 +00:00
parent d2babeba27
commit 1795373b42
4 changed files with 30 additions and 34 deletions

View File

@ -75,7 +75,8 @@ echo
# Add small delay to ensure user sees this message
sleep 2
./main-installer.sh
# Force the installer to run with the right environment
env -i PATH="$PATH" TERM="$TERM" USER="$USER" HOME="$HOME" SUDO_USER="$SUDO_USER" ./main-installer.sh
# Installation complete
echo -e "${GREEN}${BOLD}Bootstrap installation complete!${NC}"

View File

@ -133,15 +133,28 @@ if [ "$IS_UPDATE" = true ]; then
else
# This is a fresh installation - run all steps
# Step 1: Gather configuration from user
log "INFO" "Gathering configuration..."
# Explicitly run this to ensure it's called before dependencies
set +e # Temporarily disable exit on error
if ! gather_configuration; then
# Step 1: First, let's directly ask about Transmission
# This is a direct approach that bypasses any potential sourcing issues
log "INFO" "Configuring Transmission connection..."
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 [[ $input_remote =~ ^[Yy]$ ]]; then
export TRANSMISSION_REMOTE=true
log "INFO" "Remote Transmission selected."
else
export TRANSMISSION_REMOTE=false
log "INFO" "Local Transmission selected."
fi
# Now gather the rest of the configuration
log "INFO" "Gathering remaining configuration..."
gather_configuration || {
log "ERROR" "Configuration gathering failed"
exit 1
fi
set -e # Re-enable exit on error
}
# Debug: Verify TRANSMISSION_REMOTE is set
log "INFO" "After configuration gathering, TRANSMISSION_REMOTE=$TRANSMISSION_REMOTE"

View File

@ -116,12 +116,11 @@ function gather_configuration() {
echo -e "Configure connection to your Transmission client:"
echo
# Ask if Transmission is remote
read -p "Is Transmission running on a remote server? (y/n) [n]: " input_remote
if [[ $input_remote =~ ^[Yy]$ ]]; then
TRANSMISSION_REMOTE=true
export TRANSMISSION_REMOTE=true
# Don't ask about remote again - this is now handled in the main installer
# Just log the current setting for clarity
log "INFO" "Using previously selected Transmission mode: $([ "$TRANSMISSION_REMOTE" = true ] && echo "Remote" || echo "Local")"
if [ "$TRANSMISSION_REMOTE" = true ]; then
# Get and validate hostname
while true; do
read -p "Remote Transmission host [localhost]: " input_trans_host
@ -233,9 +232,7 @@ function gather_configuration() {
# Set Transmission download dir for configuration
TRANSMISSION_DOWNLOAD_DIR=$REMOTE_DOWNLOAD_DIR
else
# Local Transmission selected
TRANSMISSION_REMOTE=false
export TRANSMISSION_REMOTE=false
# Local Transmission selected - this part was already set in main-installer.sh
echo -e "${YELLOW}You've selected to use a local Transmission installation.${NC}"

View File

@ -13,23 +13,8 @@ function install_dependencies() {
log "INFO" "Transmission mode: $([ "$TRANSMISSION_REMOTE" = true ] && echo "Remote" || echo "Local")"
# Debug: print out whether the gather_configuration was called
if [ "$IS_UPDATE" != true ]; then
if [ -z "$CONFIG_GATHERED" ]; then
log "ERROR" "Configuration step was skipped! This is a bug."
log "INFO" "Please report this issue. Will now manually ask about Transmission location."
# Emergency fix: Ask about remote installation here
read -p "Is Transmission running on a remote server? (y/n) [n]: " input_remote
if [[ $input_remote =~ ^[Yy]$ ]]; then
export TRANSMISSION_REMOTE=true
log "INFO" "Remote Transmission selected."
else
export TRANSMISSION_REMOTE=false
log "INFO" "Local Transmission selected."
fi
fi
fi
# Log transmission mode
log "INFO" "Proceeding with Transmission mode: $([ "$TRANSMISSION_REMOTE" = true ] && echo "Remote" || echo "Local")"
# Check for package manager
if command -v apt-get &> /dev/null; then