[augeas-devel] xpath expression to query grub.conf

Ludwin Janvier lud.janvier at gmail.com
Fri Oct 23 11:47:38 UTC 2009


[ my question is more a user issue but I didn't find a user mailing
list. If there's one, could you give redirect me to it ? ]

I'm looking for a way to find a node by its value with augtool.
"match" does the thing, but I didn't find a way to reuse the result.

I got a grub.conf which looks like :

/files/etc/grub.conf/title[1] = "Fedora (2.6.30.5-43.fc11.i686.PAE)"
/files/etc/grub.conf/title[1]/root = "(hd0,3)"
...
/files/etc/grub.conf/title[3] = "WindowsXP"
/files/etc/grub.conf/title[3]/rootnoverify = "(hd0,1)"
/files/etc/grub.conf/title[3]/chainloader = "+1"

my primary goal is to move title = "Windows XP" (which can be
title[3]... or not)  before title[1].

So I create a new node :
> ins title before /files/etc/grub.conf/title[1]

And I would use mv to move "Windows XP" in the new title[1]
mv could do the trick if I knew how to get "Windows XP" with an xpath.
"match" can get the node :
> match /files/etc/grub.conf/* "Windows XP"
/files/etc/grub.conf/title[3]

But this result is useless for mv (I can't set this in a var, can I ?).
I tried to find a single xpath to get it, with no success

> match "/files/etc/grub.conf/*[title='Windows XP']"
  (no matches)

(I tried hundred of combinations like this without any success)

Thanks for your help.

augtool 0.5.3




More information about the augeas-devel mailing list