Update to Support Deluge install
This commit is contained in:
parent
a5fb28a2e5
commit
5a1b65c5e6
|
@ -1,197 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Update Installed Packages & Installing Essential Packages
|
||||
function Update {
|
||||
tput setaf 2; echo "Updating installed packages and install prerequisite"
|
||||
tput setaf 7
|
||||
apt-get -qqy update && apt-get -qqy upgrade
|
||||
apt-get -qqy install sudo
|
||||
apt-get -qqy install sysstat
|
||||
cd $HOME
|
||||
clear
|
||||
tput setaf 1
|
||||
}
|
||||
|
||||
## qBittorrent
|
||||
function qBittorrent_download {
|
||||
tput setaf 2; echo "Please enter your choice (qBittorrent Version - libtorrent Version):"
|
||||
options=("qBittorrent 4.1.9 - libtorrent-1_1_14" "qBittorrent 4.1.9.1 - libtorrent-1_1_14" "qBittorrent 4.3.3 - libtorrent-v1.2.12-Lactency" "qBittorrent 4.3.3 - libtorrent-v1.2.13" "qBittorrent 4.3.4.1 - libtorrent-v1.2.12-Lactency" "qBittorrent 4.3.4.1 - libtorrent-v1.2.13" "qBittorrent 4.3.5 - libtorrent-v1.2.13")
|
||||
select opt in "${options[@]}"
|
||||
do
|
||||
case $opt in
|
||||
"qBittorrent 4.1.9 - libtorrent-1_1_14")
|
||||
version=4.1.9; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/qBittorrent/qBittorrent%204.1.9%20-%20libtorrent-1_1_14/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.1.9.1 - libtorrent-1_1_14")
|
||||
version=4.1.9.1; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/qBittorrent/qBittorrent%204.1.9.1%20-%20libtorrent-1_1_14/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.3.3 - libtorrent-v1.2.12-Lactency")
|
||||
version=4.3.3; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/qBittorrent/qBittorrent%204.3.3%20-%20libtorrent-v1.2.12-Lactency/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.3.3 - libtorrent-v1.2.13")
|
||||
version=4.3.3; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/qBittorrent/qBittorrent%204.3.3%20-%20libtorrent-v1.2.13/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.3.4.1 - libtorrent-v1.2.13-Lactency")
|
||||
version=4.3.4.1; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/qBittorrent/qBittorrent%204.3.4.1%20-%20libtorrent-v1.2.12-Lactency/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.3.4.1 - libtorrent-v1.2.13")
|
||||
version=4.3.4.1; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/qBittorrent/qBittorrent%204.3.4.1%20-%20libtorrent-v1.2.13/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.3.5 - libtorrent-v1.2.13")
|
||||
version=4.3.5; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/qBittorrent/qBittorrent%204.3.5%20-%20libtorrent-v1.2.13/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
*) tput setaf 1; echo "Please choose a valid version";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function qBittorrent_install {
|
||||
tput setaf 1
|
||||
test -e /usr/bin/qbittorrent-nox && rm /usr/bin/qbittorrent-nox
|
||||
mv $HOME/qbittorrent-nox /usr/bin/qbittorrent-nox
|
||||
test -e /etc/systemd/system/qbittorrent-nox@.service && rm /etc/systemd/system/qbittorrent-nox@.service
|
||||
touch /etc/systemd/system/qbittorrent-nox@.service
|
||||
cat << EOF >/etc/systemd/system/qbittorrent-nox@.service
|
||||
[Unit]
|
||||
Description=qBittorrent
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=$username
|
||||
LimitNOFILE=infinity
|
||||
ExecStart=/usr/bin/qbittorrent-nox -d
|
||||
ExecStop=/usr/bin/killall -w -s 9 /usr/bin/qbittorrent-nox
|
||||
Restart=on-failure
|
||||
TimeoutStopSec=20
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
sudo -u $username mkdir -p /home/$username/qbittorrent/Downloads
|
||||
mkdir -p /home/$username/.config/qBittorrent && chown $username /home/$username/.config/qBittorrent
|
||||
systemctl enable qbittorrent-nox@$username
|
||||
systemctl start qbittorrent-nox@$username
|
||||
}
|
||||
function qBittorrent_config {
|
||||
systemctl stop qbittorrent-nox@$username
|
||||
if [[ "${version}" =~ "4.1." ]]; then
|
||||
md5password=$(echo -n $password | md5sum | awk '{print $1}')
|
||||
cat << EOF >/home/$username/.config/qBittorrent/qBittorrent.conf
|
||||
[LegalNotice]
|
||||
Accepted=true
|
||||
|
||||
[Network]
|
||||
Cookies=@Invalid()
|
||||
|
||||
[Preferences]
|
||||
Connection\PortRangeMin=45000
|
||||
Downloads\DiskWriteCacheSize=$Cache2
|
||||
Downloads\SavePath=/home/$username/qbittorrent/Downloads/
|
||||
Queueing\QueueingEnabled=false
|
||||
WebUI\Password_ha1=@ByteArray($md5password)
|
||||
WebUI\Port=8080
|
||||
WebUI\Username=$username
|
||||
EOF
|
||||
elif [[ "${version}" =~ "4.2."|"4.3." ]]; then
|
||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Miscellaneous/qb_password_gen && chmod +x $HOME/qb_password_gen
|
||||
PBKDF2password=$($HOME/qb_password_gen $password)
|
||||
cat << EOF >/home/$username/.config/qBittorrent/qBittorrent.conf
|
||||
[LegalNotice]
|
||||
Accepted=true
|
||||
|
||||
[Network]+
|
||||
Cookies=@Invalid()
|
||||
|
||||
[Preferences]
|
||||
Connection\PortRangeMin=45000
|
||||
Downloads\DiskWriteCacheSize=$Cache2
|
||||
Downloads\SavePath=/home/$username/qbittorrent/Downloads/
|
||||
Queueing\QueueingEnabled=false
|
||||
WebUI\Password_PBKDF2="@ByteArray($PBKDF2password)"
|
||||
WebUI\Port=8080
|
||||
WebUI\Username=$username
|
||||
EOF
|
||||
rm qb_password_gen
|
||||
fi
|
||||
systemctl start qbittorrent-nox@$username
|
||||
}
|
||||
|
||||
function qBittorrent {
|
||||
qBittorrent_download
|
||||
qBittorrent_install
|
||||
qBittorrent_config
|
||||
qbport=$(grep -F 'WebUI\Port' /home/$username/.config/qBittorrent/qBittorrent.conf | grep -Eo '[0-9]{1,5}')
|
||||
clear
|
||||
tput setaf 2
|
||||
}
|
||||
|
||||
## Install autoremove-torrents
|
||||
function Decision2 {
|
||||
while true; do
|
||||
tput setaf 2; read -p "Do you wish to config autoremove-torrents for $1? (Y/N):" yn
|
||||
case $yn in
|
||||
[Yy]* ) e=0; break;;
|
||||
[Nn]* ) e=1; break;;
|
||||
* ) tput setaf 1; echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function autoremove-torrents {
|
||||
tput setaf 7
|
||||
apt-get -qqy install python3-distutils
|
||||
apt-get -qqy install python3-apt
|
||||
apt-get -qqy install curl
|
||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||
python3 get-pip.py
|
||||
rm get-pip.py
|
||||
pip -q install autoremove-torrents
|
||||
clear
|
||||
tput setaf 2
|
||||
read -p "Enter desired reserved storage (in GiB): " diskspace
|
||||
read -p "Enter desired minimum seedtime (in Second): " seedtime
|
||||
# qBittorrent
|
||||
tput setaf 2
|
||||
unset e
|
||||
if [ -z ${qbport+x} ]; then echo "Skipping qBittorrent since it is not installed"; else Decision2 qBittorrent; fi
|
||||
if [ "${e}" == "0" ]; then
|
||||
touch $HOME/.config.yml
|
||||
cat << EOF >>$HOME/.config.yml
|
||||
General-qb:
|
||||
client: qbittorrent
|
||||
host: http://127.0.0.1:$qbport
|
||||
username: $username
|
||||
password: $password
|
||||
strategies:
|
||||
Upload:
|
||||
status:
|
||||
- Uploading
|
||||
remove: upload_speed < 1024 and seeding_time > $seedtime
|
||||
Leech:
|
||||
status:
|
||||
- Downloading
|
||||
remove: ratio < 1 and progress > 5 and download_speed > 20480
|
||||
Disk:
|
||||
free_space:
|
||||
min: $diskspace
|
||||
path: /
|
||||
action: remove-old-seeds
|
||||
delete_data: true
|
||||
EOF
|
||||
fi
|
||||
sed -i 's+127.0.0.1: +127.0.0.1:+g' $HOME/.config.yml
|
||||
mkdir $HOME/.autoremove-torrents
|
||||
chmod 755 $HOME/.autoremove-torrents
|
||||
touch $HOME/.autoremove.sh
|
||||
cat << EOF >$HOME/.autoremove.sh
|
||||
#!/bin/sh
|
||||
|
||||
while true; do
|
||||
/usr/local/bin/autoremove-torrents --conf=$HOME/.config.yml --log=$HOME/.autoremove-torrents
|
||||
sleep 5
|
||||
done
|
||||
EOF
|
||||
chmod +x $HOME/.autoremove.sh
|
||||
apt-get -qqy install screen > /dev/null
|
||||
screen -dmS autoremove-torrents $HOME/.autoremove.sh
|
||||
}
|
21
BBR/BBR.sh
21
BBR/BBR.sh
|
@ -1,21 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
clear
|
||||
|
||||
## Check Root Privilege
|
||||
if [ $(id -u) -ne 0 ]; then
|
||||
tput setaf 1; echo "This script needs root permission to run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## Installing BBR
|
||||
cd $HOME
|
||||
clear
|
||||
curl -s -O https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/.tweaking.sh && source .tweaking.sh
|
||||
BBR_Tweaking
|
||||
|
||||
## Clear
|
||||
rm BBR.sh
|
||||
rm .tweaking.sh
|
||||
|
||||
echo "Tweaked BBR Installation Complete"
|
|
@ -0,0 +1,94 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
function BBR_Install {
|
||||
## This part of the script is modified from https://github.com/KozakaiAya/TCP_BBR
|
||||
apt-get -qqy install dkms
|
||||
apt-get -qqy install linux-headers-$(uname -r)
|
||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/BBR/5.10.0/tcp_bbrx.c
|
||||
kernel_ver=5.10.0
|
||||
algo=bbrx
|
||||
bbr_file=tcp_$algo
|
||||
bbr_src=$bbr_file.c
|
||||
bbr_obj=$bbr_file.o
|
||||
|
||||
mkdir -p $HOME/.bbr/src
|
||||
cd $HOME/.bbr/src
|
||||
|
||||
mv $HOME/$bbr_src $HOME/.bbr/src/$bbr_src
|
||||
|
||||
# Create Makefile
|
||||
cat > ./Makefile << EOF
|
||||
obj-m:=$bbr_obj
|
||||
|
||||
default:
|
||||
make -C /lib/modules/\$(shell uname -r)/build M=\$(PWD)/src modules
|
||||
|
||||
clean:
|
||||
-rm modules.order
|
||||
-rm Module.symvers
|
||||
-rm .[!.]* ..?*
|
||||
-rm $bbr_file.mod
|
||||
-rm $bbr_file.mod.c
|
||||
-rm *.o
|
||||
-rm *.cmd
|
||||
EOF
|
||||
|
||||
# Create dkms.conf
|
||||
cd ..
|
||||
cat > ./dkms.conf << EOF
|
||||
MAKE="'make' -C src/"
|
||||
CLEAN="make -C src/ clean"
|
||||
BUILT_MODULE_NAME=$bbr_file
|
||||
BUILT_MODULE_LOCATION=src/
|
||||
DEST_MODULE_LOCATION=/updates/net/ipv4
|
||||
PACKAGE_NAME=$algo
|
||||
PACKAGE_VERSION=$kernel_ver
|
||||
REMAKE_INITRD=yes
|
||||
EOF
|
||||
|
||||
# Start dkms install
|
||||
cp -R . /usr/src/$algo-$kernel_ver
|
||||
|
||||
dkms add -m $algo -v $kernel_ver
|
||||
if [ ! $? -eq 0 ]; then
|
||||
dkms remove -m $algo/$kernel_ver --all
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dkms build -m $algo -v $kernel_ver
|
||||
if [ ! $? -eq 0 ]; then
|
||||
dkms remove -m $algo/$kernel_ver --all
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dkms install -m $algo -v $kernel_ver
|
||||
if [ ! $? -eq 0 ]; then
|
||||
dkms remove -m $algo/$kernel_ver --all
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test loading module
|
||||
modprobe $bbr_file
|
||||
if [ ! $? -eq 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Auto-load kernel module at system startup
|
||||
echo $bbr_file | sudo tee -a /etc/modules
|
||||
sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf
|
||||
echo "net.ipv4.tcp_congestion_control = $algo" >> /etc/sysctl.conf
|
||||
sysctl -p > /dev/null
|
||||
|
||||
cd $HOME
|
||||
rm -r $HOME/.bbr
|
||||
}
|
||||
|
||||
## Installing BBR
|
||||
cd $HOME
|
||||
BBR_Install
|
||||
|
||||
## Clear
|
||||
systemctl disable bbrinstall.service
|
||||
rm /etc/systemd/system/bbrinstall.service
|
||||
rm BBR.sh
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
function warn_1 {
|
||||
tput sgr0; tput setb 4; tput bold
|
||||
}
|
||||
|
||||
function warn_2 {
|
||||
tput sgr0; tput setaf 1
|
||||
}
|
||||
|
||||
function normal_1 {
|
||||
tput sgr0; tput setb 2; tput bold
|
||||
}
|
||||
|
||||
function normal_2 {
|
||||
tput sgr0; tput setaf 3; tput dim
|
||||
}
|
||||
|
||||
function normal_3 {
|
||||
tput sgr0; tput setaf 6
|
||||
}
|
||||
|
||||
function normal_4 {
|
||||
tput sgr0
|
||||
}
|
||||
|
||||
function need_input [
|
||||
tput sgr0; tput setb 5; tput bold
|
||||
]
|
|
@ -8,6 +8,8 @@ qBittorrent Install - https://github.com/userdocs/qbittorrent-nox-static
|
|||
|
||||
qBittorrent Password Set - https://github.com/KozakaiAya/libqbpasswd & https://amefs.net/archives/2027.html
|
||||
|
||||
Deluge Password Set - https://github.com/amefs/quickbox-lite
|
||||
|
||||
autoremove-torrents - https://github.com/jerrymakesjelly/autoremove-torrents
|
||||
|
||||
BBR Install - https://github.com/KozakaiAya/TCP_BBR
|
||||
|
|
|
@ -0,0 +1,256 @@
|
|||
libtorrent_Ver=1.1.14
|
||||
Deluge_Ver=1.3.15
|
||||
|
||||
function Deluge_download {
|
||||
normal_1; echo "Downloading Deluge and its dependencies"; normal_2
|
||||
if [[ "${Deluge_Ver}" =~ "1.3." ]]; then
|
||||
wget -4 http://download.deluge-torrent.org/source/deluge-$Deluge_Ver.tar.xz
|
||||
apt-get -qqy install libboost-all-dev libboost-dev python python-twisted python-openssl python-setuptools intltool python-xdg python-chardet geoip-database python-notify python-pygame python-glade2 librsvg2-common xdg-utils python-mako
|
||||
# elif [[ "${Deluge_Ver}" =~ "2.0." ]]; then
|
||||
# wget -4 http://download.deluge-torrent.org/source/2.0/deluge-$Deluge_Ver.tar.xz
|
||||
# apt-get -qqy install python3-geoip python3-dbus python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-appindicator3 python3-pygame libnotify4 librsvg2-common xdg-utils
|
||||
fi
|
||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/Deluge/libtorrent/libtorrent-rasterbar_$libtorrent_Ver-amd64.deb
|
||||
tput sgr0; clear
|
||||
}
|
||||
|
||||
function Deluge_install {
|
||||
normal_1; echo "Installing Deluge"; normal_2
|
||||
## Installing Libtorrent
|
||||
dpkg -r libtorrent-rasterbar
|
||||
dpkg -i /root/libtorrent-rasterbar_$libtorrent_Ver-amd64.deb && rm /root/libtorrent-rasterbar_$libtorrent_Ver-amd64.deb
|
||||
ldconfig
|
||||
if [ ! $? -eq 0 ]; then
|
||||
warn_1; echo "Libtorrent install failed"; normal_4
|
||||
exit 1
|
||||
fi
|
||||
## Installing Deluge
|
||||
test -e $HOME/deluge-$Deluge_Ver && rm -r $HOME/deluge-$Deluge_Ver
|
||||
tar xf deluge-$Deluge_Ver.tar.xz && rm /root/deluge-$Deluge_Ver.tar.xz && cd deluge-$Deluge_Ver
|
||||
python setup.py clean -a
|
||||
python setup.py build
|
||||
if [ ! $? -eq 0 ]; then
|
||||
warn_1; echo "Deluge build failed"; normal_4
|
||||
exit 1
|
||||
fi
|
||||
python setup.py install
|
||||
if [ ! $? -eq 0 ]; then
|
||||
warn_1; echo "Deluge install failed"; normal_4
|
||||
exit 1
|
||||
fi
|
||||
cd $HOME && rm -r deluge-$Deluge_Ver
|
||||
## Creating systemd services
|
||||
cat << EOF > /etc/systemd/system/deluged@.service
|
||||
[Unit]
|
||||
Description=Deluge-Daemon
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
UMask=002
|
||||
User=$username
|
||||
LimitNOFILE=infinity
|
||||
ExecStart=/usr/local/bin/deluged -d
|
||||
ExecStop=/usr/bin/killall -w -s 9 /usr/bin/deluged
|
||||
Restart=on-failure
|
||||
TimeoutStopSec=20
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat << EOF > /etc/systemd/system/deluge-web@.service
|
||||
[Unit]
|
||||
Description=Deluge-WebUI
|
||||
After=network-online.target deluged.service
|
||||
Wants=deluged.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=$username
|
||||
ExecStart=/usr/local/bin/deluge-web
|
||||
ExecStop=/usr/bin/killall -w -s 9 /usr/bin/deluge-web
|
||||
TimeoutStopSec=5
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
mkdir -p /home/$username/deluge/completed /home/$username/deluge/download /home/$username/deluge/torrent && chown -R $username /home/$username/deluge
|
||||
mkdir -p /home/$username/.config/deluge/plugins
|
||||
systemctl enable deluged@$username && systemctl start deluged@$username
|
||||
systemctl enable deluge-web@$username && systemctl start deluge-web@$username
|
||||
}
|
||||
|
||||
function Deluge_config
|
||||
systemctl stop deluged@$username && systemctl stop deluge-web@$username
|
||||
## Setting up auth file
|
||||
echo "$username:$password:10" >> /home/$username/.config/deluge/auth
|
||||
|
||||
## Setting up Daemon config
|
||||
cat << EOF >/home/$username/.config/deluge/core.conf
|
||||
{
|
||||
"file": 1,
|
||||
"format": 1
|
||||
}{
|
||||
"info_sent": 0.0,
|
||||
"lsd": false,
|
||||
"send_info": false,
|
||||
"move_completed_path": "/home/$username/deluge/completed",
|
||||
"enc_in_policy": 1,
|
||||
"queue_new_to_top": false,
|
||||
"ignore_limits_on_local_network": true,
|
||||
"rate_limit_ip_overhead": true,
|
||||
"daemon_port": 58846,
|
||||
"natpmp": false,
|
||||
"max_active_limit": -1,
|
||||
"utpex": false,
|
||||
"max_active_downloading": -1,
|
||||
"max_active_seeding": -1,
|
||||
"allow_remote": true,
|
||||
"max_half_open_connections": -1,
|
||||
"download_location": "/home/$username/deluge/download",
|
||||
"compact_allocation": false,
|
||||
"max_upload_speed": -1.0,
|
||||
"cache_expiry": 300
|
||||
"prioritize_first_last_pieces": false,
|
||||
"auto_managed": true,
|
||||
"enc_level": 2,
|
||||
"max_connections_per_second": -1,
|
||||
"dont_count_slow_torrents": true,
|
||||
"random_outgoing_ports": true,
|
||||
"max_upload_slots_per_torrent": -1,
|
||||
"new_release_check": false,
|
||||
"enc_out_policy": 1,
|
||||
"outgoing_ports": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"seed_time_limit": -1
|
||||
"cache_size": $Cache1,
|
||||
"share_ratio_limit": -1.0,
|
||||
"max_download_speed": -1.0,
|
||||
"geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
|
||||
"torrentfiles_location": "/home/$username/deluge/torrent",
|
||||
"stop_seed_at_ratio": false,
|
||||
"peer_tos": "0xB8",
|
||||
"listen_interface": "",
|
||||
"upnp": false,
|
||||
"max_download_speed_per_torrent": -1,
|
||||
"max_upload_slots_global": -1,
|
||||
"enabled_plugins": [
|
||||
"ltConfig"
|
||||
],
|
||||
"random_port": true,
|
||||
"autoadd_enable": true,
|
||||
"max_connections_global": -1,
|
||||
"enc_prefer_rc4": false,
|
||||
"listen_ports": [
|
||||
6881,
|
||||
6891
|
||||
],
|
||||
"dht": false,
|
||||
"stop_seed_ratio": 2.0,
|
||||
"seed_time_ratio_limit": -1.0,
|
||||
"max_upload_speed_per_torrent": -1,
|
||||
"copy_torrent_file": true,
|
||||
"del_copy_torrent_file": false,
|
||||
"move_completed": false,
|
||||
"proxies": {
|
||||
"peer": {
|
||||
"username": "",
|
||||
"password": "",
|
||||
"type": 0,
|
||||
"hostname": "",
|
||||
"port": 8080
|
||||
},
|
||||
"web_seed": {
|
||||
"username": "",
|
||||
"password": "",
|
||||
"type": 0,
|
||||
"hostname": "",
|
||||
"port": 8080
|
||||
},
|
||||
"tracker": {
|
||||
"username": "",
|
||||
"password": "",
|
||||
"type": 0,
|
||||
"hostname": "",
|
||||
"port": 8080
|
||||
},
|
||||
"dht": {
|
||||
"username": "",
|
||||
"password": "",
|
||||
"type": 0,
|
||||
"hostname": "",
|
||||
"port": 8080
|
||||
}
|
||||
},
|
||||
"add_paused": false,
|
||||
"max_connections_per_torrent": -1,
|
||||
"remove_seed_at_ratio": false,
|
||||
"autoadd_location": "/home/$username/deluge/watch/",
|
||||
"plugins_location": "/home/$username/.config/deluge/plugins"
|
||||
}
|
||||
EOF
|
||||
|
||||
## Setting up WebUI config
|
||||
DWSALT=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)
|
||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/Deluge/deluge.Userpass.py
|
||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/Deluge/deluge.addHost.py
|
||||
DWP=$(python2 /root/deluge.Userpass.py $password $DWSALT)
|
||||
DUDID=$(python2 /root/deluge.addHost.py)
|
||||
cat << EOF >/home/$username/.config/deluge/web.conf
|
||||
{
|
||||
"file": 1,
|
||||
"format": 1
|
||||
}{
|
||||
"port": 8112,
|
||||
"enabled_plugins": [
|
||||
"ltConfig"
|
||||
],
|
||||
"pwd_sha1": "$DWP",
|
||||
"theme": "gray",
|
||||
"show_sidebar": true,
|
||||
"sidebar_show_zero": false,
|
||||
"pkey": "ssl/daemon.pkey",
|
||||
"https": false,
|
||||
"sessions": {},
|
||||
"base": "/",
|
||||
"pwd_salt": "$DWSALT",
|
||||
"show_session_speed": true,
|
||||
"first_login": false,
|
||||
"cert": "ssl/daemon.cert",
|
||||
"session_timeout": 3600,
|
||||
"default_daemon": "$DUDID",
|
||||
"sidebar_multiple_filters": true
|
||||
}
|
||||
EOF
|
||||
rm /root/deluge.Userpass.py /root/deluge.addHost.py
|
||||
|
||||
## Setting up Hostlist
|
||||
cat << EOF > /home/$username/.config/deluge/hostlist.conf.1.2
|
||||
{
|
||||
"file": 1,
|
||||
"format": 1
|
||||
}{
|
||||
"hosts": [
|
||||
[
|
||||
"$DUDID",
|
||||
"127.0.0.1",
|
||||
58846,
|
||||
"$username",
|
||||
"$password"
|
||||
]
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
## Setting up plugins
|
||||
cd /home/$username/.config/deluge/plugins
|
||||
wget https://github.com/ratanakvlun/deluge-ltconfig/releases/download/v0.3.1/ltConfig-0.3.1-py2.7.egg
|
||||
cd $HOME
|
||||
chown -R $username /home/$username/.config/deluge
|
||||
systemctl start deluged@$username && systemctl start deluge-web@$username
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
# Obtain from https://github.com/amefs/quickbox-lite
|
||||
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Deluge password generator
|
||||
#
|
||||
# deluge.password.py <password> <salt>
|
||||
#
|
||||
#
|
||||
|
||||
import hashlib
|
||||
import sys
|
||||
|
||||
password = sys.argv[1]
|
||||
salt = sys.argv[2]
|
||||
|
||||
s = hashlib.sha1()
|
||||
s.update(salt)
|
||||
s.update(password)
|
||||
|
||||
print s.hexdigest()
|
|
@ -0,0 +1,14 @@
|
|||
# Obtain from https://github.com/amefs/quickbox-lite
|
||||
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Deluge hostlist id generator
|
||||
#
|
||||
# deluge.addHost.py
|
||||
#
|
||||
#
|
||||
import hashlib
|
||||
import sys
|
||||
import time
|
||||
|
||||
print hashlib.sha1(str(time.time())).hexdigest()
|
Binary file not shown.
|
@ -3,7 +3,7 @@
|
|||
|
||||
The patches used in compile can be found [here](https://github.com/jerry048/Patch)
|
||||
|
||||
The script used to compile the build is [userdocs' script](https://github.com/userdocs/qbittorrent-nox-static)
|
||||
The script used to compile the build is [userdocs' qbittorrent-nox-static script](https://github.com/userdocs/qbittorrent-nox-static)
|
||||
|
||||
Could be used in both Dedicated Seedbox & Shared Seedbox
|
||||
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,108 @@
|
|||
function qBittorrent_download {
|
||||
need_input; echo "Please enter your choice (qBittorrent Version - libtorrent Version):"; normal_3
|
||||
options=("qBittorrent 4.1.9 - libtorrent-1_1_14" "qBittorrent 4.1.9.1 - libtorrent-1_1_14" "qBittorrent 4.3.3 - libtorrent-v1.2.13" "qBittorrent 4.3.4.1 - libtorrent-v1.2.13" "qBittorrent 4.3.5 - libtorrent-v1.2.13" "qBittorrent 4.3.6 - libtorrent-v1.2.14" "qBittorrent 4.4.0beta1 - libtorrent-v2.0.4")
|
||||
select opt in "${options[@]}"
|
||||
do
|
||||
case $opt in
|
||||
"qBittorrent 4.1.9 - libtorrent-1_1_14")
|
||||
version=4.1.9; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qBittorrent/qBittorrent%204.1.9%20-%20libtorrent-1_1_14/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.1.9.1 - libtorrent-1_1_14")
|
||||
version=4.1.9.1; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qBittorrent/qBittorrent%204.1.9.1%20-%20libtorrent-1_1_14/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.3.3 - libtorrent-v1.2.13")
|
||||
version=4.3.3; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qBittorrent/qBittorrent%204.3.3%20-%20libtorrent-v1.2.13/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.3.4.1 - libtorrent-v1.2.13")
|
||||
version=4.3.4.1; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qBittorrent/qBittorrent%204.3.4.1%20-%20libtorrent-v1.2.13/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.3.5 - libtorrent-v1.2.13")
|
||||
version=4.3.5; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qBittorrent/qBittorrent%204.3.5%20-%20libtorrent-v1.2.13/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.3.6 - libtorrent-v1.2.14")
|
||||
version=4.3.6; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qBittorrent/qBittorrent%204.3.6%20-%20libtorrent-v1.2.14/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
"qBittorrent 4.4.0 - libtorrent-v2.0.4")
|
||||
version=4.4.0; wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qBittorrent/qBittorrent%204.4.0beta1%20-%20libtorrent-v2.0.4/qbittorrent-nox && chmod +x $HOME/qbittorrent-nox; break
|
||||
;;
|
||||
*) warn_1; echo "Please choose a valid version"; normal_3;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function qBittorrent_install {
|
||||
normal_2
|
||||
## Shut down qBittorrent if it has been already installed
|
||||
pgrep -i -f qbittorrent && pkill -s $(pgrep -i -f qbittorrent)
|
||||
test -e /usr/bin/qbittorrent-nox && rm /usr/bin/qbittorrent-nox
|
||||
mv $HOME/qbittorrent-nox /usr/bin/qbittorrent-nox
|
||||
## Creating systemd services
|
||||
test -e /etc/systemd/system/qbittorrent-nox@.service && rm /etc/systemd/system/qbittorrent-nox@.service
|
||||
touch /etc/systemd/system/qbittorrent-nox@.service
|
||||
cat << EOF >/etc/systemd/system/qbittorrent-nox@.service
|
||||
[Unit]
|
||||
Description=qBittorrent
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=$username
|
||||
LimitNOFILE=infinity
|
||||
ExecStart=/usr/bin/qbittorrent-nox -d
|
||||
ExecStop=/usr/bin/killall -w -s 9 /usr/bin/qbittorrent-nox
|
||||
Restart=on-failure
|
||||
TimeoutStopSec=20
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
mkdir -p /home/$username/qbittorrent/Downloads && chown $username /home/$username/qbittorrent/Downloads
|
||||
mkdir -p /home/$username/.config/qBittorrent && chown $username /home/$username/.config/qBittorrent
|
||||
systemctl enable qbittorrent-nox@$username
|
||||
systemctl start qbittorrent-nox@$username
|
||||
}
|
||||
|
||||
function qBittorrent_config {
|
||||
systemctl stop qbittorrent-nox@$username
|
||||
if [[ "${version}" =~ "4.1." ]]; then
|
||||
md5password=$(echo -n $password | md5sum | awk '{print $1}')
|
||||
cat << EOF >/home/$username/.config/qBittorrent/qBittorrent.conf
|
||||
[LegalNotice]
|
||||
Accepted=true
|
||||
|
||||
[Network]
|
||||
Cookies=@Invalid()
|
||||
|
||||
[Preferences]
|
||||
Connection\PortRangeMin=45000
|
||||
Downloads\DiskWriteCacheSize=$Cache2
|
||||
Downloads\SavePath=/home/$username/qbittorrent/Downloads/
|
||||
Queueing\QueueingEnabled=false
|
||||
WebUI\Password_ha1=@ByteArray($md5password)
|
||||
WebUI\Port=8080
|
||||
WebUI\Username=$username
|
||||
EOF
|
||||
elif [[ "${version}" =~ "4.2."|"4.3."|"4.4." ]]; then
|
||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qb_password_gen && chmod +x $HOME/qb_password_gen
|
||||
PBKDF2password=$($HOME/qb_password_gen $password)
|
||||
cat << EOF >/home/$username/.config/qBittorrent/qBittorrent.conf
|
||||
[LegalNotice]
|
||||
Accepted=true
|
||||
|
||||
[Network]+
|
||||
Cookies=@Invalid()
|
||||
|
||||
[Preferences]
|
||||
Connection\PortRangeMin=45000
|
||||
Downloads\DiskWriteCacheSize=$Cache2
|
||||
Downloads\SavePath=/home/$username/qbittorrent/Downloads/
|
||||
Queueing\QueueingEnabled=false
|
||||
WebUI\Password_PBKDF2="@ByteArray($PBKDF2password)"
|
||||
WebUI\Port=8080
|
||||
WebUI\Username=$username
|
||||
EOF
|
||||
rm qb_password_gen
|
||||
fi
|
||||
systemctl start qbittorrent-nox@$username
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,135 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Update Installed Packages & Installing Essential Packages
|
||||
function Update {
|
||||
normal_1; echo "Updating installed packages and install prerequisite"
|
||||
normal_2
|
||||
apt-get -qqy update && apt-get -qqy upgrade
|
||||
apt-get -qqy install sudo sysstat
|
||||
cd $HOME
|
||||
tput sgr0; clear
|
||||
}
|
||||
|
||||
## qBittorrent
|
||||
function qBittorrent {
|
||||
normal_1; echo "qBittorrent"; warn_2
|
||||
source <(wget -qO- https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qBittorrent_install.sh)
|
||||
qBittorrent_download
|
||||
qBittorrent_install
|
||||
qBittorrent_config
|
||||
qbport=$(grep -F 'WebUI\Port' /home/$username/.config/qBittorrent/qBittorrent.conf | grep -Eo '[0-9]{1,5}')
|
||||
tput sgr0; clear
|
||||
}
|
||||
|
||||
## Deluge
|
||||
function Deluge {
|
||||
normal_1; echo "Deluge"; warn_2
|
||||
source <(wget -qO- https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/Deluge/Deluge_install.sh)
|
||||
Deluge_download
|
||||
Deluge_install
|
||||
Deluge_config
|
||||
deport=$(cat /home/$username/.config/deluge/core.conf | grep daemon_port | grep -Eo '[0-9]{1,5}')
|
||||
tput sgr0; clear
|
||||
}
|
||||
|
||||
## autoremove-torrents
|
||||
function Decision2 {
|
||||
while true; do
|
||||
need_input; read -p "Do you wish to config autoremove-torrents for $1? (Y/N):" yn; normal_3
|
||||
case $yn in
|
||||
[Yy]* ) e=0; break;;
|
||||
[Nn]* ) e=1; echo "Skipping"; break;;
|
||||
* ) warn_1; echo "Please answer yes or no."; normal_3;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function autoremove-torrents {
|
||||
normal_2
|
||||
apt-get -qqy install python3-distutils python3-apt
|
||||
[[ $(pip --version) ]] || (apt-get -qqy install curl && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py && rm get-pip.py )
|
||||
pip -q install autoremove-torrents
|
||||
tput sgr0; clear
|
||||
need_input
|
||||
read -p "Enter desired reserved storage (in GiB): " diskspace
|
||||
read -p "Enter desired minimum seedtime (in Second): " seedtime
|
||||
# Deluge
|
||||
normal_2
|
||||
unset e
|
||||
if [ -z ${deport+x} ]; then echo "Skipping Deluge since it is not installed"; else Decision2 Deluge; fi
|
||||
if [ "${e}" == "0" ]; then
|
||||
normal_1; echo "Configuring autoremove-torrents for Deluge"
|
||||
warn_2
|
||||
touch $HOME/.config.yml
|
||||
cat << EOF >>$HOME/.config.yml
|
||||
General-de:
|
||||
client: Deluge
|
||||
host: 127.0.0.1:$deport
|
||||
username: $username
|
||||
password: $password
|
||||
strategies:
|
||||
Upload:
|
||||
status:
|
||||
- Uploading
|
||||
remove: upload_speed < 1024 and seeding_time > $seedtime
|
||||
Disk:
|
||||
free_space:
|
||||
min: $diskspace
|
||||
path: /home/$username/
|
||||
action: remove-old-seeds
|
||||
delete_data: true
|
||||
M-Team-de:
|
||||
client: Deluge
|
||||
host: 127.0.0.1:$deport
|
||||
username: $username
|
||||
password: $password
|
||||
strategies:
|
||||
Ratio:
|
||||
trackers:
|
||||
- tracker.m-team.cc
|
||||
upload_ratio: 3
|
||||
delete_data: true
|
||||
EOF
|
||||
fi
|
||||
# qBittorrent
|
||||
normal_2
|
||||
unset e
|
||||
if [ -z ${qbport+x} ]; then echo "Skipping qBittorrent since it is not installed"; else Decision2 qBittorrent; fi
|
||||
if [ "${e}" == "0" ]; then
|
||||
normal_1; echo "Configuring autoremove-torrents for qBittorrent"
|
||||
warn_2
|
||||
touch $HOME/.config.yml
|
||||
cat << EOF >>$HOME/.config.yml
|
||||
General-qb:
|
||||
client: qbittorrent
|
||||
host: http://127.0.0.1:$qbport
|
||||
username: $username
|
||||
password: $password
|
||||
strategies:
|
||||
Upload:
|
||||
status:
|
||||
- Uploading
|
||||
remove: upload_speed < 1024 and seeding_time > $seedtime
|
||||
Disk:
|
||||
free_space:
|
||||
min: $diskspace
|
||||
path: /home/$username/
|
||||
action: remove-old-seeds
|
||||
delete_data: true
|
||||
EOF
|
||||
fi
|
||||
sed -i 's+127.0.0.1: +127.0.0.1:+g' $HOME/.config.yml
|
||||
mkdir $HOME/.autoremove-torrents && chmod 755 $HOME/.autoremove-torrents
|
||||
touch $HOME/.autoremove.sh
|
||||
cat << EOF >$HOME/.autoremove.sh
|
||||
#!/bin/sh
|
||||
|
||||
while true; do
|
||||
/usr/local/bin/autoremove-torrents --conf=$HOME/.config.yml --log=$HOME/.autoremove-torrents
|
||||
sleep 5
|
||||
done
|
||||
EOF
|
||||
chmod +x $HOME/.autoremove.sh
|
||||
normal_2
|
||||
apt-get -qqy install screen
|
||||
screen -dmS autoremove-torrents $HOME/.autoremove.sh
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
## CPU
|
||||
function CPU_Tweaking {
|
||||
tput setaf 2; echo "Optimizing CPU"
|
||||
apt-get -qqy install tuned > /dev/null
|
||||
tput setaf 1
|
||||
normal_1; echo "Optimizing CPU"; normal_2
|
||||
apt-get -qqy install tuned
|
||||
warn_2
|
||||
mkdir /etc/tuned/profile
|
||||
touch /etc/tuned/profile/tuned.conf
|
||||
cat << EOF >/etc/tuned/profile/tuned.conf
|
||||
|
@ -22,29 +22,28 @@ readahead=4096
|
|||
cmdline=skew_tick=1
|
||||
EOF
|
||||
|
||||
/sbin/tuned-adm profile profile
|
||||
tuned-adm profile profile
|
||||
}
|
||||
|
||||
|
||||
## Network
|
||||
#NIC Config
|
||||
function NIC_Tweaking {
|
||||
tput setaf 2; echo "Optimizing NIC Configuration"
|
||||
tput setaf 1; echo "Some Configurations might not be supported by the NIC"
|
||||
normal_1; echo "Optimizing NIC Configuration"
|
||||
warn_1; echo "Some Configurations might not be supported by the NIC"; warn_2
|
||||
interface=$(ip -o -4 route show to default | awk '{print $5}')
|
||||
/sbin/ethtool -G $interface rx 1024
|
||||
ethtool -G $interface rx 1024
|
||||
sleep 1
|
||||
/sbin/ethtool -G $interface tx 2048
|
||||
ethtool -G $interface tx 2048
|
||||
sleep 1
|
||||
/sbin/ethtool -K $interface tso off gso off
|
||||
ethtool -K $interface tso off gso off
|
||||
sleep 1
|
||||
}
|
||||
function Network_Other_Tweaking {
|
||||
tput setaf 2; echo "Doing other Network Tweaking"
|
||||
tput setaf 1
|
||||
normal_1; echo "Doing other Network Tweaking"; warn_2
|
||||
#Other 1
|
||||
apt-get -qqy install net-tools
|
||||
/sbin/ifconfig $interface txqueuelen 10000
|
||||
ifconfig $interface txqueuelen 10000
|
||||
sleep 1
|
||||
#Other 2
|
||||
iproute=$(ip -o -4 route show to default)
|
||||
|
@ -55,8 +54,7 @@ function Network_Other_Tweaking {
|
|||
## Drive
|
||||
#Scheduler
|
||||
function Scheduler_Tweaking {
|
||||
tput setaf 2; echo "Changing I/O Scheduler"
|
||||
tput setaf 1
|
||||
normal_1; echo "Changing I/O Scheduler"; warn_2
|
||||
i=1
|
||||
drive=()
|
||||
disk=$(lsblk -nd --output NAME)
|
||||
|
@ -92,9 +90,7 @@ function Scheduler_Tweaking {
|
|||
|
||||
## File Open Limit
|
||||
function file_open_limit_Tweaking {
|
||||
tput setaf 2; echo "Configuring File Open Limit"
|
||||
tput setaf 1
|
||||
username=$(ls /home/)
|
||||
normal_1; echo "Configuring File Open Limit"; warn_2
|
||||
cat << EOF >>/etc/security/limits.conf
|
||||
## Hard limit for max opened files
|
||||
$username hard nofile 1048576
|
||||
|
@ -106,8 +102,7 @@ EOF
|
|||
|
||||
## sysctl.conf
|
||||
function kernel_Tweaking {
|
||||
tput setaf 2; echo "Configuring sysctl.conf"
|
||||
tput setaf 1
|
||||
normal_1; echo "Configuring sysctl.conf"; warn_2
|
||||
cat << EOF >/etc/sysctl.conf
|
||||
###/proc/sys/kernel/ Variables:
|
||||
##https://www.kernel.org/doc/Documentation/admin-guide/sysctl/kernel.rst
|
||||
|
@ -460,127 +455,44 @@ net.ipv4.tcp_limit_output_bytes = 3276800
|
|||
#net.ipv4.tcp_rx_skb_cache = 1
|
||||
|
||||
# Congestion Control
|
||||
net.core.default_qdisc = fq
|
||||
net.ipv4.tcp_congestion_control = bbr
|
||||
EOF
|
||||
/sbin/sysctl -p > /dev/null
|
||||
sysctl -p > /dev/null
|
||||
}
|
||||
|
||||
|
||||
## BBR
|
||||
function BBR_Prepare {
|
||||
function Tweaked_BBR {
|
||||
## Update Kernel
|
||||
tput setaf 2; echo "Updating Kernel"
|
||||
tput setaf 7
|
||||
normal_1; echo "Updating Kernel"; normal_2
|
||||
echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee -a /etc/apt/sources.list
|
||||
apt-get -qqy update
|
||||
apt-get -qqy install linux-image-5.9.0-0.bpo.5-amd64
|
||||
apt-get -qqy update && apt-get -qqy install linux-image-5.10.0-0.bpo.7-amd64
|
||||
## Install tweaked BBR automatically on reboot
|
||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/BBR/BBR.sh && chmod +x BBR.sh
|
||||
tput setaf 1
|
||||
}
|
||||
function BBR_Tweaking {
|
||||
## This part of the script is modified from https://github.com/KozakaiAya/TCP_BBR
|
||||
tput setaf 2; echo "Configuring BBR"
|
||||
apt-get -qqy install dkms > /dev/null
|
||||
apt-get -qqy install linux-headers-$(uname -r) > /dev/null
|
||||
tput setaf 7
|
||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/BBR/5.9.0/tcp_bbrx.c
|
||||
kernel_ver=5.9.0
|
||||
algo=bbrx
|
||||
bbr_file=tcp_$algo
|
||||
bbr_src=$bbr_file.c
|
||||
bbr_obj=$bbr_file.o
|
||||
cat << EOF > /etc/systemd/system/bbrinstall.service
|
||||
[Unit]
|
||||
Description=BBRinstall
|
||||
After=network.target
|
||||
|
||||
mkdir -p $HOME/.bbr/src
|
||||
cd $HOME/.bbr/src
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/root/BBR.sh
|
||||
RemainAfterExit=true
|
||||
|
||||
mv $HOME/$bbr_src $HOME/.bbr/src/$bbr_src
|
||||
|
||||
# Create Makefile
|
||||
cat > ./Makefile << EOF
|
||||
obj-m:=$bbr_obj
|
||||
|
||||
default:
|
||||
make -C /lib/modules/\$(shell uname -r)/build M=\$(PWD)/src modules
|
||||
|
||||
clean:
|
||||
-rm modules.order
|
||||
-rm Module.symvers
|
||||
-rm .[!.]* ..?*
|
||||
-rm $bbr_file.mod
|
||||
-rm $bbr_file.mod.c
|
||||
-rm *.o
|
||||
-rm *.cmd
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Create dkms.conf
|
||||
cd ..
|
||||
cat > ./dkms.conf << EOF
|
||||
MAKE="'make' -C src/"
|
||||
CLEAN="make -C src/ clean"
|
||||
BUILT_MODULE_NAME=$bbr_file
|
||||
BUILT_MODULE_LOCATION=src/
|
||||
DEST_MODULE_LOCATION=/updates/net/ipv4
|
||||
PACKAGE_NAME=$algo
|
||||
PACKAGE_VERSION=$kernel_ver
|
||||
REMAKE_INITRD=yes
|
||||
EOF
|
||||
|
||||
# Start dkms install
|
||||
echo "===== Start installation ====="
|
||||
|
||||
cp -R . /usr/src/$algo-$kernel_ver
|
||||
|
||||
/sbin/dkms add -m $algo -v $kernel_ver
|
||||
if [ ! $? -eq 0 ]; then
|
||||
echo "DKMS add failed"
|
||||
/sbin/dkms remove -m $algo/$kernel_ver --all
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/sbin/dkms build -m $algo -v $kernel_ver
|
||||
if [ ! $? -eq 0 ]; then
|
||||
echo "DKMS build failed"
|
||||
/sbin/dkms remove -m $algo/$kernel_ver --all
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/sbin/dkms install -m $algo -v $kernel_ver
|
||||
if [ ! $? -eq 0 ]; then
|
||||
echo "DKMS install failed"
|
||||
/sbin/dkms remove -m $algo/$kernel_ver --all
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test loading module
|
||||
/sbin/modprobe $bbr_file
|
||||
|
||||
if [ ! $? -eq 0 ]; then
|
||||
echo "modprobe failed, please check your environment"
|
||||
echo "Please use \"dkms remove -m $algo/$kernel_ver --all\" to remove the dkms module"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Auto-load kernel module at system startup
|
||||
|
||||
echo $bbr_file | sudo tee -a /etc/modules
|
||||
echo "net.core.default_qdisc = fq" >> /etc/sysctl.conf
|
||||
echo "net.ipv4.tcp_congestion_control = $algo" >> /etc/sysctl.conf
|
||||
/sbin/sysctl -p > /dev/null
|
||||
|
||||
if [ ! $? -eq 0 ]; then
|
||||
echo "sysctl failed, please check your environment"
|
||||
echo "Please use \"dkms remove -m $algo/$kernel_ver --all\" to remove the dkms module"
|
||||
exit 1
|
||||
fi
|
||||
cd $HOME
|
||||
rm -r $HOME/.bbr
|
||||
systemctl enable bbrinstall.service
|
||||
tput setb 4
|
||||
}
|
||||
|
||||
|
||||
## Deluge
|
||||
|
||||
#Deluge Libtorrent Config
|
||||
function Deluge_libtorrent {
|
||||
tput setaf 2; echo "Configuring Deluge Libtorrent Options"
|
||||
tput setaf 1
|
||||
normal_1; echo "Configuring Deluge Libtorrent Settings"; warn_2
|
||||
systemctl stop deluged@$username
|
||||
cat << EOF >/home/$username/.config/deluge/ltconfig.conf
|
||||
{
|
Loading…
Reference in New Issue