Compare commits

..

2 Commits

Author SHA1 Message Date
d2babeba27 Fix configuration gathering and order of operations
- Add emergency fallback to ask about remote Transmission if config step was skipped
- Add CONFIG_GATHERED flag to track if config step was run
- Improve bootstrap installer with clear explanation of what to expect
- Explicitly check for gather_configuration success and output debug info
- Add additional variable initialization to ensure consistent behavior

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-05 08:46:06 +00:00
e05c8da811 Fix installation order and properly initialize TRANSMISSION_REMOTE
- Move SCRIPT_DIR initialization before its usage
- Ensure TRANSMISSION_REMOTE is initialized with default value
- Add logging to show whether remote or local Transmission is being used
- Initialize TRANSMISSION_REMOTE at the start of gather_configuration

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-05 08:42:55 +00:00
4 changed files with 60 additions and 5 deletions

View File

@ -62,6 +62,19 @@ fi
echo -e "${YELLOW}Running the main installer...${NC}" echo -e "${YELLOW}Running the main installer...${NC}"
cd "$INSTALL_DIR" cd "$INSTALL_DIR"
chmod +x main-installer.sh chmod +x main-installer.sh
# Let the user know what's about to happen
echo -e "${YELLOW}You will now be asked for configuration options including:${NC}"
echo -e "- Installation directory"
echo -e "- User to run the service as"
echo -e "- Whether Transmission is running on a remote server"
echo -e "- Transmission connection details"
echo -e "- Media organization preferences"
echo
# Add small delay to ensure user sees this message
sleep 2
./main-installer.sh ./main-installer.sh
# Installation complete # Installation complete

View File

@ -12,6 +12,9 @@ YELLOW='\033[0;33m'
RED='\033[0;31m' RED='\033[0;31m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
# Get current directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Print header # Print header
echo -e "${BOLD}==================================================${NC}" echo -e "${BOLD}==================================================${NC}"
echo -e "${BOLD} Transmission RSS Manager Installer ${NC}" echo -e "${BOLD} Transmission RSS Manager Installer ${NC}"
@ -26,9 +29,6 @@ if [ "$EUID" -ne 0 ]; then
exit 1 exit 1
fi fi
# Get current directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Check for installation type # Check for installation type
IS_UPDATE=false IS_UPDATE=false
INSTALLATION_DETECTED=false INSTALLATION_DETECTED=false
@ -99,6 +99,9 @@ trap 'cleanup_on_error "$BASH_COMMAND"' ERR
# Execute the installation steps in sequence # Execute the installation steps in sequence
log "INFO" "Starting installation process..." log "INFO" "Starting installation process..."
# Set default for TRANSMISSION_REMOTE
export TRANSMISSION_REMOTE=false
if [ "$IS_UPDATE" = true ]; then if [ "$IS_UPDATE" = true ]; then
log "INFO" "Running in update mode - preserving existing configuration..." log "INFO" "Running in update mode - preserving existing configuration..."
@ -132,10 +135,16 @@ else
# Step 1: Gather configuration from user # Step 1: Gather configuration from user
log "INFO" "Gathering configuration..." log "INFO" "Gathering configuration..."
gather_configuration || { # Explicitly run this to ensure it's called before dependencies
set +e # Temporarily disable exit on error
if ! gather_configuration; then
log "ERROR" "Configuration gathering failed" log "ERROR" "Configuration gathering failed"
exit 1 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"
# Step 2: Install dependencies # Step 2: Install dependencies
log "INFO" "Installing dependencies..." log "INFO" "Installing dependencies..."

View File

@ -75,6 +75,12 @@ validate_hostname() {
function gather_configuration() { function gather_configuration() {
log "INFO" "Starting configuration gathering" log "INFO" "Starting configuration gathering"
# Initialize default values for Transmission mode
export TRANSMISSION_REMOTE=false
# Set flag to indicate that configuration was gathered
export CONFIG_GATHERED=true
echo -e "${BOLD}Installation Configuration:${NC}" echo -e "${BOLD}Installation Configuration:${NC}"
echo -e "Please provide the following configuration parameters:" echo -e "Please provide the following configuration parameters:"
echo echo

View File

@ -4,6 +4,33 @@
function install_dependencies() { function install_dependencies() {
log "INFO" "Installing dependencies..." log "INFO" "Installing dependencies..."
# Make sure TRANSMISSION_REMOTE variable is set
if [ -z "$TRANSMISSION_REMOTE" ]; then
# Set default to false if not defined
export TRANSMISSION_REMOTE=false
log "WARN" "TRANSMISSION_REMOTE variable was not set, defaulting to local installation"
fi
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
# Check for package manager # Check for package manager
if command -v apt-get &> /dev/null; then if command -v apt-get &> /dev/null; then
# Update package index # Update package index