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

[Libguestfs] [PATCH 1/2] Add new augeas directory with grub device.map lens



Add a directory to contain required augeas lenses which aren't yet upstream.
Include a new lens for grub's device.map.
---
 augeas/README.txt     |    4 ++++
 augeas/device_map.aug |   28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 augeas/README.txt
 create mode 100644 augeas/device_map.aug

diff --git a/augeas/README.txt b/augeas/README.txt
new file mode 100644
index 0000000..709be7c
--- /dev/null
+++ b/augeas/README.txt
@@ -0,0 +1,4 @@
+This directory contains augeas lenses required by virt-v2v.
+
+device_map.aug posted upstream:
+http://www.redhat.com/archives/augeas-devel/2010-June/msg00027.html
diff --git a/augeas/device_map.aug b/augeas/device_map.aug
new file mode 100644
index 0000000..090edd5
--- /dev/null
+++ b/augeas/device_map.aug
@@ -0,0 +1,28 @@
+(* Parsing grub's device.map *)
+
+module Device_map =
+  autoload xfm
+
+  let sep_tab = Sep.tab
+  let eol     = Util.eol
+  let fspath  = Rx.fspath
+  let del_str = Util.del_str
+
+  let comment = Util.comment
+  let empty   = Util.empty
+
+  let dev_name = /(h|f|c)d[0-9]+(,[0-9a-zA-Z]+){0,2}/
+  let dev_hex  = /0x[0-9a-fA-F]+/
+  let dev_dec  = /[0-9]+/
+
+  let device = del_str "(" . key ( dev_name | dev_hex | dev_dec ) .  del_str ")"
+
+  let map = [ device . sep_tab . store fspath . eol ]
+
+  let lns = ( empty | comment | map ) *
+
+  let xfm = transform lns (incl "/boot/grub/device.map")
+
+(* Local Variables: *)
+(* mode: caml *)
+(* End: *)
-- 
1.7.1


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