[augeas-devel] FreeBSD /etc/rc.conf

Richard W.M. Jones rjones at redhat.com
Thu Nov 18 10:49:27 UTC 2010


On Thu, Nov 18, 2010 at 10:55:38AM +0100, Raphaël Pinson wrote:
> You can certainly use shellvars.aug to parse this file. Add /etc/rc.conf
> to filter_misc in shellvars.aug, see if it works and send the patch.

Yes, that simple change does work.  Attached is a formal patch.

$ sudo guestfish --ro -d FreeBSD8x64

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

><fs> run
><fs> mount-vfs ro,ufstype=ufs2 ufs /dev/vda5 /
><fs> aug-init / 0
><fs> aug-ls /files/etc
/files/etc/aliases
/files/etc/crontab
/files/etc/fstab
/files/etc/group
/files/etc/hosts
/files/etc/inetd.conf
/files/etc/ntp.conf
/files/etc/pam.d
/files/etc/rc.conf
/files/etc/services
/files/etc/ssh
/files/etc/sysctl.conf
><fs> aug-ls /files/etc/rc.conf
/files/etc/rc.conf/#comment[1]
/files/etc/rc.conf/#comment[2]
/files/etc/rc.conf/#comment[3]
/files/etc/rc.conf/#comment[4]
/files/etc/rc.conf/#comment[5]
/files/etc/rc.conf/hostname
/files/etc/rc.conf/ifconfig_re0
/files/etc/rc.conf/keymap
/files/etc/rc.conf/sshd_enable
><fs> aug-get /files/etc/rc.conf/hostname
"freebsd8x64.home.annexia.org"

Note the quotes around the name.  I have noticed the same thing when
parsing /etc/sysconfig/keyboard using Augeas.  That is also a "shell
script" configuration file (although probably not containing shell
commands in 99% of cases).

Do you consider the presence of quotes to be a bug?

Could Augeas cope if I changed this setting to a string which
contained spaces but was not quoted?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
-------------- next part --------------
>From 1ff3b05c7f5fa7afc4a03cf8b1f6006787f3693d Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones at redhat.com>
Date: Thu, 18 Nov 2010 10:48:19 +0000
Subject: [PATCH] Add FreeBSD /etc/rc.conf file to Shellvars lens.

---
 lenses/shellvars.aug |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
index 86423bd..86790a5 100644
--- a/lenses/shellvars.aug
+++ b/lenses/shellvars.aug
@@ -103,6 +103,7 @@ module Shellvars =
   let filter_misc    = incl "/etc/arno-iptables-firewall/debconf.cfg"
                      . incl "/etc/cron-apt/config"
                      . incl "/etc/environment"
+                     . incl "/etc/rc.conf"
 
   let filter = filter_sysconfig
              . filter_ifcfg
-- 
1.7.3.2



More information about the augeas-devel mailing list