63 lines
2.6 KiB
Bash
63 lines
2.6 KiB
Bash
# Prepare
|
|
# 1. Map FTP to /Downloads
|
|
# 2. Map ssl to /letsencrypt/
|
|
|
|
# Create dirs
|
|
mkdir -p /Downloads/progress
|
|
mkdir -p /Downloads/complete
|
|
mkdir -p /Downloads/torrents
|
|
|
|
# Install
|
|
sh /setup_programs.sh
|
|
apt install -y software-properties-common
|
|
apt install -y deluged deluge-console deluge-web
|
|
|
|
# Prepare for kill process by port
|
|
apt install -y nodejs npm
|
|
mkdir ~/.npm-global
|
|
npm config set prefix '~/.npm-global'
|
|
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile
|
|
source ~/.profile
|
|
node -v
|
|
npm -v
|
|
npm i -g npx
|
|
npx -v
|
|
|
|
# Create deluge group
|
|
adduser --gecos "Deluge Service" --disabled-password --group deluge
|
|
|
|
# Create deluge user for web
|
|
adduser --system --gecos "Deluge User" --disabled-password --ingroup deluge deluge
|
|
|
|
su deluge
|
|
/usr/bin/deluge-web --fork -p 8112
|
|
npx kill-port 8112
|
|
|
|
sed -i 's|"cert": "ssl/daemon.cert",|"cert": "/letsencrypt/?",|g' /home/deluge/.config/deluge/web.conf
|
|
sed -i 's|"pkey": "ssl/daemon.pkey",|"pkey": "/letsencrypt/?",|g' /home/deluge/.config/deluge/web.conf
|
|
sed -i 's|"https": false,|"https": true,|g' /home/deluge/.config/deluge/web.conf
|
|
|
|
# Alter downloads
|
|
for PARAMETERS in movies:58846 music:58847 program:58848 mult:58849 game:58850 series:58852 books:58853 anime:58854 science:58855
|
|
do
|
|
USERNAME=$(echo $PARAMETERS | cut -d ":" -f 1)
|
|
DAEMON_PORT=$(echo $PARAMETERS | cut -d ":" -f 2)
|
|
adduser --system --gecos "Deluge User" --disabled-password --ingroup deluge $USERNAME
|
|
su $USERNAME
|
|
#cd ~
|
|
mkdir -p /Downloads/progress/$USERNAME
|
|
mkdir -p /Downloads/complete/$USERNAME
|
|
mkdir -p /Downloads/torrents/$USERNAME
|
|
# Запуск /usr/bin/deluged
|
|
/usr/bin/deluged --fork -p $DAEMON_PORT
|
|
npx kill-port 8112
|
|
sed -i "s|\"daemon_port\": 58846,|\"daemon_port\": {DAEMON_PORT},|g" /home/$USERNAME/.config/deluge/core.conf
|
|
sed -i 's|"download_location": "/home/{USERNAME}/Downloads",|"download_location": "/Downloads/{USERNAME}/progress",|g' /home/$USERNAME/.config/deluge/core.conf
|
|
sed -i 's|"torrentfiles_location": "/home/{USERNAME}/Downloads",|"torrentfiles_location": "/Downloads/{USERNAME}/torrents",|g' /home/$USERNAME/.config/deluge/core.conf
|
|
sed -i 's|"move_completed": false,|"move_completed": true,|g' /home/$USERNAME/.config/deluge/core.conf
|
|
sed -i 's|"move_completed_path": "/home/{USERNAME}/Downloads",|"move_completed_path": "/Downloads/{USERNAME}/complete",|g' /home/$USERNAME/.config/deluge/core.conf
|
|
sed -i 's|"copy_torrent_file": false,|"copy_torrent_file": true,|g' /home/$USERNAME/.config/deluge/core.conf
|
|
sed -i 's|"allow_remote": false,|"allow_remote": true,|g' /home/$USERNAME/.config/deluge/core.conf
|
|
exit
|
|
done
|