Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2010 13:33:32 -0700
From:      Russell Jackson <raj@csub.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Re: sysconf -- a sysctl(8)-like utility for managing /etc/rc.conf et.	al.
Message-ID:  <4CB3749C.1040000@csub.edu>
In-Reply-To: <1286397912.27308.40.camel@localhost.localdomain>
References:  <1286397912.27308.40.camel@localhost.localdomain>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/06/2010 01:45 PM, Devin Teske wrote:
> Hello fellow freebsd-hackers,
>
> Long-time hacker, first-time poster.
>
> I'd like to share a shell script that I wrote for FreeBSD system
> administration.
>
> The attached shell script works similar to sysctl(8), but rather than
> querying or working on sysctl MIBs, it instead works on the /etc/rc.conf
> (and /etc/rc.conf.local) files.
>

Have you looked at textproc/augeas? It's a more generic and extensible 
way to edit plain text configuration files programmatically using an 
xpath like syntax.

Example

# augtool get /files/etc/rc.conf/sshd_enable
/files/etc/rc.conf/sshd_enable = YES
# printf 'set /files/etc/rc.conf/sshd_enable NO\nsave\n' | augtool
# augtool get /files/etc/rc.conf/sshd_enable
/files/etc/rc.conf/sshd_enable = NO


The tool itself is written in C and has no external dependencies. It is 
taught file grammar via "lenses" which are like formal language specs 
written in BNF.

http://augeas.net/

-- 
Russell A Jackson <raj@csub.edu>
Network Analyst
California State University, Bakersfield



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CB3749C.1040000>