From ed027d61f1bbc2ba3d75545f63ed4bb4cddcaa77 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 15 Nov 2007 21:51:53 +0100 Subject: [PATCH] Improve initrd+kernel copy process --- debian/changelog | 2 ++ grml-live | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index a5e26c7..8826aa1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ grml-live (0.0.9) unstable; urgency=low * Support kernel upgrades via according /etc/kernel-img.conf configuration. * Set hostname in instsoft-hook already. * Add user (grml) to all relevant groups. + * Improve initrd+kernel copy process (ignore .bak files and + copy always exactly one image). * Add new packages to GRML_FULL: - etckeeper - hdapsd diff --git a/grml-live b/grml-live index 5c7859f..877bb1e 100755 --- a/grml-live +++ b/grml-live @@ -388,16 +388,24 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then # if we don't have an initrd we a) can't boot and b) there was an error # during build, so check for the file: - if [ -f "$CHROOT_OUTPUT"/boot/initrd* ] ; then - cp "$CHROOT_OUTPUT"/boot/initrd* "$BUILD_OUTPUT"/boot/isolinux/initrd.gz + INITRD="$(ls $CHROOT_OUTPUT/boot/initrd* 2>/dev/null| grep -v '.bak$' | sort -r | head -1)" + if [ -n "$INITRD" ] ; then + cp $INITRD "$BUILD_OUTPUT"/boot/isolinux/initrd.gz else log "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" eerror "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1 bailout 10 fi - KERNEL_IMAGE="$(ls $CHROOT_OUTPUT/boot/vmlinuz* | sort -r | head -1)" - cp "$KERNEL_IMAGE" "$BUILD_OUTPUT"/boot/isolinux/linux26 + KERNEL_IMAGE="$(ls $CHROOT_OUTPUT/boot/vmlinuz* 2>/dev/null | sort -r | head -1)" + if [ -n "$INITRD" ] ; then + cp "$KERNEL_IMAGE" "$BUILD_OUTPUT"/boot/isolinux/linux26 + else + log "No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" + eerror "No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1 + bailout 11 + fi + cp /usr/lib/syslinux/chain.c32 "$BUILD_OUTPUT"/boot/isolinux/ cp /usr/lib/syslinux/isolinux.bin "$BUILD_OUTPUT"/boot/isolinux/ cp /usr/lib/syslinux/memdisk "$BUILD_OUTPUT"/boot/isolinux/ -- 2.1.4