Don't use addons in GRUB if NO_ADDONS is set
authorKrisztian VASAS <iron@ironiq.hu>
Wed, 18 Jun 2014 10:20:43 +0000 (12:20 +0200)
committerMichael Prokop <mika@grml.org>
Thu, 3 Jul 2014 11:12:18 +0000 (13:12 +0200)
grml-live
templates/boot/grub/grub.cfg

index 7f6bda0..cce5a68 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -913,7 +913,11 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
        # get adjusted according to the build.
        cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*  "$BUILD_OUTPUT"/boot/isolinux/
 
        # get adjusted according to the build.
        cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*  "$BUILD_OUTPUT"/boot/isolinux/
 
+       mkdir -p "${BUILD_OUTPUT}/boot/grub"
+       cp -a ${TEMPLATE_DIRECTORY}/boot/grub/* "$BUILD_OUTPUT"/boot/grub/
+
        if [ -n "$NO_ADDONS" ] ; then
        if [ -n "$NO_ADDONS" ] ; then
+          rm -f "$BUILD_OUTPUT"/boot/grub/addons.cfg
           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
           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
@@ -961,11 +965,6 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
           fi # no "$TEMPLATE_DIRECTORY"/boot/addons
        fi # NO_ADDONS
 
           fi # no "$TEMPLATE_DIRECTORY"/boot/addons
        fi # NO_ADDONS
 
-       if ! [ -d "${BUILD_OUTPUT}/boot/grub" ] ; then
-         mkdir -p "${BUILD_OUTPUT}/boot/grub"
-       fi
-       cp -a ${TEMPLATE_DIRECTORY}/boot/grub/* "$BUILD_OUTPUT"/boot/grub/
-
        # generate loopback.cfg config file without depending on grub's regexp module
        # which isn't available in Debian/squeeze
        echo "## grub2 loopback configuration" > "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
        # generate loopback.cfg config file without depending on grub's regexp module
        # which isn't available in Debian/squeeze
        echo "## grub2 loopback configuration" > "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
@@ -974,7 +973,9 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
          [ -r "$config" ] || continue
          echo "source ${config##$BUILD_OUTPUT}" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
        done
          [ -r "$config" ] || continue
          echo "source ${config##$BUILD_OUTPUT}" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
        done
-       echo "source /boot/grub/addons.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
+       if [ -z "$NO_ADDONS" ] ; then
+         echo "source /boot/grub/addons.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
+       fi
        echo "source /boot/grub/footer.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
 
        # copy grub files from target
        echo "source /boot/grub/footer.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
 
        # copy grub files from target
@@ -1086,7 +1087,7 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
           done
 
           echo "include options.cfg"     >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
           done
 
           echo "include options.cfg"     >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
-          if [ ! -n "$NO_ADDONS" ] ; then
+          if [ -z "$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 addons.cfg"    >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
           fi
           echo "include isoprompt.cfg"   >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
@@ -1104,7 +1105,9 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
          else
             log "including ${DISTRI_NAME}.cfg in ${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
             echo "include ${DISTRI_NAME}.cfg" > "${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
          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"
+            if [ -z "$NO_ADDONS" ] ; then
+              echo "include addons.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
+            fi
           fi
        fi
 
           fi
        fi
 
index 40faccc..bdcea7f 100644 (file)
@@ -5,7 +5,9 @@ insmod regexp
 
 for config in /boot/grub/*_default.cfg ; do source "$config" ; done
 for config in /boot/grub/*_options.cfg ; do source "$config" ; done
 
 for config in /boot/grub/*_default.cfg ; do source "$config" ; done
 for config in /boot/grub/*_options.cfg ; do source "$config" ; done
-source /boot/grub/addons.cfg
+if [ -f /boot/grub/addons.cfg ] ; then
+  source "/boot/grub/addons.cfg"
+fi
 
 source /boot/grub/footer.cfg
 # EOF
 
 source /boot/grub/footer.cfg
 # EOF