X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=grml-live;h=65c9417367ba1dd99d16b1b11c53a7bba571351a;hb=bac307629479296e8bb5bf3f56bd02b1a7108990;hp=3a8c8e7b1fdb9204c4e68722356a03eea7cb0c0a;hpb=9453222c016a82a2c964e174ec01687f88d73d86;p=grml-live.git diff --git a/grml-live b/grml-live index 3a8c8e7..65c9417 100755 --- a/grml-live +++ b/grml-live @@ -337,6 +337,19 @@ adjust_boot_files() { exit 1 fi + local release_info + if [ -n "${RELEASE_INFO:-}" ] ; then + release_info="${RELEASE_INFO}" + else + ewarn "Variable RELEASE_INFO is unset, applying fallback for usage in adjust_boot_files." ; eend 1 + release_info="$GRML_NAME $VERSION - Release Codename $RELEASENAME" + fi + + # ensure this has a specific length + local fixed_release_info + fixed_release_info="$(cut_string 68 "$release_info")" + fixed_release_info="$(extend_string_end 68 "$fixed_release_info")" + for file in "$@" ; do if [ -r "${file}" ] && [ -f "${file}" ] ; then sed -i "s/%ARCH%/$ARCH/g" "${file}" @@ -345,12 +358,8 @@ adjust_boot_files() { 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}" - if [ -n "${fixed_squashfs_name}" ] ; then - sed -i "s/%SQUASHFS_NAME%/${fixed_squashfs_name}/g" "${file}" - fi - if [ -n "${fixed_release_info}" ] ; then - sed -i "s/%RELEASE_INFO%/${fixed_release_info}/g" "${file}" - fi + sed -i "s/%SQUASHFS_NAME%/$SQUASHFS_NAME/g" "${file}" + sed -i "s/%RELEASE_INFO%/$fixed_release_info/g" "${file}" sed -i "s/%SHORT_NAME%/$SHORT_NAME/g" "${file}" sed -i "s/%VERSION%/$VERSION/g" "${file}" if [ -n "${BOOT_FILE}" ] ; then @@ -616,7 +625,7 @@ einfo "Logging actions to logfile $LOGFILE" # dump config variables into file, for script access {{{ CONFIGDUMP=$(mktemp) -set | egrep \ +set | grep -E \ '^(GRML_NAME|RELEASENAME|DATE|VERSION|SUITE|ARCH|DISTRI_NAME|USERNAME|HOSTNAME|APT_PROXY)=' \ > ${CONFIGDUMP} # }}} @@ -703,7 +712,7 @@ if [ -z "$FAI_DEBOOTSTRAP" ] ; then fi if [ -z "$FAI_DEBOOTSTRAP_OPTS" ] ; then - FAI_DEBOOTSTRAP_OPTS="--exclude=info,tasksel,tasksel-data --include=aptitude --arch $ARCH --no-merged-usr" + FAI_DEBOOTSTRAP_OPTS="--exclude=info,tasksel,tasksel-data --include=aptitude --arch $ARCH" fi # create backup of old (not yet automatically generated) config file @@ -906,6 +915,14 @@ grub_setup() { BOOTX32="/boot/bootia32.efi" EFI_IMG="/boot/efi.img" + local efi_size + if [[ "${SECURE_BOOT:-}" == "disable" ]] || [[ "${ARCH:-}" == "i386" ]] ; then + efi_size='4M' + else + # e.g. templates/EFI/debian for Secure Boot has >4MB and needs more space + efi_size='8M' + fi + if [[ "$ARCH" == "amd64" ]] ; then # important: this depends on execution of ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-grub-images if ! [ -r "${CHROOT_OUTPUT}/${BOOTX64}" ] ; then @@ -916,7 +933,7 @@ grub_setup() { bailout 50 fi - dd if=/dev/zero of="${CHROOT_OUTPUT}/${EFI_IMG}" bs=4M count=1 2>/dev/null || bailout 50 + dd if=/dev/zero of="${CHROOT_OUTPUT}/${EFI_IMG}" bs="${efi_size}" count=1 2>/dev/null || bailout 50 mkfs.vfat -n GRML "${CHROOT_OUTPUT}/${EFI_IMG}" >/dev/null || bailout 51 mmd -i "${CHROOT_OUTPUT}/${EFI_IMG}" ::EFI || bailout 52 mmd -i "${CHROOT_OUTPUT}/${EFI_IMG}" ::EFI/BOOT || bailout 52 @@ -995,7 +1012,7 @@ grub_setup() { bailout 50 fi - dd if=/dev/zero of="${CHROOT_OUTPUT}/${EFI_IMG}" bs=4M count=1 2>/dev/null || bailout 50 + dd if=/dev/zero of="${CHROOT_OUTPUT}/${EFI_IMG}" bs="${efi_size}" count=1 2>/dev/null || bailout 50 mkfs.vfat -n GRML "${CHROOT_OUTPUT}/${EFI_IMG}" >/dev/null || bailout 51 mmd -i "${CHROOT_OUTPUT}/${EFI_IMG}" ::EFI || bailout 52 mmd -i "${CHROOT_OUTPUT}/${EFI_IMG}" ::EFI/BOOT || bailout 52 @@ -1020,6 +1037,10 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then mkdir -p "$BUILD_OUTPUT"/boot/isolinux mkdir -p "$BUILD_OUTPUT"/boot/"${SHORT_NAME}" + # this is a variable we're using for adjusting boot templates, not only in + # adjust_boot_files though, so set here + RELEASE_INFO="$GRML_NAME $VERSION - Release Codename $RELEASENAME" + # 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)" @@ -1139,7 +1160,34 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then copy_addon_file ipxe.lkrn /usr/lib/ipxe addons copy_addon_file ipxe.efi /usr/lib/ipxe addons copy_addon_file pci.ids /usr/share/misc addons + + # memtest86+ <=5.01-3.1 copy_addon_file memtest86+.bin /boot addons + # make memtest filename FAT16/8.3 compatible + if [ -r "${BUILD_OUTPUT}/boot/addons/memtest86+.bin" ] ; then + mv "${BUILD_OUTPUT}/boot/addons/memtest86+.bin" \ + "${BUILD_OUTPUT}/boot/addons/memtest" + fi + + # memtest86+ >=6.00-1 + copy_addon_file memtest86+x32.bin /boot addons + copy_addon_file memtest86+x32.efi /boot addons + copy_addon_file memtest86+x64.bin /boot addons + copy_addon_file memtest86+x64.efi /boot addons + + # provide memtest86+ >=6.00-1 files as "memtest" file + # for BIOS boot in isolinux/syslinux + if ! [ -r "${BUILD_OUTPUT}/boot/addons/memtest" ] ; then + if [[ "$ARCH" == "amd64" ]] ; then + copy_addon_file memtest86+x64.bin /boot addons + mv "${BUILD_OUTPUT}/boot/addons/memtest86+x64.bin" \ + "${BUILD_OUTPUT}/boot/addons/memtest" + elif [[ "$ARCH" == "i386" ]] ; then + copy_addon_file memtest86+x32.bin /boot addons + mv "${BUILD_OUTPUT}/boot/addons/memtest86+x32.bin" \ + "${BUILD_OUTPUT}/boot/addons/memtest" + fi + fi # since syslinux(-common) v3:6.03~pre1+dfsg-4 the files are in a # different directory :( @@ -1154,17 +1202,13 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then copy_addon_file memdisk /usr/lib/syslinux addons - eend 0 - - # make memtest filename FAT16/8.3 compatible - mv "${BUILD_OUTPUT}/boot/addons/memtest86+.bin" \ - "${BUILD_OUTPUT}/boot/addons/memtest" - # 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 + eend 0 + if [ -n "$NO_ADDONS_BSD4GRML" ] ; then log "Skipping installation of bsd4grml as requested via \$NO_ADDONS_BSD4GRML." einfo "Skipping installation of bsd4grml as requested via \$NO_ADDONS_BSD4GRML."; eend 0 @@ -1219,18 +1263,22 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then mkdir -p "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/ cp -a ${TEMPLATE_DIRECTORY}/GRML/* "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/ - # adjust boot splash information, as used within adjust_boot_files() - RELEASE_INFO="$GRML_NAME $VERSION - Release Codename $RELEASENAME" - fixed_release_info="$(cut_string 68 "$RELEASE_INFO")" - fixed_release_info="$(extend_string_end 68 "$fixed_release_info")" - if [ -r "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version ] ; then - sed -i "s/%RELEASE_INFO%/$GRML_NAME $VERSION - $RELEASENAME/" "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version - sed -i "s/%DATE%/$DATE/" "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version + sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version + sed -i "s/%DATE%/$DATE/" "$BUILD_OUTPUT"/GRML/"${GRML_NAME}"/grml-version fi # make sure the squashfs filename is set accordingly: SQUASHFS_NAME="$GRML_NAME.squashfs" + # adjust bootsplash accordingly but make sure the string has the according length + fixed_squashfs_name="$(cut_string 20 "$SQUASHFS_NAME")" + fixed_squashfs_name="$(extend_string_end 20 "$fixed_squashfs_name")" + for file in f4 f5 ; do + if [ -r "${BUILD_OUTPUT}/boot/isolinux/${file}" ] ; then + sed -i "s/%SQUASHFS_NAME%/${fixed_squashfs_name}/" "${BUILD_OUTPUT}/boot/isolinux/${file}" + sed -i "s/%SQUASHFS_NAME%/${fixed_squashfs_name}/" "${BUILD_OUTPUT}/boot/isolinux/${file}" + fi + done # adjust all variables in the templates with the according distribution information adjust_boot_files "${BUILD_OUTPUT}"/boot/isolinux/*.cfg \ @@ -1245,16 +1293,6 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then done done - # adjust bootsplash accordingly but make sure the string has the according length - fixed_squashfs_name="$(cut_string 20 "$SQUASHFS_NAME")" - fixed_squashfs_name="$(extend_string_end 20 "$fixed_squashfs_name")" - for file in f4 f5 ; do - if [ -r "${BUILD_OUTPUT}/boot/isolinux/${file}" ] ; then - sed -i "s/%SQUASHFS_NAME%/${fixed_squashfs_name}/" "${BUILD_OUTPUT}/boot/isolinux/${file}" - sed -i "s/%SQUASHFS_NAME%/${fixed_squashfs_name}/" "${BUILD_OUTPUT}/boot/isolinux/${file}" - fi - done - # generate addon list rm -f "${BUILD_OUTPUT}/${ADDONS_LIST_FILE}" for name in "${BUILD_OUTPUT}"/boot/isolinux/addon_*.cfg ; do @@ -1322,7 +1360,7 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then fi if [ -e "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.6 ]; then - sed -i "s/%RELEASE_INFO%/$GRML_NAME $VERSION - $RELEASENAME/" "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.6 + sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/addons/bsd4grml/boot.6 fi DPKG_LIST="/var/log/fai/$HOSTNAME/last/dpkg.list" # the dpkg --list output of the chroot @@ -1495,7 +1533,7 @@ generate_build_info() { timestamp="$(TZ=UTC date +%s)" \ update_only="${UPDATE}" \ wayback_date="${WAYBACK_DATE}" \ - : + -- } # }}} @@ -1589,9 +1627,19 @@ else eend $? log "$MKISOFS -V '${GRML_NAME} ${VERSION}' -publisher 'grml-live | grml.org' -l -r -J $BOOT_ARGS $EFI_ARGS -no-pad -o ${ISO_OUTPUT}/${ISO_NAME} ." + einfo "Generating ISO file..." $MKISOFS -V "${GRML_NAME} ${VERSION}" -publisher 'grml-live | grml.org' \ -l -r -J $BOOT_ARGS $EFI_ARGS -no-pad \ -o "${ISO_OUTPUT}/${ISO_NAME}" . ; RC=$? + eend $RC + + # do not continue on errors, otherwise we might generate/overwrite the ISO with dd if=... stuff + if [ "$RC" != 0 ] ; then + log "Error: critical error while generating ISO [exit code ${RC}]. Exiting." + eerror "Error: critical error while generating ISO [exit code ${RC}]. Exiting." ; eend 1 + bailout $RC + fi + # both of these need core.img there, so it’s easier to write it here if [ "$BOOT_METHOD" = "grub2" ] || [ "$HYBRID_METHOD" = "grub2" ]; then # must be <= 30720 bytes @@ -1751,12 +1799,12 @@ create_netbootpackage() { ewarn "No shimx64.efi for usage with PXE boot found (shim-signed not present?)" ; eend 0 fi - if [ -r /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed ] ; then + if [ -r "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed ] ; then log "Installing /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed as grubx64.efi in netboot package" - cp /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed "${WORKING_DIR}"/grubx64.efi - elif [ -r /usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi ] ; then + cp "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed "${WORKING_DIR}"/grubx64.efi + elif [ -r "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi ] ; then log "Installing /usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi as grubx64.efi in netboot package" - cp /usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi "${WORKING_DIR}"/grubx64.efi + cp "${CHROOT_OUTPUT}"/usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi "${WORKING_DIR}"/grubx64.efi else log "No grubnetx64.efi for usage with PXE boot found (grub-efi-amd64-signed not present?)" ewarn "No grubnetx64.efi for usage with PXE boot found (grub-efi-amd64-signed not present?)." ; eend 0