From bc50c45f5563697cf29769664e1fbcd077283d7e Mon Sep 17 00:00:00 2001 From: Sami Nieminen Date: Tue, 25 Feb 2025 21:50:49 +0200 Subject: [PATCH] Add logic to not download the file every time script is ran to save bandwidth. Refine curl file to download straight to correct directory. Add script to fix transmission default systemd file per https://github.com/transmission/transmission/issues/6991 Signed-off-by: Sami Nieminen --- torrent/create.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/torrent/create.sh b/torrent/create.sh index 793ba538..4eaa0354 100644 --- a/torrent/create.sh +++ b/torrent/create.sh @@ -26,10 +26,17 @@ root_check install_if_not transmission-cli install_if_not transmission-daemon -# Download the VM -curl -fSLO --retry 3 https://download.kafit.se/s/dnkWptz8AK4JZDM/download -# Move the file to default directory set in transmission config -mv download /var/lib/transmission-daemon/downloads/NextcloudVM.zip +# Modify transmission service file to fix https://github.com/transmission/transmission/issues/6991 +sed -i 's/Type=notify/Type=simple/' /etc/systemd/system/multi-user.target.wants/transmission-daemon.service +systemctl daemon-reload + +# Check if NextcloudVM.zip already exists +if [ ! -f "/var/lib/transmission-daemon/downloads/NextcloudVM.zip" ]; then + # Download the VM only if it doesn't exist + curl -fSLO --retry 3 https://download.kafit.se/s/dnkWptz8AK4JZDM/download -o /var/lib/transmission-daemon/downloads/NextcloudVM.zip +else + echo "NextcloudVM.zip already exists in transmission default downloads directory, skipping download" +fi # I dont think these are necessary in 2025? # Set more memory to sysctl