[augeas-devel] Augeas to parse informational files from install CDs?

David Lutterkort lutter at redhat.com
Thu Jan 20 01:05:40 UTC 2011


Hi Rich,

On Mon, 2011-01-17 at 18:10 +0000, Richard W.M. Jones wrote:
> These files are not in a fixed location, but found relative to the
> mountpoint of the CD.

That means you'll have to set up where to read the files by
manipulating /augeas/load and then issuing an aug_load[1]

> Assuming it is in scope, then here are some examples:
> 
> (1) From Fedora DVD:
> 
> Two files of interest, '/.discinfo' and '/.treeinfo', examples
> attached.  There are many interesting fields, but particularly we'd
> like to read the OS name, version, architecture and disk number.

I am attaching the lens for .discinfo; .treeinfo seems to be a INI-file.
I'll try and cobble sth together from the IniFile module tomorrow
(unless somebody beats me to it).

Basically, entries will go to .treeinfo/$section/$key except for the
stuff in the 'checksums' section since the keys there contain slashes.
That section will need to be treated special.

> (2) From Windows XP - 2003 install CDs:
> 
> We parse a file called '/i386/txtsetup.sif' ('/amd64/txtsetup.sif' on
> x86-64).  These huge text files contain several interesting fields
> describing the CD including:

What a beauty. This should also be tractable with a fairly generic INI
lens.

David

[1] http://augeas.net/page/Loading_specific_files

-------------- next part --------------
(*
  Parse the /.discinfo files contained on Fedora's install media
*)
module Discinfo =

let eol = del "\n" "\n"

let lns =
  let line (l:string) = [ label l . store /.+/ . eol ] in
  let surplus = [ label "surplus" . [ seq "surplus" . store /.+/ . eol ]* ] in
  line "timestamp" .
  line "distro" .
  line "arch" .
  line "media_id" .
  surplus
-------------- next part --------------
module Test_Discinfo =

let s = "1287685820.403779
Fedora 14
x86_64
ALL\n"

test Discinfo.lns get s =
  { "timestamp" = "1287685820.403779" }
  { "distro" = "Fedora 14" }
  { "arch" = "x86_64" }
  { "media_id" = "ALL" }
  { "surplus" }


More information about the augeas-devel mailing list