-# BUILD_OUTPUT - execute arch specific stuff and squashfs {{{
-[ -n "$BUILD_OUTPUT" ] || BUILD_OUTPUT="$OUTPUT/grml_cd"
-mkdir -p "$BUILD_OUTPUT" || bailout 6 "Problem with creating $BUILD_OUTPUT for stage ARCH"
-
-# i386:
-if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
- if [ -d "$BUILD_OUTPUT"/boot/isolinux -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then
- log "Skipping stage 'boot' as $BUILD_OUTPUT/boot/isolinux exists already."
- ewarn "Skipping stage 'boot' as $BUILD_OUTPUT/boot/isolinux exists already." ; eend 0
- else
- # booting stuff:
- [ -d "$BUILD_OUTPUT"/boot/isolinux ] || mkdir -p "$BUILD_OUTPUT"/boot/isolinux
- [ -d "$BUILD_OUTPUT"/boot/"${SHORT_GRML_NAME}" ] || mkdir -p "$BUILD_OUTPUT"/boot/"${SHORT_GRML_NAME}"
-
- if [ -z "$NO_ADDONS" ] ; then
- [ -d "$BUILD_OUTPUT"/boot/addons ] || mkdir -p "$BUILD_OUTPUT"/boot/addons
- if [ -r "$TEMPLATE_DIRECTORY"/boot/addons/memtest ] ; then
- log "Installing $TEMPLATE_DIRECTORY/boot/addons/memtest"
- cp "$TEMPLATE_DIRECTORY"/boot/addons/memtest "$BUILD_OUTPUT"/boot/addons/memtest
- elif [ -r /boot/memtest86+.bin ] ; then
- log "Installing /boot/memtest86+.bin"
- cp /boot/memtest86+.bin "$BUILD_OUTPUT"/boot/addons/memtest
- else
- ewarn "No memtest binary found, skipping."
- log "No memtest binary found, skipping."
- eend 0
- fi
- fi
-
- # 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:
- 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/"${SHORT_GRML_NAME}"/initrd.gz
- find $CHROOT_OUTPUT/boot/ -name initrd\*.bak -exec rm {} \;
- else
- log "Error: No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting"
- eerror "Error: No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1
- bailout 10
- fi
-
- KERNEL_IMAGE="$(ls $CHROOT_OUTPUT/boot/vmlinuz* 2>/dev/null | sort -r | head -1)"
- if [ -n "$KERNEL_IMAGE" ] ; then
- cp "$KERNEL_IMAGE" "$BUILD_OUTPUT"/boot/"${SHORT_GRML_NAME}"/linux26
- else
- log "Error: No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting"
- eerror "Error: No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1
- bailout 11
- fi
-
- [ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates'
- if ! [ -d "${TEMPLATE_DIRECTORY}"/boot ] ; then
- log "Error: ${TEMPLATE_DIRECTORY}/boot does not exist. Exiting."
- eerror "Error: ${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." ; eend 1
- bailout 8
- fi
-
- cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/
-
- if [ -n "$NO_ADDONS" ] ; then
- log "Skipping installation boot addons requested via \$NO_ADDONS."
- einfo "Skipping installation boot addons requested via \$NO_ADDONS."
- eend 0
- else
- if ! [ -d /usr/share/grml-live/templates/boot/addons/bsd4grml ] ; then
- ewarn "Boot addons not found, skipping therefore. (Consider installing package grml-live-addons)" ; eend 0
- else
- # copy only files so we can handle bsd4grml on its own
- for file in ${TEMPLATE_DIRECTORY}/boot/addons/* ; do
- test -f $file && cp $file "$BUILD_OUTPUT"/boot/addons/
- done
-
- if [ -z "$NO_ADDONS_BSD4GRML" ] ; then
- cp -a ${TEMPLATE_DIRECTORY}/boot/addons/bsd4grml "$BUILD_OUTPUT"/boot/addons/
- fi
- fi
- fi
-
- if ! [ -d "${BUILD_OUTPUT}/boot/grub" ] ; then
- cp -a ${TEMPLATE_DIRECTORY}/boot/grub "$BUILD_OUTPUT"/boot/
- fi
- # make sure we have recent template files available, otherwise updating
- # the strings like $GRML_NAME and $VERSION might be out of date
- cp ${TEMPLATE_DIRECTORY}/boot/grub/* "$BUILD_OUTPUT"/boot/grub/
-
- if ! [ -d "${TEMPLATE_DIRECTORY}"/GRML ] ; then
- log "Error: ${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting."
- eerror "Error: ${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/
-
- # adjust boot splash information:
- RELEASE_INFO="$GRML_NAME $VERSION - Release Codename $RELEASENAME"
- RELEASE_INFO="$(cut_string 68 "$RELEASE_INFO")"
- RELEASE_INFO="$(extend_string_end 68 "$RELEASE_INFO")"
-
- sed -i "s/%RELEASE_INFO%/$GRML_NAME $VERSION - $RELEASENAME/" "$BUILD_OUTPUT"/GRML/grml-version
- sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_OUTPUT"/GRML/grml-version
-
- sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/isolinux/boot.msg
- sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_OUTPUT"/boot/isolinux/boot.msg
-
- sed -i "s/%GRML_NAME%/$SHORT_GRML_NAME/" "$BUILD_OUTPUT"/boot/isolinux/isolinux.cfg
- sed -i "s/%GRML_NAME%/$SHORT_GRML_NAME/" "$BUILD_OUTPUT"/boot/isolinux/syslinux.cfg
-
- sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/isolinux/boot-beep.msg
- sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_OUTPUT"/boot/isolinux/boot-beep.msg
-
- sed -i "s/%VERSION%/$VERSION/" "$BUILD_OUTPUT"/boot/grub/menu.lst
- sed -i "s/%GRML_NAME%/$SHORT_GRML_NAME/" "$BUILD_OUTPUT"/boot/grub/menu.lst
-
- sed -i "s/%VERSION%/$VERSION/" "$BUILD_OUTPUT"/boot/grub/grub.cfg
- sed -i "s/%GRML_NAME%/$SHORT_GRML_NAME/" "$BUILD_OUTPUT"/boot/grub/grub.cfg