#\!/bin/bash # This module handles creating necessary files # Function to create systemd service file create_systemd_service_file() { local install_dir=$1 local service_name=$2 local description=$3 local exec_command=$4 local service_file="/tmp/$service_name.service" echo "Creating systemd service file for $service_name..." cat > "$service_file" << EOL [Unit] Description=$description After=network.target [Service] Type=simple User=$(whoami) WorkingDirectory=$install_dir ExecStart=$exec_command Restart=on-failure RestartSec=10 SyslogIdentifier=$service_name Environment=ASPNETCORE_ENVIRONMENT=Production [Install] WantedBy=multi-user.target EOL sudo mv "$service_file" "/etc/systemd/system/$service_name.service" sudo systemctl daemon-reload echo "Service file created for $service_name" } # Function to create a simple start script create_start_script() { local install_dir=$1 local script_path="$install_dir/start.sh" echo "Creating start script..." cat > "$script_path" << 'EOL' #\!/bin/bash # Colors GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo -e "${GREEN}Starting Transmission RSS Manager...${NC}" echo -e "${GREEN}The web interface will be available at: http://localhost:5000${NC}" echo -e "${YELLOW}Press Ctrl+C to stop the application${NC}" ./TransmissionRssManager --urls=http://0.0.0.0:5000 EOL chmod +x "$script_path" echo "Start script created at $script_path" } # Function to create logs directory create_logs_directory() { local install_dir=$1 local logs_dir="$install_dir/logs" mkdir -p "$logs_dir" echo "Logs directory created at $logs_dir" }