Downloading changed images takes a lot of time, so let's ask the user before

This commit is contained in:
Raphael Dannecker 2024-12-11 13:38:05 +01:00
parent 23a9b6ff97
commit a507c1decf

View file

@ -79,9 +79,19 @@ delete_outdated_image() {
cd "${VM_SYSDIR}" cd "${VM_SYSDIR}"
qcowsize=$(stat -c%s "${FILENAME}") qcowsize=$(stat -c%s "${FILENAME}")
if [[ -f "${FILENAME}.torrent" ]] && [[ "${qcowsize}" != $(get_image_size "${FILENAME}.torrent") ]]; then if [[ -f "${FILENAME}.torrent" ]] && [[ "${qcowsize}" != $(get_image_size "${FILENAME}.torrent") ]]; then
cat << EOF >&2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Es wurde eine neueres VM-Image auf dem Server gefunden.
Das Herunterladen des Images via WLAN benötigt viel Zeit.
EOF
read -rp "Soll das neue Image wirklich herunter geladen werden? j/n " answer
if [[ "${answer,,}" == "j" ]]; then
sudo vm-aria2 stop "${FILENAME%.qcow2}" sudo vm-aria2 stop "${FILENAME%.qcow2}"
rm -f "${FILENAME}" rm -f "${FILENAME}"
fi fi
fi
} }
update_usage_information() { update_usage_information() {