X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=appliance%2Flibguestfs-supermin-helper.in;h=ab3aad5304277c5f1d24d41ab7ac3196d8693730;hb=677e021225d05e92034a68cb9a9b487e5331d35d;hp=2afd0cfa080481304e1626021c3afb3dd5fe4378;hpb=d2c0ee0ff7a9afdcdc1605dd464760f98d1b57d7;p=libguestfs.git diff --git a/appliance/libguestfs-supermin-helper.in b/appliance/libguestfs-supermin-helper.in index 2afd0cf..ab3aad5 100755 --- a/appliance/libguestfs-supermin-helper.in +++ b/appliance/libguestfs-supermin-helper.in @@ -33,15 +33,28 @@ initrd="$3" # Look for the most recent kernel named vmlinuz-*.* which has a # corresponding directory in /lib/modules/. If the architecture is x86, look # for any x86 kernel. +# +# RHEL 5 didn't append the arch to the kernel name, so look for kernels +# without arch second. 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 +kernels=$( + ls -1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen ||: ; + ls -1dvr /boot/vmlinuz-* 2>/dev/null | grep -v xen +) + +if [ -z "$kernels" ]; then + echo "$0: failed to find a suitable kernel in /boot directory" >&2 + exit 1 +fi + +for f in $kernels; do b=$(basename "$f") b=$(echo "$b" | sed 's,vmlinuz-,,') modpath="/lib/modules/$b" if [ -d "$modpath" ]; then - ln -sf "$f" "$kernel" - break + ln -sf "$f" "$kernel" + break fi modpath= done @@ -79,4 +92,4 @@ find "$modpath" \( -not -name '*.ko' $whitelist \) -a -print0 | ls -1df $( cat "$sourcedir"/initramfs.@REPO@.@host_cpu@.supermin.hostfiles ) 2>/dev/null | - cpio --quiet -o -H newc ) >> "$initrd" + cpio -C 65536 --quiet -o -H newc ) >> "$initrd"