Fix remote transmission detection in installer
- Fix bug in dependencies-module.sh that would prompt to install transmission-daemon for remote installations - Add checks for TRANSMISSION_REMOTE flag to correctly handle remote vs local installations - Update version to 2.0.2 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Transmission RSS Manager - Update Script
|
||||
# This script pulls the latest version from git and runs necessary updates
|
||||
|
||||
# Color and formatting
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
BOLD='\033[1m'
|
||||
|
||||
# Installation directory (should be current directory)
|
||||
INSTALL_DIR=$(pwd)
|
||||
|
||||
# Check if we're in the right directory
|
||||
if [ ! -f "$INSTALL_DIR/package.json" ] || [ ! -d "$INSTALL_DIR/modules" ]; then
|
||||
echo -e "${RED}Error: This script must be run from the installation directory.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the current version
|
||||
CURRENT_VERSION=$(grep -oP '"version": "\K[^"]+' package.json)
|
||||
echo -e "${YELLOW}Current version: ${BOLD}$CURRENT_VERSION${NC}"
|
||||
|
||||
# Check for git repository
|
||||
if [ ! -d ".git" ]; then
|
||||
echo -e "${RED}Error: This installation was not set up using git.${NC}"
|
||||
echo -e "Please use the bootstrap installer to perform a fresh installation."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Stash any local changes
|
||||
echo -e "${YELLOW}Backing up any local configuration changes...${NC}"
|
||||
git stash -q
|
||||
|
||||
# Pull the latest changes
|
||||
echo -e "${YELLOW}Pulling latest updates from git...${NC}"
|
||||
git pull
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Failed to pull updates. Restoring original state...${NC}"
|
||||
git stash pop -q
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the new version
|
||||
NEW_VERSION=$(grep -oP '"version": "\K[^"]+' package.json)
|
||||
echo -e "${GREEN}New version: ${BOLD}$NEW_VERSION${NC}"
|
||||
|
||||
# Check if update is needed
|
||||
if [ "$CURRENT_VERSION" == "$NEW_VERSION" ]; then
|
||||
echo -e "${GREEN}You already have the latest version.${NC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Install any new npm dependencies
|
||||
echo -e "${YELLOW}Installing dependencies...${NC}"
|
||||
npm install
|
||||
|
||||
# Apply any local configuration changes
|
||||
if git stash list | grep -q "stash@{0}"; then
|
||||
echo -e "${YELLOW}Restoring local configuration changes...${NC}"
|
||||
git stash pop -q
|
||||
# Handle conflicts if any
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}There were conflicts when restoring your configuration.${NC}"
|
||||
echo -e "Please check the files and resolve conflicts manually."
|
||||
echo -e "Your original configuration is saved in .git/refs/stash"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Restart the service
|
||||
echo -e "${YELLOW}Restarting service...${NC}"
|
||||
if command -v systemctl &> /dev/null; then
|
||||
sudo systemctl restart transmission-rss-manager
|
||||
else
|
||||
echo -e "${RED}Could not restart service automatically.${NC}"
|
||||
echo -e "Please restart the service manually."
|
||||
fi
|
||||
|
||||
# Update complete
|
||||
echo -e "${GREEN}${BOLD}Update complete!${NC}"
|
||||
echo -e "Updated from version $CURRENT_VERSION to $NEW_VERSION"
|
||||
echo -e "Changes will take effect immediately."
|
||||
Reference in New Issue
Block a user