[augeas-devel] Does augeas support grub2 config files

Dominic Cleal dcleal at redhat.com
Tue Jun 16 07:22:03 UTC 2015


On 16/06/15 07:59, Gaurav Dalvi wrote:
> This flow works if I do change /etc/default/grub file. But what I am
> trying to do with augeas is not working.
> 
> *---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------*
> Sample /etc/default/grub file :
> 
> *root at ip-10-0-162-247 ec2-user]# cat /etc/default/grub *
> 
> *GRUB_TIMEOUT=1*
> 
> *GRUB_DEFAULT=saved*
> 
> *GRUB_DISABLE_SUBMENU=true*
> 
> *GRUB_TERMINAL_OUTPUT="console"*
> 
> *GRUB_CMDLINE_LINUX="crashkernel=auto console=ttyS0,115200n8 console=tty0"*
> 
> *GRUB_DISABLE_RECOVERY="true"*
> 
> 
> now using augeas I tried to get the value of *GRUB_CMDLINE_LINUX** , *I
> got the value "*crashkernel=auto console=ttyS0,115200n8 console=tty0"*
> correctly. But when I do 
> 
> set /files/etc/default/grub/*GRUB_CMDLINE_LINUX/rootdelay 300, *it does
> not set under node *GRUB_CMDLINE_LINUX.*
> *
> *
> *---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------**---------*
> *
> *
> This is jut for /etc/default/grub file. I need to alter some other files
> under /etc/grub.d. So thats why, my question was does augeas support
> parsing these grub2 related files or not ?

Try using the Shellvars_list module to parse /etc/default/grub, it
supports splitting up a value into a number of nodes.

$ augtool -A -t 'Shellvars_list incl /etc/default/grub' print
/files/etc/default/grub/GRUB_CMDLINE_LINUX
/files/etc/default/grub/GRUB_CMDLINE_LINUX
/files/etc/default/grub/GRUB_CMDLINE_LINUX/quote = "\""
/files/etc/default/grub/GRUB_CMDLINE_LINUX/value[1] = "rd.md=0"
/files/etc/default/grub/GRUB_CMDLINE_LINUX/value[2] = "rd.dm=0"
/files/etc/default/grub/GRUB_CMDLINE_LINUX/value[3] =
"rd.lvm.lv=vgcobalt/lvroot"
/files/etc/default/grub/GRUB_CMDLINE_LINUX/value[4] = "$(["
/files/etc/default/grub/GRUB_CMDLINE_LINUX/value[5] = "-x"
/files/etc/default/grub/GRUB_CMDLINE_LINUX/value[6] =
"/usr/sbin/rhcrashkernel-param"
/files/etc/default/grub/GRUB_CMDLINE_LINUX/value[7] = "]"
/files/etc/default/grub/GRUB_CMDLINE_LINUX/value[8] = "&&"
/files/etc/default/grub/GRUB_CMDLINE_LINUX/value[9] =
"/usr/sbin/rhcrashkernel-param"

etc.

-- 
Dominic Cleal
Red Hat Engineering




More information about the augeas-devel mailing list