GRUB: don't display BIOS only addons when running in EFI mode
[grml-live.git] / grml-live
index 1158f86..a93e038 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -184,6 +184,24 @@ umount_all() {
 }
 # }}}
 
+# store logfiles {{{
+store_logfiles() {
+  # move fai logs into grml_logs directory
+  mkdir -p "$LOG_OUTPUT"/fai/
+  cp -r "$CHROOT_OUTPUT"/var/log/fai/"$HOSTNAME"/last/* "$LOG_OUTPUT"/fai/
+  rm -rf "$CHROOT_OUTPUT"/var/log/fai
+
+  # store copy of autogenerated configuration file
+  cp ${GRML_FAI_CONFIG}/nfsroot.conf "$LOG_OUTPUT"/fai/
+
+  # copy fai package list
+  cp "$CHROOT_OUTPUT"/var/log/install_packages.list "$LOG_OUTPUT"/fai/
+  # fixup owners
+  chown root:adm "$LOG_OUTPUT"/fai/*
+  chmod 664 "$LOG_OUTPUT"/fai/*
+}
+# }}}
+
 # clean exit {{{
 bailout() {
   rm -f /var/run/fai/fai_softupdate_is_running \
@@ -745,9 +763,10 @@ else
       RC="$PIPESTATUS" # notice: bash-only
 
       if [ "$RC" != 0 ] ; then
-         log    "Error: critical error while executing fai [exit code ${RC}]. Exiting."
-         eerror "Error: critical error while executing fai [exit code ${RC}]. Exiting." ; eend 1
-         bailout 1
+        store_logfiles  # ensure to have logfiles available even if building failed
+        log    "Error: critical error while executing fai [exit code ${RC}]. Exiting."
+        eerror "Error: critical error while executing fai [exit code ${RC}]. Exiting." ; eend 1
+        bailout 1
       fi
 
       # provide inform fai about the ISO we build, needs to be provided
@@ -759,19 +778,7 @@ else
 
       FORCE_ISO_REBUILD=true
 
-      # move fai logs into grml_logs directory
-      mkdir -p "$LOG_OUTPUT"/fai/
-      cp -r "$CHROOT_OUTPUT"/var/log/fai/"$HOSTNAME"/last/* "$LOG_OUTPUT"/fai/
-      rm -rf "$CHROOT_OUTPUT"/var/log/fai
-
-      # store copy of autogenerated configuration file
-      cp ${GRML_FAI_CONFIG}/nfsroot.conf "$LOG_OUTPUT"/fai/
-
-      # copy fai package list
-      cp "$CHROOT_OUTPUT"/var/log/install_packages.list "$LOG_OUTPUT"/fai/
-      # fixup owners
-      chown root:adm "$LOG_OUTPUT"/fai/*
-      chmod 664 "$LOG_OUTPUT"/fai/*
+      store_logfiles
 
       umount_all
 
@@ -1116,12 +1123,16 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
       log   "Skipping installation of boot addons as requested via \$NO_ADDONS."
       einfo "Skipping installation of boot addons as requested via \$NO_ADDONS."; eend 0
     else
-      if ! [ -d "$TEMPLATE_DIRECTORY"/boot/addons ] ; then
+      if ! [ -r "$TEMPLATE_DIRECTORY"/boot/addons ] ; then
         log   "Boot addons not found, skipping therefore. (Consider installing package grml-live-addons)"
         ewarn "Boot addons not found, skipping therefore. (Consider installing package grml-live-addons)" ; eend 0
       else
+        log   "Installing boot addons."
+        einfo "Installing boot addons."
+
         # copy addons from system packages or grml-live-addons
         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
         copy_addon_file memtest86+.bin /boot addons
 
@@ -1138,6 +1149,8 @@ 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"