summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Salveti <ricardo.salveti@linaro.org>2016-05-13 13:00:52 -0300
committerRicardo Salveti <ricardo.salveti@linaro.org>2016-05-13 13:05:58 -0300
commit3888cb3def8b6cc20482f7c3996ca9175acb1f8f (patch)
tree24a018daba55d4a025d2c11618f75803e699249b
parent94dbbefdbd84c8c730fed593b57d7ed045990c29 (diff)
debian: adding udev rule and postinst for qemu-system
Otherwise the default permission for /dev/kvm will not contain the kvm group, making the qemu-kvm setup to fail. Change-Id: I99908ae22202c0db8b2ce1be2f2e7d0f4c84f19e Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
-rw-r--r--debian/qemu-system.postinst27
-rw-r--r--debian/qemu-system.udev1
2 files changed, 28 insertions, 0 deletions
diff --git a/debian/qemu-system.postinst b/debian/qemu-system.postinst
new file mode 100644
index 0000000..336a419
--- /dev/null
+++ b/debian/qemu-system.postinst
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+set -e
+
+if [ "$1" = configure ] ; then
+ # Add the kvm group unless it's already there
+ if ! getent group kvm >/dev/null; then
+ addgroup --quiet --system kvm || true
+ fi
+fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+#DEBHELPER#
+
+# if we just installed the package, udev rules aren't picked up yet,
+# so udev may have created the device (/dev/kvm) with default permissions.
+# Fix it here, but only if the perms are like default.
+# (See #607391)
+
+if [ -c /dev/kvm -a ! -L /dev/kvm ] && [ .$(stat -c %u%g /dev/kvm) = .00 ]
+then
+ chgrp kvm /dev/kvm
+ chmod 0660 /dev/kvm
+fi
+
+exit 0
diff --git a/debian/qemu-system.udev b/debian/qemu-system.udev
new file mode 100644
index 0000000..c2f7317
--- /dev/null
+++ b/debian/qemu-system.udev
@@ -0,0 +1 @@
+KERNEL=="kvm", GROUP="kvm", MODE="0660"