- mkdir -p "$BUILD_TARGET"/boot/isolinux
- [ -d "$BUILD_TARGET"/GRML ] || mkdir "$BUILD_TARGET"/GRML
- cp /boot/memtest86+.bin "$BUILD_TARGET"/boot/isolinux/memtest
- cp "$CHROOT_TARGET"/boot/initrd* "$BUILD_TARGET"/boot/isolinux/initrd.gz
- cp "$CHROOT_TARGET"/boot/vmlinuz* "$BUILD_TARGET"/boot/isolinux/linux26
- cp /usr/lib/syslinux/chain.c32 "$BUILD_TARGET"/boot/isolinux/
- cp /usr/lib/syslinux/isolinux.bin "$BUILD_TARGET"/boot/isolinux/
- cp /usr/lib/syslinux/memdisk "$BUILD_TARGET"/boot/isolinux/
- cp /usr/lib/syslinux/menu.c32 "$BUILD_TARGET"/boot/isolinux/
- cp /usr/share/grml-live/i386_files/boot/isolinux/allinone.img "$BUILD_TARGET"/boot/isolinux/
- cp /usr/share/grml-live/i386_files/boot/isolinux/balder10.imz "$BUILD_TARGET"/boot/isolinux/
- cp /usr/share/grml-live/i386_files/boot/isolinux/boot-beep.msg "$BUILD_TARGET"/boot/isolinux/
- cp /usr/share/grml-live/i386_files/boot/isolinux/boot.msg "$BUILD_TARGET"/boot/isolinux/
- cp /usr/share/grml-live/i386_files/boot/isolinux/f* "$BUILD_TARGET"/boot/isolinux/
- cp /usr/share/grml-live/i386_files/boot/isolinux/isolinux.cfg "$BUILD_TARGET"/boot/isolinux/
- cp /usr/share/grml-live/i386_files/boot/isolinux/logo.16 "$BUILD_TARGET"/boot/isolinux/
- cp /usr/share/grml-live/i386_files/boot/isolinux/syslinux.cfg "$BUILD_TARGET"/boot/isolinux/
+ mkdir -p "$BUILD_OUTPUT"/boot/isolinux
+ cp /boot/memtest86+.bin "$BUILD_OUTPUT"/boot/isolinux/memtest
+
+ # 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
+ else
+ log "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting"
+ eerror "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1
+ bailout 10
+ fi
+
+ cp "$CHROOT_OUTPUT"/boot/vmlinuz* "$BUILD_OUTPUT"/boot/isolinux/linux26
+ 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/
+ cp /usr/lib/syslinux/menu.c32 "$BUILD_OUTPUT"/boot/isolinux/
+
+ [ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates'
+ if ! [ -d "${TEMPLATE_DIRECTORY}"/boot ] ; then
+ log "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting."
+ eerror "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." ; eend 1
+ bailout 8
+ fi
+ cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/
+ cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/
+ cp -a ${TEMPLATE_DIRECTORY}/boot/grub "$BUILD_OUTPUT"/boot/
+
+ if ! [ -d "${TEMPLATE_DIRECTORY}"/GRML ] ; then
+ log "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting."
+ eerror "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting." ; eend 1
+ bailout 9
+ fi
+ [ -d "$BUILD_OUTPUT"/GRML ] || mkdir "$BUILD_OUTPUT"/GRML
+ cp -a ${TEMPLATE_DIRECTORY}/GRML/* "$BUILD_OUTPUT"/GRML/