Skip to content

Commit a77615d

Browse files
authored
improve torrent script
Signed-off-by: Daniel Hansson <[email protected]>
1 parent f725b49 commit a77615d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

torrent/create.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
#########
88

99
## This script will install Transmission, download the latest version of the VM, create a torrent of the file and seed it using Transmission
10-
## Help is welcome!
10+
## Improvments to the script are welcome!
1111

1212
# shellcheck source=lib.sh
1313
# shellcheck disable=SC2046
14-
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
1514

1615
# Check for errors + debug code and abort if something isn't right
1716
# 1 = ON
@@ -27,20 +26,21 @@ install_if_not transmission-cli
2726
install_if_not transmission-daemon
2827

2928
TRANSMISSION_DL_DIR="/var/lib/transmission-daemon/downloads"
30-
NC_ZIP="NextcloudVM.zip"
29+
NC_OVA="100GB_Nextcloud-VM_www.hanssonit.se.ova"
30+
VERSION_TAG=30.0.1
31+
VERSION_HUB=9
3132

3233
# Modify transmission service file to fix https://github.com/transmission/transmission/issues/6991
33-
sed -i 's/Type=notify/Type=simple/' /etc/systemd/system/multi-user.target.wants/transmission-daemon.service
34+
sed -i "s|Type=notify|Type=simple|g" /etc/systemd/system/multi-user.target.wants/transmission-daemon.service
3435
systemctl daemon-reload
3536

3637
# Check if NextcloudVM.zip already exists
37-
if [ ! -f "$TRANSMISSION_DL_DIR"/"$NC_ZIP" ]
38+
if [ ! -f "$TRANSMISSION_DL_DIR"/"$NC_OVA" ]
3839
then
3940
# Download the VM only if it doesn't exist
40-
curl_to_dir https://download.kafit.se/s/dnkWptz8AK4JZDM download "$TRANSMISSION_DL_DIR"
41-
mv "$TRANSMISSION_DL_DIR"/download "$TRANSMISSION_DL_DIR"/"$NC_ZIP"
41+
curl_to_dir "https://download.kafit.se/public.php/dav/files/dnkWptz8AK4JZDM/$VERSION_TAG%20-%20HUB%20$VERSION_HUB" "$NC_OVA" "$TRANSMISSION_DL_DIR"
4242
else
43-
echo "$NC_ZIP already exists in transmission default downloads directory, skipping download"
43+
echo "$NC_OVA already exists in transmission default downloads directory, skipping download"
4444
fi
4545

4646
# Set more memory to sysctl
@@ -50,7 +50,7 @@ fi
5050

5151
# Create torrent
5252
curl_to_dir "$GITHUB_REPO"/torrent trackers.txt /tmp
53-
transmission-create -o $TRANSMISSION_DL_DIR/nextcloudvmhanssonit.torrent -c "https://www.hanssonit.se/nextcloud-vm" -t "$(cat /tmp/trackers.txt)" "$TRANSMISSION_DL_DIR"/"$NC_ZIP"
53+
transmission-create -o $TRANSMISSION_DL_DIR/nextcloudvmhanssonit.torrent -c "https://www.hanssonit.se/nextcloud-vm" -t $(cat /tmp/trackers.txt) "$TRANSMISSION_DL_DIR"/"$NC_OVA"
5454

5555
# Seed it!
5656
transmission-remote -n 'transmission:transmission' --torrent="$TRANSMISSION_DL_DIR/nextcloudvmhanssonit.torrent" -a "$TRANSMISSION_DL_DIR/nextcloudvmhanssonit.torrent" --start --verify

0 commit comments

Comments
 (0)