Continue download on cancel
This commit is contained in:
parent
87421e3396
commit
79d06d7a26
1 changed files with 27 additions and 20 deletions
47
arkdep
47
arkdep
|
@ -542,34 +542,41 @@ deploy () {
|
|||
fi
|
||||
|
||||
# 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"
|
||||
else
|
||||
printf "\e[1;34m-->\e[0m\e[1m Downloading disk image\e[0m\n"
|
||||
# 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
|
||||
touch $arkdep_dir/cache/${data[0]}.tar.${data[1]}.run
|
||||
|
||||
# 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
|
||||
|
||||
# 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, only perform check if not disabled by user and keychain exists
|
||||
if [[ ! $gpg_signature_check -eq 0 ]] && [[ -s $arkdep_dir/keys/trusted-keys ]]; then
|
||||
|
||||
# Download gpg signature if not yet in cache
|
||||
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"
|
||||
sig_exitcode=$?
|
||||
fi
|
||||
|
||||
if [[ ! $sig_exitcode -eq 0 ]] && [[ $gpg_signature_check -eq 1 ]]; then
|
||||
# Sig download is allowed to fail
|
||||
printf "\e[1;33m<!>\e[0m\e[1m Failed to download GPG signature, signature check will be skipped\e[0m\n"
|
||||
elif [[ ! $sig_exitcode -eq 0 ]] && [[ $gpg_signature_check -eq 2 ]]; then
|
||||
# gpg_signature_check = 2, error and quit the program on fail
|
||||
cleanup_and_quit 'GPG signature check configured to quit on download failure'
|
||||
fi
|
||||
|
||||
# Download gpg signature if not yet in cache
|
||||
if [[ ! -s $arkdep_dir/cache/${data[0]}.tar.${data[1]}.sig ]]; then
|
||||
wget -c -q --show-progress -P $arkdep_dir/cache/ "$repo_url/$deploy_target/${data[0]}.tar.${data[1]}.sig"
|
||||
sig_exitcode=$?
|
||||
fi
|
||||
|
||||
if [[ ! $sig_exitcode -eq 0 ]] && [[ $gpg_signature_check -eq 1 ]]; then
|
||||
# Sig download is allowed to fail
|
||||
printf "\e[1;33m<!>\e[0m\e[1m Failed to download GPG signature, signature check will be skipped\e[0m\n"
|
||||
elif [[ ! $sig_exitcode -eq 0 ]] && [[ $gpg_signature_check -eq 2 ]]; then
|
||||
# gpg_signature_check = 2, error and quit the program on fail
|
||||
cleanup_and_quit 'GPG signature check configured to quit on download failure'
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Remove the .run file
|
||||
rm $arkdep_dir/cache/${data[0]}.tar.${data[1]}.run
|
||||
|
||||
fi
|
||||
|
||||
if [[ $gpg_signature_check -eq 2 ]] && [[ ! -s $arkdep_dir/cache/${data[0]}.tar.${data[1]}.sig ]]; then
|
||||
|
|
Loading…
Add table
Reference in a new issue