Fix Transmission remote configuration handling

This commit addresses an issue where the Transmission remote setting wasn't properly preserved between install scripts.
Major changes:

- Fixed environment variable sharing between install-script.sh and main-installer.sh
- Added multiple methods to locate and load the .env.install file
- Removed duplicate log message in dependencies-module.sh
- Improved permission handling for the environment file
- Directly export TRANSMISSION_REMOTE variable before launching main-installer.sh

This ensures the user's choice of remote or local Transmission is correctly honored throughout the installation process.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MasterDraco 2025-03-05 09:35:10 +00:00
parent b54086cfd0
commit 455006992d
3 changed files with 26 additions and 5 deletions

View File

@ -1186,6 +1186,9 @@ fi
echo "export TRANSMISSION_REMOTE=$TRANSMISSION_REMOTE" > "${SCRIPT_DIR}/.env.install"
chmod +x "${SCRIPT_DIR}/.env.install"
# Ensure the environment file is world-readable to avoid permission issues
chmod 644 "${SCRIPT_DIR}/.env.install"
# 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
@ -1198,4 +1201,5 @@ fi
# Now execute the main installer with the environment variables set
echo "Running main installer with TRANSMISSION_REMOTE=$TRANSMISSION_REMOTE"
bash -c "source ${SCRIPT_DIR}/.env.install && ${SCRIPT_DIR}/main-installer.sh"
export TRANSMISSION_REMOTE
"${SCRIPT_DIR}/main-installer.sh"

View File

@ -5,6 +5,12 @@
# Set script to exit on error
set -e
# Load installation environment variables if they exist
if [ -f "$(dirname "$0")/.env.install" ]; then
source "$(dirname "$0")/.env.install"
echo "Loaded TRANSMISSION_REMOTE=$TRANSMISSION_REMOTE from environment file"
fi
# Text formatting
BOLD='\033[1m'
GREEN='\033[0;32m'

View File

@ -4,7 +4,21 @@
function install_dependencies() {
log "INFO" "Installing dependencies..."
# Make sure TRANSMISSION_REMOTE variable is set
# Make sure TRANSMISSION_REMOTE variable is set and honored
# First check for environment variable that might have been directly set
# Then check the .env.install file in various locations
# Try relative path first
ENV_FILE="$(dirname "$(dirname "$0")")/.env.install"
if [ -f "$ENV_FILE" ]; then
source "$ENV_FILE"
log "INFO" "Loaded transmission settings from environment file: TRANSMISSION_REMOTE=$TRANSMISSION_REMOTE"
# Try absolute path as fallback
elif [ -f "/opt/develop/transmission-rss-manager/.env.install" ]; then
source "/opt/develop/transmission-rss-manager/.env.install"
log "INFO" "Loaded transmission settings from absolute path: TRANSMISSION_REMOTE=$TRANSMISSION_REMOTE"
fi
# Always prompt if we didn't get TRANSMISSION_REMOTE from environment or previous steps
if [ -z "$TRANSMISSION_REMOTE" ]; then
log "WARN" "TRANSMISSION_REMOTE variable was not set, asking now..."
@ -32,9 +46,6 @@ function install_dependencies() {
log "INFO" "Proceeding with Transmission mode: $([ "$TRANSMISSION_REMOTE" = true ] && echo "Remote" || echo "Local")"
# 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
# Update package index