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 <r...@csub.edu>
Network Analyst
California State University, Bakersfield
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"