X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=febootstrap-supermin-helper.sh;h=cd5cf19b096130a6d975830333555039b74b66b6;hb=3c9a5248737321d174aefcb9cb8251e1ab44c3fa;hp=c2088bf63c500b97e633d10cdac00af513228caf;hpb=76b7711268a6b0c0929952ee261821825589a165;p=febootstrap.git diff --git a/febootstrap-supermin-helper.sh b/febootstrap-supermin-helper.sh index c2088bf..cd5cf19 100755 --- a/febootstrap-supermin-helper.sh +++ b/febootstrap-supermin-helper.sh @@ -32,7 +32,7 @@ eval set -- "$TEMP" usage () { - echo "Usage: febootstrap-supermin-helper supermin.img hostfiles.txt kernel initrd" + echo "Usage: febootstrap-supermin-helper supermin.img hostfiles.txt host_cpu kernel initrd" echo "Please read febootstrap-supermin-helper(8) man page for more information." } @@ -55,7 +55,7 @@ while true; do esac done -if [ $# -ne 4 ]; then +if [ $# -ne 5 ]; then usage exit 1 fi @@ -66,9 +66,11 @@ set -e supermin="$1" hostfiles="$2" +host_cpu=$3 + # Output files. -kernel="$3" -initrd="$4" +kernel="$4" +initrd="$5" rm -f "$kernel" "$initrd" @@ -80,8 +82,17 @@ rm -f "$kernel" "$initrd" # 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/') -kernels=$(ls -1vr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen; ls -1vr /boot/vmlinuz-* 2>/dev/null | grep -v xen) +arch=$(echo $host_cpu | sed 's/^i.86$/i?86/') +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-,,') @@ -129,4 +140,4 @@ find "$modpath" \( -not -name '*.ko' $whitelist \) -a -print0 | hostfiles=$(readlink -f "$hostfiles") (cd / && ls -1df $(cat "$hostfiles") 2>/dev/null | - cpio --quiet -o -H newc ) >> "$initrd" + cpio -C 65536 --quiet -o -H newc ) >> "$initrd"