[augeas-devel] [PATCH] Add gdm lens and associated test

Free Ekanayaka free at 64studio.com
Fri Oct 3 22:08:33 UTC 2008


# HG changeset patch
# User Free Ekanayaka <free at 64studio.com>
# Date 1223071547 -7200
# Node ID 226a302a9ac65304dbe0a7e55c1238f29a5ffc2f
# Parent  5fe81b56ebdbb2b07062196dcbe1d7708df86a7b
Add gdm lens and associated test

diff -r 5fe81b56ebdb -r 226a302a9ac6 lenses/gdm.aug
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lenses/gdm.aug	Sat Oct 04 00:05:47 2008 +0200
@@ -0,0 +1,48 @@
+(* Gdm module for Augeas                       *)
+(* Author: Free Ekanayaka <freek at 64studio.com> *)
+(*                                             *)
+
+module Gdm =
+  autoload xfm
+
+(************************************************************************
+ * INI File settings
+ *************************************************************************)
+
+let comment  = IniFile.comment IniFile.comment_re IniFile.comment_default
+let sep      = IniFile.sep IniFile.sep_re IniFile.sep_default
+let empty    = IniFile.empty
+
+
+(************************************************************************
+ *                        ENTRY
+ * Entry keywords can be bare digits as well (the [server] section)
+ *************************************************************************)
+let entry_re = ( /[A-Za-z0-9][A-Za-z0-9\._-]*/ )
+let entry    = IniFile.entry entry_re sep comment
+
+
+(************************************************************************
+ *                         TITLE
+ *
+ * We use IniFile.title_label because there can be entries
+ * outside of sections whose labels would conflict with section names
+ *************************************************************************)
+let title       = IniFile.title ( IniFile.record_re - /.anon/ )
+let record      = IniFile.record title entry
+
+let record_anon = [ label ".anon" . ( entry | empty )+ ]
+
+
+(************************************************************************
+ *                         LENS & FILTER
+ * There can be entries before any section
+ * IniFile.entry includes comment management, so we just pass entry to lns
+ *************************************************************************)
+let lns    = record_anon? . record*
+
+let filter = (incl "/etc/gdm/gdm.conf*")
+             . Util.stdexcl
+
+let xfm = transform lns filter
+
diff -r 5fe81b56ebdb -r 226a302a9ac6 lenses/tests/test_gdm.aug
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lenses/tests/test_gdm.aug	Sat Oct 04 00:05:47 2008 +0200
@@ -0,0 +1,21 @@
+module Test_gdm =
+
+   let conf = "[daemon]
+# Automatic login, if true the first attached screen will automatically logged
+# in as user as set with AutomaticLogin key.
+AutomaticLoginEnable=false
+AutomaticLogin=
+
+[server]
+0=Standard device=/dev/console
+"
+
+   test Gdm.lns get conf = 
+      { "daemon"
+         { "#comment" = "Automatic login, if true the first attached screen will automatically logged" }
+         { "#comment" = "in as user as set with AutomaticLogin key." }
+	 { "AutomaticLoginEnable"  = "false" }
+	 { "AutomaticLogin" } }
+      {}
+      { "server"
+         { "0" = "Standard device=/dev/console" } }




More information about the augeas-devel mailing list