Add Torrent auto-config
This commit is contained in:
6
services/torrents/config/97-gateway-setup
Normal file
6
services/torrents/config/97-gateway-setup
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
wgserver=$(grep Endpoint "${CONFIG_DIR}/wireguard/wg0.conf" | awk '{print $3}')
|
||||
gateway=$(ip -o -4 route show to default | awk '{print $3}')
|
||||
|
||||
ip -4 route add ${wgserver%:*} via ${gateway} dev eth0
|
||||
4
services/torrents/config/98-natpmp-install
Normal file
4
services/torrents/config/98-natpmp-install
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
apk add -u git
|
||||
git clone https://github.com/yimingliu/py-natpmp.git
|
||||
4
services/torrents/config/99-cron-start
Normal file
4
services/torrents/config/99-cron-start
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
chmod +x /bin/set_port.sh
|
||||
(crontab -l ; echo "* * * * * /bin/set_port.sh") | sort - | uniq - | crontab -
|
||||
3
services/torrents/config/set_port.sh
Normal file
3
services/torrents/config/set_port.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/command/with-contenv bash
|
||||
listen_port=$(python3 /py-natpmp/natpmp/natpmp_client.py -g 10.2.0.1 0 0 | sed -E 's/.*?public port ([0-9]+).*?/\1/')
|
||||
curl -F "json={\"listen_port\": ${listen_port}}" http://localhost:8080/api/v2/app/setPreferences
|
||||
Reference in New Issue
Block a user