use 'stupid_simple' instead of 'nested' initramfs
[libguestfs.git] / appliance / libguestfs-supermin-helper.in
index 87fb688..2afd0cf 100755 (executable)
@@ -29,11 +29,13 @@ sourcedir=$(cd "$1" > /dev/null; pwd)
 kernel="$2"
 initrd="$3"
 
-# Look for the kernel first.  This is very unsophisticated: We
-# just look for any kernel named vmlinuz-*.$host_cpu which has a
-# corresponding /lib/modules/*.$host_cpu directory.
+# Kernel:
+# Look for the most recent kernel named vmlinuz-*.<arch>* which has a
+# corresponding directory in /lib/modules/. If the architecture is x86, look
+# for any x86 kernel.
 
-for f in /boot/vmlinuz-*.@host_cpu@; do
+arch=$(echo "@host_cpu@" | sed 's/^i.86$/i?86/')
+for f in $(ls -1vr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen); do
     b=$(basename "$f")
     b=$(echo "$b" | sed 's,vmlinuz-,,')
     modpath="/lib/modules/$b"