71 lines
1.7 KiB
Bash
71 lines
1.7 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# Git repository configuration
|
|
GIT_REPO="http://192.168.0.236:3000/masterdraco/torrent"
|
|
REPO_CREDENTIALS="masterdraco:mlvfnj78"
|
|
|
|
# Check root privileges
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "Please run as root"
|
|
exit 1
|
|
fi
|
|
|
|
# Install dependencies
|
|
echo "Checking dependencies..."
|
|
declare -A PKGS=(
|
|
[transmission-cli]="transmission-remote"
|
|
[unrar]="unrar"
|
|
[unzip]="unzip"
|
|
[p7zip-full]="7z"
|
|
[parallel]="parallel"
|
|
[bc]="bc"
|
|
[git]="git"
|
|
)
|
|
|
|
for pkg in "${!PKGS[@]}"; do
|
|
if ! command -v "${PKGS[$pkg]}" &> /dev/null; then
|
|
echo "Installing $pkg..."
|
|
apt-get update
|
|
apt-get install -y "$pkg"
|
|
fi
|
|
done
|
|
|
|
# Create directory structure
|
|
echo "Creating directory structure..."
|
|
mkdir -p /etc/torrent
|
|
mkdir -p /usr/local/bin
|
|
|
|
# Install files
|
|
echo "Installing files..."
|
|
cp -v etc/torrent/mover.conf /etc/torrent/
|
|
cp -v usr/local/bin/torrent-mover /usr/local/bin/
|
|
chmod +x /usr/local/bin/torrent-mover
|
|
|
|
# Set permissions
|
|
echo "Setting permissions..."
|
|
chmod 600 /etc/torrent/mover.conf
|
|
chown root:root /etc/torrent/mover.conf
|
|
|
|
# Initialize Git repository
|
|
if [ ! -d .git ]; then
|
|
echo "Initializing Git repository..."
|
|
git init
|
|
git config user.name "torrent-mover-installer"
|
|
git config user.email "installer@localhost"
|
|
git remote add origin "http://$REPO_CREDENTIALS@192.168.0.236:3000/masterdraco/torrent.git"
|
|
fi
|
|
|
|
# Add files to Git
|
|
git add .
|
|
git commit -m "Initial installation commit" || true
|
|
|
|
# Push to remote repository
|
|
echo "Pushing to Git repository..."
|
|
git push -u origin master
|
|
|
|
echo ""
|
|
echo "Installation complete!"
|
|
echo "Configuration file: /etc/torrent/mover.conf"
|
|
echo "Main script: /usr/local/bin/torrent-mover"
|