- 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_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
-
- # *always* copy files to output directory so the variables
- # get adjusted according to the build
- 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 "$TEMPLATE_DIRECTORY"/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%/$DATE/" "$BUILD_OUTPUT"/GRML/grml-version
-
- # make sure the squashfs filename is set accordingly:
- SQUASHFS_NAME="$GRML_NAME.squashfs"
-
- # adjust all variables in the templates with the according distribution information
- for file in "${BUILD_OUTPUT}"/boot/isolinux/*.cfg "${BUILD_OUTPUT}"/boot/isolinux/*.msg \
- "${BUILD_OUTPUT}"/boot/grub/* ; do
- sed -i "s/%ARCH%/$ARCH/g" "${file}"
- sed -i "s/%DATE%/$DATE/g" "${file}"
- sed -i "s/%DISTRI_INFO%/$DISTRI_INFO/g" "${file}"
- sed -i "s/%DISTRI_NAME%/$DISTRI_NAME/g" "${file}"
- sed -i "s/%DISTRI_SPLASH%/$DISTRI_SPLASH/g" "${file}"
- sed -i "s/%GRML_NAME%/$GRML_NAME/g" "${file}"
- sed -i "s/%SQUASHFS_NAME%/$SQUASHFS_NAME/g" "${file}"
- sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/g" "${file}"
- sed -i "s/%SHORT_NAME%/$SHORT_NAME/g" "${file}"
- sed -i "s/%VERSION%/$VERSION/g" "${file}"
- done
-
- # adjust bootsplash accordingly but make sure the string has the according lenght
- SQUASHFS_NAME="$(cut_string 20 "$SQUASHFS_NAME")"
- SQUASHFS_NAME="$(extend_string_end 20 "$SQUASHFS_NAME")"
- sed -i "s/%SQUASHFS_NAME%/$SQUASHFS_NAME/" "$BUILD_OUTPUT"/boot/isolinux/f4
- sed -i "s/%SQUASHFS_NAME%/$SQUASHFS_NAME/" "$BUILD_OUTPUT"/boot/isolinux/f5
-
- # generate addon list
- rm "${BUILD_OUTPUT}/${ADDONS_LIST_FILE}"
- for name in $(ls "${BUILD_OUTPUT}"/boot/isolinux/addon_*.cfg) ; do
- include_name=$(basename "$name")
- echo "include $include_name" >> "${BUILD_OUTPUT}/${ADDONS_LIST_FILE}"
- done
-
- if ! [ -r "${BUILD_OUTPUT}/boot/isolinux/${DISTRI_NAME}.cfg" ] || [ "$DISTRI_NAME" = "grml" ] ; then
- log "including grmlmain.cfg in ${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
- echo "include grmlmain.cfg" > "${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
- echo "include default.cfg" > "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
- echo "include menuoptions.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
- echo "include grml.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
- echo "include options.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
- if [ ! -n "$NO_ADDONS" ] ; then
- echo "include addons.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
- fi
- echo "include isoprompt.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
- echo "include hd.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
- echo "include hidden.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
- else # assume we are building a custom distribution:
- log "File ${BUILD_OUTPUT}/boot/isolinux/${DISTRI_NAME}.cfg found, using it."
- einfo "File ${BUILD_OUTPUT}/boot/isolinux/${DISTRI_NAME}.cfg found, using it."
- if grep -q "^include ${DISTRI_NAME}.cfg" "${BUILD_OUTPUT}/boot/isolinux/distri.cfg" ; then
- log "include for ${DISTRI_NAME}.cfg already present, nothing to do."
- eindent
- einfo "include for ${DISTRI_NAME}.cfg already present, nothing to do."
- eoutdent
- eend $?
- else
- log "including ${DISTRI_NAME}.cfg in ${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
- echo "include ${DISTRI_NAME}.cfg" > "${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
- [ -n "$NO_ADDONS" ] || echo "include addons.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
- fi
- fi