#!/bin/bash # Configuration module for Transmission RSS Manager Installation # Configuration variables with defaults INSTALL_DIR="/opt/transmission-rss-manager" SERVICE_NAME="transmission-rss-manager" USER=$(logname || echo $SUDO_USER) PORT=3000 # Transmission configuration variables TRANSMISSION_REMOTE=false TRANSMISSION_HOST="localhost" TRANSMISSION_PORT=9091 TRANSMISSION_USER="" TRANSMISSION_PASS="" TRANSMISSION_RPC_PATH="/transmission/rpc" TRANSMISSION_DOWNLOAD_DIR="/var/lib/transmission-daemon/downloads" TRANSMISSION_DIR_MAPPING="{}" # Media path defaults MEDIA_DIR="/mnt/media" ENABLE_BOOK_SORTING=true function gather_configuration() { echo -e "${BOLD}Installation Configuration:${NC}" echo -e "Please provide the following configuration parameters:" echo read -p "Installation directory [$INSTALL_DIR]: " input_install_dir INSTALL_DIR=${input_install_dir:-$INSTALL_DIR} read -p "Web interface port [$PORT]: " input_port PORT=${input_port:-$PORT} read -p "Run as user [$USER]: " input_user USER=${input_user:-$USER} echo 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 TRANSMISSION_REMOTE=true read -p "Remote Transmission host [localhost]: " input_trans_host TRANSMISSION_HOST=${input_trans_host:-$TRANSMISSION_HOST} read -p "Remote Transmission port [9091]: " input_trans_port TRANSMISSION_PORT=${input_trans_port:-$TRANSMISSION_PORT} read -p "Remote Transmission username []: " input_trans_user TRANSMISSION_USER=${input_trans_user:-$TRANSMISSION_USER} read -p "Remote Transmission password []: " input_trans_pass TRANSMISSION_PASS=${input_trans_pass:-$TRANSMISSION_PASS} read -p "Remote Transmission RPC path [/transmission/rpc]: " input_trans_path TRANSMISSION_RPC_PATH=${input_trans_path:-$TRANSMISSION_RPC_PATH} # Configure directory mapping for remote setup echo echo -e "${YELLOW}Directory Mapping Configuration${NC}" echo -e "When using a remote Transmission server, you need to map paths between servers." echo -e "For each directory on the remote server, specify the corresponding local directory." echo # Get remote download directory read -p "Remote Transmission download directory: " REMOTE_DOWNLOAD_DIR REMOTE_DOWNLOAD_DIR=${REMOTE_DOWNLOAD_DIR:-"/var/lib/transmission-daemon/downloads"} # Get local directory that corresponds to remote download directory read -p "Local directory that corresponds to the remote download directory: " LOCAL_DOWNLOAD_DIR LOCAL_DOWNLOAD_DIR=${LOCAL_DOWNLOAD_DIR:-"/mnt/transmission-downloads"} # Create mapping JSON TRANSMISSION_DIR_MAPPING=$(cat <