src: Look for kernels in /lib/modules/*/vmlinuz
[qemu-sanity-check.git] / src / qemu-sanity-check.in
index 719261a..0c96485 100644 (file)
@@ -152,16 +152,18 @@ fi
 
 # Locate kernel if not specified.
 if [ -z "$kernel" ]; then
+    shopt -s nullglob
     if [ "$verbose" = "yes" ]; then
         echo "all kernels:"
-        ls -1dvr /boot/vmlinuz-*.$arch*
+        ls -1dvr /lib/modules/*/vmlinuz /boot/vmlinuz-*.$arch*
     fi
-    kernel="$(ls -1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen | head -1)"
+    kernel="$(ls -1dvr /lib/modules/*/vmlinuz /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen | head -1)"
     if [ -z "$kernel" ]; then
         echo "$0: cannot find a Linux kernel in /boot"
         echo "Choose a kernel to test using --kernel=/path/to/vmlinuz"
         exit 2
     fi
+    shopt -u nullglob
 fi
 if [ ! -r "$kernel" ]; then
     echo "$0: kernel $kernel is not readable"