53 lines
1.1 KiB
Bash
53 lines
1.1 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# Git repository configuration
|
|
GIT_REPO="http://192.168.0.236:3000/masterdraco/torrent"
|
|
|
|
# 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
|
|
|
|
# Get files from Repo
|
|
git pull http://192.168.0.236:3000/masterdraco/torrent.git
|
|
|
|
|
|
# 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
|
|
|