[arkdep] Ensure pkgs files are actually present

This commit is contained in:
Dennis ten Hoove 2024-07-14 18:32:54 +02:00
parent 4e0a5d53aa
commit 2d02e146fd
No known key found for this signature in database
GPG key ID: 2BA91DC2563B83D1

11
arkdep
View file

@ -535,6 +535,17 @@ get_update () {
mountinfo=${mountinfo%/*} # Remove everything after ID
declare -r deployment_id_old=${mountinfo##*/} # Remove everything before ID
# Check if pkgs files actually available
for id in "$deployment_id_old" "$deployment_id_new"; do
declare status_code=$(curl -s -o /dev/null --write-out "%{http_code}" $repo_url/$repo_default_image/$id.pkgs)
# Error if server returned a status code other than 200
if [[ $status_code -ne 200 ]]; then
printf "\e[1;31m<#>\e[0m Failed to download $id.pkgs file, server returned a status code of $status_code\e[0m\n"
exit 1
fi
done
if [[ $deployment_id_old == $deployment_id_new ]]; then
printf 'Already on latest version\n'
exit 0