This commit is contained in:
David Schroeder
2026-07-28 22:09:13 -05:00
parent 247c4ddace
commit 3bea3baa88
12 changed files with 236 additions and 49 deletions
+14
View File
@@ -23,3 +23,17 @@ TAPM_VIRTIO_LABELED_FILENAME() {
printf 'virtio-win-%s%s.iso\n' "$label" "${version:+-${version}}"
}
TAPM_VIRTIO_CACHE_VALID() {
local checked_at="${1:-}"
local now="${2:-}"
local max_age="${3:-}"
local filename="${4:-}"
[[ "$checked_at" =~ ^[0-9]+$ &&
"$now" =~ ^[0-9]+$ &&
"$max_age" =~ ^[1-9][0-9]*$ &&
"$filename" =~ ^virtio-win(-[0-9]+\.[0-9]+\.[0-9]+)?\.iso$ ]] ||
return 1
(( now >= checked_at && now - checked_at < max_age ))
}