-if [ -f "${CHROOT}vmlinux" ] ; then
- KERNEL="${CHROOT}vmlinux"
-elif [ -f "${CHROOT}boot/vmlinux" ] ; then
- KERNEL="${CHROOT}boot/vmlinux"
-elif [ -f "${CHROOT}boot/vmlinux-`uname -r`" ] ; then
- KERNEL="${CHROOT}boot/vmlinux-`uname -r`"
-elif [ -f "${CHROOT}vmlinux-`uname -r`" ] ; then
- KERNEL="${CHROOT}vmlinux-`uname -r`"
-elif [ "$QUIET" = 0 ] ; then
- echo 1>&2 "$PRG: Cannot find a kernel, please locate one"
+for k in "vmlinux" "vmlinux-`uname -r`" "vmlinux-`uname -r`" "$READLINKKV" ; do
+ if [ -f "${CHROOT}${k}" ] ; then
+ KERNEL="${CHROOT}${k}"
+ break;
+ elif [ -f "${CHROOT}boot/${k}" ] ; then
+ KERNEL="${CHROOT}boot/${k}"
+ break;
+ fi
+done
+
+for i in "initrd" "initrd-`uname -r`" "`echo $READLINKKV | cut -f1 -d- --complement`" ; do
+ for b in "" "boot/" ; do
+ if [ -f "${CHROOT}${b}${i}" ] ; then
+ INITRD="${CHROOT}${b}${i}"
+ elif [ -f "${CHROOT}${b}${i}.img" ] ; then
+ INITRD="${CHROOT}${b}${i}.img"
+ elif [ -f "${CHROOT}${b}${i}.gz" ] ; then
+ INITRD="${CHROOT}${b}${i}.gz"
+ fi
+ done
+done
+
+if [ ! -f "$KERNEL" ] && [ ${QUIET} == 0 ] ; then
+ echo 1>&2 "$PRG: Cannot find a kernel, please provide one"