|
Matthew Booth |
afeea6 |
commit 7ac49e29cafbf579608560206f62580078197b2f
|
|
Matthew Booth |
afeea6 |
Author: Matthew Booth <mbooth@redhat.com>
|
|
Matthew Booth |
afeea6 |
Date: Mon Jun 28 15:24:50 2010 +0100
|
|
Matthew Booth |
afeea6 |
|
|
Matthew Booth |
afeea6 |
Device_map: new lens for grub's device.map
|
|
Matthew Booth |
afeea6 |
|
|
Matthew Booth |
afeea6 |
diff --git a/lenses/device_map.aug b/lenses/device_map.aug
|
|
Matthew Booth |
afeea6 |
new file mode 100644
|
|
Matthew Booth |
afeea6 |
index 0000000..090edd5
|
|
Matthew Booth |
afeea6 |
--- /dev/null
|
|
Matthew Booth |
afeea6 |
+++ b/lenses/device_map.aug
|
|
Matthew Booth |
afeea6 |
@@ -0,0 +1,28 @@
|
|
Matthew Booth |
afeea6 |
+(* Parsing grub's device.map *)
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+module Device_map =
|
|
Matthew Booth |
afeea6 |
+ autoload xfm
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ let sep_tab = Sep.tab
|
|
Matthew Booth |
afeea6 |
+ let eol = Util.eol
|
|
Matthew Booth |
afeea6 |
+ let fspath = Rx.fspath
|
|
Matthew Booth |
afeea6 |
+ let del_str = Util.del_str
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ let comment = Util.comment
|
|
Matthew Booth |
afeea6 |
+ let empty = Util.empty
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ let dev_name = /(h|f|c)d[0-9]+(,[0-9a-zA-Z]+){0,2}/
|
|
Matthew Booth |
afeea6 |
+ let dev_hex = /0x[0-9a-fA-F]+/
|
|
Matthew Booth |
afeea6 |
+ let dev_dec = /[0-9]+/
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ let device = del_str "(" . key ( dev_name | dev_hex | dev_dec ) . del_str ")"
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ let map = [ device . sep_tab . store fspath . eol ]
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ let lns = ( empty | comment | map ) *
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ let xfm = transform lns (incl "/boot/grub/device.map")
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+(* Local Variables: *)
|
|
Matthew Booth |
afeea6 |
+(* mode: caml *)
|
|
Matthew Booth |
afeea6 |
+(* End: *)
|
|
Matthew Booth |
afeea6 |
diff --git a/lenses/tests/test_device_map.aug b/lenses/tests/test_device_map.aug
|
|
Matthew Booth |
afeea6 |
new file mode 100644
|
|
Matthew Booth |
afeea6 |
index 0000000..2a7810a
|
|
Matthew Booth |
afeea6 |
--- /dev/null
|
|
Matthew Booth |
afeea6 |
+++ b/lenses/tests/test_device_map.aug
|
|
Matthew Booth |
afeea6 |
@@ -0,0 +1,34 @@
|
|
Matthew Booth |
afeea6 |
+module Test_device_map =
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ let conf = "# this device map was generated by anaconda
|
|
Matthew Booth |
afeea6 |
+(fd0) /dev/fda
|
|
Matthew Booth |
afeea6 |
+(hd0) /dev/sda
|
|
Matthew Booth |
afeea6 |
+(cd0) /dev/cdrom
|
|
Matthew Booth |
afeea6 |
+(hd1,1) /dev/sdb1
|
|
Matthew Booth |
afeea6 |
+(hd0,a) /dev/sda1
|
|
Matthew Booth |
afeea6 |
+(0x80) /dev/sda
|
|
Matthew Booth |
afeea6 |
+(128) /dev/sda
|
|
Matthew Booth |
afeea6 |
+"
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ test Device_map.lns get conf =
|
|
Matthew Booth |
afeea6 |
+ { "#comment" = "this device map was generated by anaconda" }
|
|
Matthew Booth |
afeea6 |
+ { "fd0" = "/dev/fda" }
|
|
Matthew Booth |
afeea6 |
+ { "hd0" = "/dev/sda" }
|
|
Matthew Booth |
afeea6 |
+ { "cd0" = "/dev/cdrom" }
|
|
Matthew Booth |
afeea6 |
+ { "hd1,1" = "/dev/sdb1" }
|
|
Matthew Booth |
afeea6 |
+ { "hd0,a" = "/dev/sda1" }
|
|
Matthew Booth |
afeea6 |
+ { "0x80" = "/dev/sda" }
|
|
Matthew Booth |
afeea6 |
+ { "128" = "/dev/sda" }
|
|
Matthew Booth |
afeea6 |
+
|
|
Matthew Booth |
afeea6 |
+ test Device_map.lns put conf after
|
|
Matthew Booth |
afeea6 |
+ set "hd2,1" "/dev/sdb1"
|
|
Matthew Booth |
afeea6 |
+ = "# this device map was generated by anaconda
|
|
Matthew Booth |
afeea6 |
+(fd0) /dev/fda
|
|
Matthew Booth |
afeea6 |
+(hd0) /dev/sda
|
|
Matthew Booth |
afeea6 |
+(cd0) /dev/cdrom
|
|
Matthew Booth |
afeea6 |
+(hd1,1) /dev/sdb1
|
|
Matthew Booth |
afeea6 |
+(hd0,a) /dev/sda1
|
|
Matthew Booth |
afeea6 |
+(0x80) /dev/sda
|
|
Matthew Booth |
afeea6 |
+(128) /dev/sda
|
|
Matthew Booth |
afeea6 |
+(hd2,1)\t/dev/sdb1
|
|
Matthew Booth |
afeea6 |
+"
|
|
Matthew Booth |
afeea6 |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
Matthew Booth |
afeea6 |
index 1e20743..3570c53 100644
|
|
Matthew Booth |
afeea6 |
--- a/tests/Makefile.am
|
|
Matthew Booth |
afeea6 |
+++ b/tests/Makefile.am
|
|
Matthew Booth |
afeea6 |
@@ -23,6 +23,7 @@ lens_tests = \
|
|
Matthew Booth |
afeea6 |
lens-cron.sh \
|
|
Matthew Booth |
afeea6 |
lens-darkice.sh \
|
|
Matthew Booth |
afeea6 |
lens-debctrl.sh \
|
|
Matthew Booth |
afeea6 |
+ lens-device_map.sh \
|
|
Matthew Booth |
afeea6 |
lens-dhclient.sh \
|
|
Matthew Booth |
afeea6 |
lens-dnsmasq.sh \
|
|
Matthew Booth |
afeea6 |
lens-dpkg.sh \
|