test/run-qemu: specify the kernel
authorHarald Hoyer <harald@redhat.com>
Fri, 28 Jun 2013 08:21:42 +0000 (10:21 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 28 Jun 2013 08:21:42 +0000 (10:21 +0200)
test/run-qemu

index 667975f..00c2f6a 100755 (executable)
@@ -14,4 +14,15 @@ $(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu "
    echo "Please install kvm or qemu." >&2
    exit 1
 }
-exec sudo $BIN $ARGS "$@"
+
+KVERSION=${KVERSION-$(uname -r)}
+
+[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
+
+if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+    VMLINUZ="/boot/${MACHINE_ID}/$KVERSION/linux"
+else
+    VMLINUZ="/boot/vmlinuz-${KVERSION}"
+fi
+
+exec sudo $BIN $ARGS -kernel $VMLINUZ "$@"