[augeas-devel] augeas: master - Grub: process 'savedefault' in boot stanza

David Lutterkort lutter at fedoraproject.org
Fri Feb 6 17:40:12 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=9c0cfeb18285cab1b95486cc61e9111b67754d65
Commit:        9c0cfeb18285cab1b95486cc61e9111b67754d65
Parent:        81907164596ca1abf2fb6776f63aa7e75617f97a
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Fri Feb 6 09:38:47 2009 -0800
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Fri Feb 6 09:38:47 2009 -0800

Grub: process 'savedefault' in boot stanza

Also, allow keywords to be preceded by whitespace

Fixes ticket #36
---
 lenses/grub.aug            |    3 ++-
 lenses/tests/test_grub.aug |   16 ++++++++++++++++
 tests/root/etc/grub.conf   |    1 +
 3 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/lenses/grub.aug b/lenses/grub.aug
index 54e8858..aca6528 100644
--- a/lenses/grub.aug
+++ b/lenses/grub.aug
@@ -23,7 +23,7 @@ module Grub =
       (Util.del_ws_spc . [ label "file" . store /[^ \t\n]+/ ])? .
       eol ]
 
-    let kw_pres (kw:string) = [ key kw . del_to_eol . eol ]
+    let kw_pres (kw:string) = [ opt_ws . key kw . del_to_eol . eol ]
 
     let color =
       (* Should we nail it down to exactly the color names that *)
@@ -61,6 +61,7 @@ module Grub =
                      | kw_boot_arg "rootnoverify"
                      | kw_boot_arg "chainloader"
                      | kw_pres "quiet"  (* Seems to be a Ubuntu extension *)
+                     | kw_pres "savedefault"
                      | module_lines
 
     let boot = [ label "title" . title . boot_setting* ]
diff --git a/lenses/tests/test_grub.aug b/lenses/tests/test_grub.aug
index a38f000..fd1a275 100644
--- a/lenses/tests/test_grub.aug
+++ b/lenses/tests/test_grub.aug
@@ -83,6 +83,22 @@ title Fedora (2.6.24.3-34.fc8)
     set "/color/highlight/background" "black"    =
     "color cyan/light-blue white/black\n"
 
+  (* Boot stanza with savedefault *)
+  let boot_savedefault =
+"title\t\tDebian GNU/Linux, kernel 2.6.18-6-vserver-686
+root\t\t(hd0,0)
+  kernel\t\t/boot/vmlinuz-2.6.18-6-vserver-686 root=/dev/md0 ro
+initrd\t\t/boot/initrd.img-2.6.18-6-vserver-686
+\tsavedefault\n"
+
+  test Grub.lns get boot_savedefault =
+    { "title" = "Debian GNU/Linux, kernel 2.6.18-6-vserver-686"
+      { "root" = "(hd0,0)" }
+      { "kernel" = "/boot/vmlinuz-2.6.18-6-vserver-686 root=/dev/md0 ro" }
+      { "initrd" = "/boot/initrd.img-2.6.18-6-vserver-686" }
+      { "savedefault" } }
+
+
 (* Local Variables: *)
 (* mode: caml       *)
 (* End:             *)
diff --git a/tests/root/etc/grub.conf b/tests/root/etc/grub.conf
index 831c45d..adb02f5 100644
--- a/tests/root/etc/grub.conf
+++ b/tests/root/etc/grub.conf
@@ -28,3 +28,4 @@ title Fedora (2.6.24.3-34.fc8)
 	root (hd0,0)
 	kernel /vmlinuz-2.6.24.3-34.fc8 ro root=/dev/vg00/lv00
 	initrd /initrd-2.6.24.3-34.fc8.img
+        savedefault




More information about the augeas-devel mailing list