aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2017-05-21 14:37:55 -0400
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2017-05-21 14:37:55 -0400
commit4e73aa0a0927c4a759cace2cf75a350b38aa93a4 (patch)
treea9b751fac0d44e3b57383291f207372f1b0ba6a8
parent68335b6217f96cbfca8a89e924335d37e2c7d0f6 (diff)
downloadkvm-manager-4e73aa0a0927c4a759cace2cf75a350b38aa93a4.tar.gz
kvm-manager-4e73aa0a0927c4a759cace2cf75a350b38aa93a4.tar.bz2
more robust version comparison
a version of kvm like 2.4.10 would have claimed to be greater than 2.6.0 using the existing comparison. we'll rely on dpkg's implementation of version comparisons instead. this does make kvm-manager more specific to debian and debian-derived systems, but if folks who prefer other systems want to offer patches, they would be happily accepted :)
-rwxr-xr-xkvm-manager4
1 files changed, 2 insertions, 2 deletions
diff --git a/kvm-manager b/kvm-manager
index 1747a38..0e15c09 100755
--- a/kvm-manager
+++ b/kvm-manager
@@ -51,7 +51,7 @@ BRIDGE="${BRIDGE:-br0}"
OWNERGROUP=$(groups "$OWNER" | cut -f1 -d\ )
OWNERHOME=$(getent passwd "$OWNER" | cut -f6 -d: )
-kvm_version=$(kvm --version | head -n1 | sed -E 's/QEMU emulator version ([0-9.]+).*/\1/' | tr -d '.')
+kvm_version=$(kvm --version | head -n1 | sed -E 's/^QEMU emulator version ([0-9.]+).*/\1/')
# Disks can be HDA, HDB, HDC, etc. For each disk, we want to detect the
# corresponding environment variables for disk read/write restrictions
@@ -62,7 +62,7 @@ build_disk_io_params() {
local option variable argument value
disk_io_params=
- if [ "$kvm_version" -lt "260" ]; then
+ if dpkg --compare-versions "$kvm_version" lt 2.6.0; then
# Only supported in version 2.6.0 or above.
return
fi