From b6d71830944840b101deaa39caff353429283329 Mon Sep 17 00:00:00 2001 From: MasterDraco Date: Wed, 12 Mar 2025 22:02:37 +0000 Subject: [PATCH] Simplify installation script and project dependencies --- TransmissionRssManager.csproj | 5 ++ install.sh | 90 ++++++++++++++++------------------- 2 files changed, 45 insertions(+), 50 deletions(-) diff --git a/TransmissionRssManager.csproj b/TransmissionRssManager.csproj index 1770e74..ad9d2d5 100644 --- a/TransmissionRssManager.csproj +++ b/TransmissionRssManager.csproj @@ -14,6 +14,11 @@ + + + + + diff --git a/install.sh b/install.sh index 263d371..d2803a4 100755 --- a/install.sh +++ b/install.sh @@ -73,27 +73,13 @@ if [ $? -ne 0 ]; then exit 1 fi -# Install PostgreSQL -print_section "Installing PostgreSQL" -if ! command -v psql &> /dev/null; then - echo "Installing PostgreSQL..." - apt-get install -y postgresql postgresql-contrib -else - echo "PostgreSQL is already installed." -fi +# PostgreSQL is not needed in simplified version +print_section "Checking dependencies" +echo "Using simplified version without database dependencies." -# Start PostgreSQL service -systemctl start postgresql -systemctl enable postgresql - -# Install Entity Framework Core tools -print_section "Installing EF Core tools" -if ! su - postgres -c "dotnet tool list -g" | grep "dotnet-ef" > /dev/null; then - echo "Installing Entity Framework Core tools..." - su - postgres -c "dotnet tool install --global dotnet-ef --version 7.0.15" -else - echo "Entity Framework Core tools are already installed." -fi +# 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" @@ -103,45 +89,50 @@ mkdir -p $INSTALL_DIR # Download or clone the application if [ ! -d "$INSTALL_DIR/.git" ]; then echo "Downloading application files..." - # Clone the repository - git clone https://git.powerdata.dk/masterdraco/Torrent-Manager.git $INSTALL_DIR + # 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 database -print_section "Setting up database" -DB_NAME="torrentmanager" -DB_USER="torrentmanager" -DB_PASSWORD=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 16) - -# Check if database exists -DB_EXISTS=$(su - postgres -c "psql -tAc \"SELECT 1 FROM pg_database WHERE datname='$DB_NAME'\"") -if [ "$DB_EXISTS" != "1" ]; then - echo "Creating database and user..." - # Create database and user - su - postgres -c "psql -c \"CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD';\"" - su - postgres -c "psql -c \"CREATE DATABASE $DB_NAME OWNER $DB_USER;\"" - su - postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;\"" -else - echo "Database already exists." -fi - -# Save connection string +# 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 '{ - "ConnectionStrings": { - "DefaultConnection": "Host=localhost;Database='$DB_NAME';Username='$DB_USER';Password='$DB_PASSWORD'" + "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 postgres:postgres "$CONFIG_DIR" -chmod 750 "$CONFIG_DIR" -chmod 640 "$CONFIG_DIR/appsettings.json" +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" @@ -164,10 +155,9 @@ dotnet publish -c Release -o $INSTALL_DIR/publish # Copy configuration cp "$CONFIG_DIR/appsettings.json" "$INSTALL_DIR/publish/appsettings.json" -# Run migrations -print_section "Running database migrations" -cd "$PROJECT_DIR" -dotnet ef database update +# 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"