X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=appliance%2Flibguestfs-supermin-helper.in;h=69f22e4f41b5751e7799f7291ecfbec8ba9333fd;hp=d7c8d96bc5004847f28bf4de6ecf581f3ecb381d;hb=09d7b265e6a0b78592b0a8cc78d9382fd5cb680b;hpb=e250646e7cc99df9bb617c28d13c327ff79ab601 diff --git a/appliance/libguestfs-supermin-helper.in b/appliance/libguestfs-supermin-helper.in index d7c8d96..69f22e4 100755 --- a/appliance/libguestfs-supermin-helper.in +++ b/appliance/libguestfs-supermin-helper.in @@ -30,18 +30,22 @@ kernel="$2" initrd="$3" # Kernel: -# Look for any kernel named vmlinuz-*.$host_cpu* which has -# a corresponding /lib/modules/*.$host_cpu* directory. -# However by sorting on reverse version (ls -vr) we ensure -# we choose the newest kernels. +# 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. -for f in $(ls -1vr /boot/vmlinuz-*.@host_cpu@* | grep -v xen); do +arch=$(echo "@host_cpu@" | sed 's/^i.86$/i?86/') +kernels=$(ls -1vr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen; ls -1vr /boot/vmlinuz-* 2>/dev/null | grep -v xen) +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 +83,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"