Continue download on cancel

This commit is contained in:
Dennis ten Hoove 2024-03-04 00:02:24 +01:00
parent 87421e3396
commit 79d06d7a26

19
arkdep
View file

@ -542,21 +542,25 @@ deploy () {
fi fi
# Check if requested version is already downloaded # Check if requested version is already downloaded
if [[ -e $arkdep_dir/cache/${data[0]}.tar.${data[1]} ]]; then if [[ -e $arkdep_dir/cache/${data[0]}.tar.${data[1]} ]] && [[ ! -e $arkdep_dir/cache/${data[0]}.tar.${data[1]}.run ]]; then
printf "\e[1;34m-->\e[0m\e[1m ${data[0]} already in cache, skipping download\e[0m\n" printf "\e[1;34m-->\e[0m\e[1m ${data[0]} already in cache, skipping download\e[0m\n"
else else
printf "\e[1;34m-->\e[0m\e[1m Downloading disk image\e[0m\n" printf "\e[1;34m-->\e[0m\e[1m Downloading disk image\e[0m\n"
# Download the tarball if not yet downloaded # Download the tarball if not yet downloaded
if [[ ! -e $arkdep_dir/cache/${data[0]}.tar.${data[1]} ]]; then
wget -q --show-progress -P $arkdep_dir/cache/ "$repo_url/$deploy_target/${data[0]}.tar.${data[1]}" || # Write .run file to indicate process is ongoing and not yet finished, can be used to resume download later
cleanup_and_quit 'Failed to download tarball' touch $arkdep_dir/cache/${data[0]}.tar.${data[1]}.run
# Download GPG signature, only perform check if not disabled by user and keychain exists # Download GPG signature, only perform check if not disabled by user and keychain exists
if [[ ! $gpg_signature_check -eq 0 ]] && [[ -s $arkdep_dir/keys/trusted-keys ]]; then if [[ ! $gpg_signature_check -eq 0 ]] && [[ -s $arkdep_dir/keys/trusted-keys ]]; then
# Start the download
wget -c -q --show-progress -P $arkdep_dir/cache/ "$repo_url/$deploy_target/${data[0]}.tar.${data[1]}" ||
cleanup_and_quit 'Failed to download tarball'
# Download gpg signature if not yet in cache # Download gpg signature if not yet in cache
if [[ ! -s $arkdep_dir/cache/${data[0]}.tar.${data[1]}.sig ]]; then if [[ ! -s $arkdep_dir/cache/${data[0]}.tar.${data[1]}.sig ]]; then
wget -q --show-progress -P $arkdep_dir/cache/ "$repo_url/$deploy_target/${data[0]}.tar.${data[1]}.sig" wget -c -q --show-progress -P $arkdep_dir/cache/ "$repo_url/$deploy_target/${data[0]}.tar.${data[1]}.sig"
sig_exitcode=$? sig_exitcode=$?
fi fi
@ -569,7 +573,10 @@ deploy () {
fi fi
fi fi
fi
# Remove the .run file
rm $arkdep_dir/cache/${data[0]}.tar.${data[1]}.run
fi fi
if [[ $gpg_signature_check -eq 2 ]] && [[ ! -s $arkdep_dir/cache/${data[0]}.tar.${data[1]}.sig ]]; then if [[ $gpg_signature_check -eq 2 ]] && [[ ! -s $arkdep_dir/cache/${data[0]}.tar.${data[1]}.sig ]]; then