- Added correct runtimeconfig.json for Microsoft.AspNetCore.OpenApi reference - Fixed systemd service to specify correct working directory and environment - Set explicit --no-self-contained and framework target for publishing - Added test-installation.sh script for easy verification - Fixed libhostpolicy.so error when running as a service 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
254 lines
7.4 KiB
Bash
Executable File
254 lines
7.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Transmission RSS Manager One-Click Installer
|
|
# This script downloads and installs Transmission RSS Manager with all dependencies
|
|
|
|
# Colors for output
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Print section header
|
|
print_section() {
|
|
echo -e "\n${GREEN}===== $1 =====${NC}"
|
|
}
|
|
|
|
# Error handling
|
|
set -e
|
|
trap 'echo -e "${RED}An error occurred. Installation failed.${NC}"; exit 1' ERR
|
|
|
|
print_section "Transmission RSS Manager Installer"
|
|
echo -e "This script will install Transmission RSS Manager and all required components."
|
|
|
|
# Check if running as root (sudo)
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo -e "${YELLOW}Please run this script with sudo:${NC}"
|
|
echo -e "${YELLOW}sudo bash install.sh${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Detect Linux distribution
|
|
if [ -f /etc/os-release ]; then
|
|
. /etc/os-release
|
|
DISTRO=$ID
|
|
else
|
|
echo -e "${RED}Cannot detect Linux distribution. This script supports Debian, Ubuntu, and their derivatives.${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
print_section "Installing Dependencies"
|
|
|
|
# Update package lists
|
|
echo "Updating package lists..."
|
|
apt-get update
|
|
|
|
# Install basic dependencies
|
|
echo "Installing required packages..."
|
|
apt-get install -y wget curl unzip git
|
|
|
|
# Install .NET SDK
|
|
print_section "Installing .NET SDK"
|
|
if ! command -v dotnet &> /dev/null; then
|
|
echo "Installing .NET SDK 7.0..."
|
|
|
|
# Add Microsoft package repository
|
|
wget -O packages-microsoft-prod.deb https://packages.microsoft.com/config/$DISTRO/$VERSION_ID/packages-microsoft-prod.deb
|
|
dpkg -i packages-microsoft-prod.deb
|
|
rm packages-microsoft-prod.deb
|
|
|
|
# Install .NET SDK
|
|
apt-get update
|
|
apt-get install -y apt-transport-https
|
|
apt-get update
|
|
apt-get install -y dotnet-sdk-7.0
|
|
else
|
|
echo ".NET SDK is already installed."
|
|
fi
|
|
|
|
# Verify .NET installation
|
|
dotnet --version
|
|
if [ $? -ne 0 ]; then
|
|
echo -e "${RED}.NET SDK installation failed.${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# PostgreSQL is not needed in simplified version
|
|
print_section "Checking dependencies"
|
|
echo "Using simplified version without database dependencies."
|
|
|
|
# No need for Entity Framework tools in the simplified version
|
|
print_section "Checking .NET tools"
|
|
echo "Using simplified version without database dependencies."
|
|
|
|
# Create installation directory
|
|
print_section "Setting up application"
|
|
INSTALL_DIR="/opt/transmission-rss-manager"
|
|
mkdir -p $INSTALL_DIR
|
|
|
|
# Download or clone the application
|
|
if [ ! -d "$INSTALL_DIR/.git" ]; then
|
|
echo "Downloading application files..."
|
|
# Clone the repository (main branch)
|
|
git clone -b main https://git.powerdata.dk/masterdraco/Torrent-Manager.git $INSTALL_DIR
|
|
else
|
|
echo "Updating existing installation..."
|
|
cd $INSTALL_DIR
|
|
git pull
|
|
fi
|
|
|
|
# Setup configuration directory
|
|
print_section "Setting up configuration"
|
|
CONFIG_DIR="/etc/transmission-rss-manager"
|
|
mkdir -p $CONFIG_DIR
|
|
|
|
# Create config file with default settings
|
|
echo '{
|
|
"Transmission": {
|
|
"Host": "localhost",
|
|
"Port": 9091,
|
|
"Username": "",
|
|
"Password": "",
|
|
"UseHttps": false
|
|
},
|
|
"AutoDownloadEnabled": true,
|
|
"CheckIntervalMinutes": 30,
|
|
"DownloadDirectory": "/var/lib/transmission-daemon/downloads",
|
|
"MediaLibraryPath": "/media/library",
|
|
"PostProcessing": {
|
|
"Enabled": false,
|
|
"ExtractArchives": true,
|
|
"OrganizeMedia": true,
|
|
"MinimumSeedRatio": 1
|
|
},
|
|
"UserPreferences": {
|
|
"EnableDarkMode": true,
|
|
"AutoRefreshUIEnabled": true,
|
|
"AutoRefreshIntervalSeconds": 30,
|
|
"NotificationsEnabled": true
|
|
}
|
|
}' > "$CONFIG_DIR/appsettings.json"
|
|
|
|
# Set proper permissions
|
|
chown -R root:root "$CONFIG_DIR"
|
|
chmod 755 "$CONFIG_DIR"
|
|
chmod 644 "$CONFIG_DIR/appsettings.json"
|
|
|
|
# Build and deploy the application
|
|
print_section "Building application"
|
|
# Check if TransmissionRssManager directory exists directly or as a subdirectory
|
|
if [ -d "$INSTALL_DIR/TransmissionRssManager" ]; then
|
|
PROJECT_DIR="$INSTALL_DIR/TransmissionRssManager"
|
|
elif [ -f "$INSTALL_DIR/TransmissionRssManager.csproj" ]; then
|
|
PROJECT_DIR="$INSTALL_DIR"
|
|
else
|
|
# Look for the .csproj file
|
|
PROJECT_DIR=$(find $INSTALL_DIR -name "*.csproj" -exec dirname {} \; | head -n 1)
|
|
fi
|
|
|
|
echo "Building project from: $PROJECT_DIR"
|
|
cd "$PROJECT_DIR"
|
|
dotnet restore
|
|
dotnet build -c Release
|
|
# Publish as framework-dependent, not self-contained
|
|
dotnet publish -c Release -o $INSTALL_DIR/publish --no-self-contained -f net7.0 -p:PublishSingleFile=false
|
|
|
|
# Copy configuration
|
|
cp "$CONFIG_DIR/appsettings.json" "$INSTALL_DIR/publish/appsettings.json"
|
|
|
|
# No database migrations needed in simplified version
|
|
print_section "Configuration completed"
|
|
echo "No database migrations needed in simplified version."
|
|
|
|
# Create systemd service
|
|
print_section "Creating systemd service"
|
|
# Find the main application DLL
|
|
APP_DLL=$(find $INSTALL_DIR/publish -name "TransmissionRssManager.dll")
|
|
if [ -z "$APP_DLL" ]; then
|
|
APP_DLL=$(find $INSTALL_DIR/publish -name "*.dll" | head -n 1)
|
|
fi
|
|
APP_NAME=$(basename "$APP_DLL" .dll)
|
|
|
|
# Make sure we're using a framework-dependent deployment
|
|
# Create the main application runtimeconfig.json file
|
|
echo '{
|
|
"runtimeOptions": {
|
|
"tfm": "net7.0",
|
|
"framework": {
|
|
"name": "Microsoft.AspNetCore.App",
|
|
"version": "7.0.0"
|
|
},
|
|
"configProperties": {
|
|
"System.GC.Server": true,
|
|
"System.Runtime.TieredCompilation": true
|
|
}
|
|
}
|
|
}' > "$INSTALL_DIR/publish/$APP_NAME.runtimeconfig.json"
|
|
|
|
# Create Microsoft.AspNetCore.OpenApi.runtimeconfig.json file (referenced in error message)
|
|
echo '{
|
|
"runtimeOptions": {
|
|
"tfm": "net7.0",
|
|
"framework": {
|
|
"name": "Microsoft.NETCore.App",
|
|
"version": "7.0.0"
|
|
}
|
|
}
|
|
}' > "$INSTALL_DIR/publish/Microsoft.AspNetCore.OpenApi.runtimeconfig.json"
|
|
|
|
# Create runtimeconfig.dev.json files that are sometimes needed
|
|
echo '{
|
|
"runtimeOptions": {
|
|
"additionalProbingPaths": [
|
|
"/root/.dotnet/store/|arch|/|tfm|",
|
|
"/root/.nuget/packages"
|
|
]
|
|
}
|
|
}' > "$INSTALL_DIR/publish/$APP_NAME.runtimeconfig.dev.json"
|
|
|
|
echo "[Unit]
|
|
Description=Transmission RSS Manager
|
|
After=network.target
|
|
|
|
[Service]
|
|
WorkingDirectory=$INSTALL_DIR/publish
|
|
ExecStart=/usr/bin/dotnet $INSTALL_DIR/publish/$APP_NAME.dll
|
|
Restart=always
|
|
RestartSec=10
|
|
KillSignal=SIGINT
|
|
SyslogIdentifier=transmission-rss-manager
|
|
User=root
|
|
Environment=ASPNETCORE_ENVIRONMENT=Production
|
|
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
|
|
Environment=DOTNET_ROLL_FORWARD=LatestMinor
|
|
Environment=DOTNET_ROOT=/usr/share/dotnet
|
|
Environment=ASPNETCORE_URLS=http://0.0.0.0:5000
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target" > /etc/systemd/system/transmission-rss-manager.service
|
|
|
|
# Reload systemd, enable and start service
|
|
systemctl daemon-reload
|
|
systemctl enable transmission-rss-manager
|
|
systemctl start transmission-rss-manager
|
|
|
|
# Create shortcut
|
|
print_section "Creating application shortcut"
|
|
echo "[Desktop Entry]
|
|
Name=Transmission RSS Manager
|
|
Comment=RSS Feed Manager for Transmission BitTorrent Client
|
|
Exec=xdg-open http://localhost:5000
|
|
Icon=transmission
|
|
Terminal=false
|
|
Type=Application
|
|
Categories=Network;P2P;" > /usr/share/applications/transmission-rss-manager.desktop
|
|
|
|
# Installation complete
|
|
print_section "Installation Complete!"
|
|
echo -e "${GREEN}Transmission RSS Manager has been successfully installed!${NC}"
|
|
echo -e "Web interface: ${YELLOW}http://localhost:5000${NC}"
|
|
echo -e "Configuration file: ${YELLOW}$CONFIG_DIR/appsettings.json${NC}"
|
|
echo -e "Application files: ${YELLOW}$INSTALL_DIR${NC}"
|
|
echo -e "\nTo check service status: ${YELLOW}systemctl status transmission-rss-manager${NC}"
|
|
echo -e "View logs: ${YELLOW}journalctl -u transmission-rss-manager${NC}"
|
|
echo -e "Restart service: ${YELLOW}systemctl restart transmission-rss-manager${NC}" |