grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add grub-mkrescue --exclude option


From: Christian Franke
Subject: [PATCH] Add grub-mkrescue --exclude option
Date: Tue, 20 Nov 2007 20:37:50 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4

This adds an option to exclude specific modules from the rescue image.

Christian

2007-11-20  Christian Franke  <address@hidden>

        * util/i386/pc/grub-mkrescue.in: Add option --exclude.



--- grub2.orig/util/i386/pc/grub-mkrescue.in    2007-07-22 01:32:32.000000000 
+0200
+++ grub2/util/i386/pc/grub-mkrescue.in 2007-11-19 23:26:53.625000000 +0100
@@ -42,6 +42,7 @@
   -h, --help              print this message and exit
   -v, --version           print the version information and exit
   --modules=MODULES       pre-load specified modules MODULES
+  --exclude=MODULES       don't pre-load specified modules MODULES
   --pkglibdir=DIR         use images from directory DIR instead of ${pkglibdir}
   --grub-mkimage=FILE     use FILE as grub-mkimage
   --image-type=TYPE       select floppy or cdrom (default)
@@ -67,6 +68,8 @@
        exit 0 ;;
     --modules=*)
        modules=`echo "$option" | sed 's/--modules=//'` ;;
+    --exclude=*)
+       exclude=`echo "$option" | sed 's/--exclude=//'` ;;
     --pkglibdir=*)
        input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
     --grub-mkimage=*)
@@ -103,6 +106,18 @@
   modules=`cd ${input_dir}/ && ls *.mod`
 fi
 
+if [ "x${exclude}" != "x" ] ; then
+  all_modules="${modules}"
+  modules=
+  for m in ${all_modules} ; do
+    inc=t
+    for e in ${exclude} ; do
+      [ "$e" == "$m" ] && { inc=f; break; }
+    done
+    [ $inc == t ] && modules="$modules $m"
+  done
+fi
+
 if [ "x${image_type}" = "xfloppy" ] ; then
   floppy_image=${output_image}
 else

reply via email to

[Prev in Thread] Current Thread [Next in Thread]