update
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pure VirtIO filename helpers shared by TA-ProxMenu and its tests.
|
||||
|
||||
TAPM_VIRTIO_FILENAME_FROM_URL() {
|
||||
local url="${1%%\?*}"
|
||||
local filename="${url##*/}"
|
||||
|
||||
[[ "$filename" =~ ^virtio-win(-0\.1\.[0-9]+)?\.iso$ ]] || return 1
|
||||
printf '%s\n' "$filename"
|
||||
}
|
||||
|
||||
TAPM_VIRTIO_LABELED_FILENAME() {
|
||||
local source_filename="$1"
|
||||
local label="$2"
|
||||
local version=''
|
||||
|
||||
[[ "$label" =~ ^[a-z0-9-]+$ ]] || return 1
|
||||
if [[ "$source_filename" =~ ^virtio-win-(0\.1\.[0-9]+)\.iso$ ]]; then
|
||||
version="${BASH_REMATCH[1]}"
|
||||
elif [[ "$source_filename" != 'virtio-win.iso' ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf 'virtio-win-%s%s.iso\n' "$label" "${version:+-${version}}"
|
||||
}
|
||||
Reference in New Issue
Block a user