[Grml-devel] [PATCH 3/4] Don't use addons in grub if NO_ADDONS is set.

Krisztian VASAS iron at ironiq.hu
Wed Jun 18 12:20:43 CEST 2014


---
 grml-live                    | 13 +++++++------
 templates/boot/grub/grub.cfg |  4 +++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/grml-live b/grml-live
index 35d7fd2..9f64c4e 100755
--- a/grml-live
+++ b/grml-live
@@ -913,7 +913,13 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
        # get adjusted according to the build.
        cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*  "$BUILD_OUTPUT"/boot/isolinux/
 
+       if ! [ -d "${BUILD_OUTPUT}/boot/grub" ] ; then
+         mkdir -p "${BUILD_OUTPUT}/boot/grub"
+       fi
+       cp -a ${TEMPLATE_DIRECTORY}/boot/grub/* "$BUILD_OUTPUT"/boot/grub/
+
        if [ -n "$NO_ADDONS" ] ; then
+          rm "$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
@@ -961,11 +967,6 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
           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
@@ -974,7 +975,7 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
          [ -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
+       [ ! -n $NO_ADDONS ] && echo "source /boot/grub/addons.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
        echo "source /boot/grub/footer.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
 
        # copy grub files from target
diff --git a/templates/boot/grub/grub.cfg b/templates/boot/grub/grub.cfg
index 40faccc..2c28569 100644
--- a/templates/boot/grub/grub.cfg
+++ b/templates/boot/grub/grub.cfg
@@ -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
-source /boot/grub/addons.cfg
+if [ -f /boot/grub/addons.cfg ] ; then
+	source "/boot/grub/addons.cfg"
+fi
 
 source /boot/grub/footer.cfg
 # EOF
-- 
1.9.1



More information about the Grml-devel mailing list