diff --git a/modules/dependencies-module.sh b/modules/dependencies-module.sh old mode 100644 new mode 100755 index 8369385..119a23b --- a/modules/dependencies-module.sh +++ b/modules/dependencies-module.sh @@ -19,6 +19,24 @@ function install_dependencies() { log "INFO" "Loaded transmission settings from absolute path: TRANSMISSION_REMOTE=$TRANSMISSION_REMOTE" fi + # If we're in update mode, try to load the remote status from existing config + if [ "$IS_UPDATE" = "true" ] && [ -n "$EXISTING_CONFIG_PATH" ]; then + log "INFO" "Update mode detected with config at $EXISTING_CONFIG_PATH, checking Transmission remote setting" + if [ -f "$EXISTING_CONFIG_PATH" ]; then + # Try to extract the isRemote setting from the config file + if command -v grep &> /dev/null; then + IS_REMOTE=$(grep -o '"isRemote":[^,}]*' "$EXISTING_CONFIG_PATH" | grep -o 'true\|false') + if [ "$IS_REMOTE" = "true" ]; then + export TRANSMISSION_REMOTE=true + log "INFO" "Detected remote Transmission configuration from existing config" + elif [ "$IS_REMOTE" = "false" ]; then + export TRANSMISSION_REMOTE=false + log "INFO" "Detected local Transmission configuration from existing config" + fi + fi + fi + 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..." @@ -77,8 +95,8 @@ function install_dependencies() { log "INFO" "Node.js is already installed." fi - # Check if we need to install Transmission (only if local transmission was selected) - if [ "$TRANSMISSION_REMOTE" = false ]; then + # Check if we need to install Transmission (only if local transmission was selected and not in update mode) + if [ "$TRANSMISSION_REMOTE" = false ] && [ "$IS_UPDATE" != "true" ]; then if ! command_exists transmission-daemon; then log "INFO" "Local Transmission installation selected, but transmission-daemon is not installed." log "INFO" "You selected to use a local Transmission installation during configuration."