From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 12 00:38:40 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FA301065674 for ; Tue, 12 Oct 2010 00:38:40 +0000 (UTC) (envelope-from dteske@vicor.com) Received: from postoffice.vicor.com (postoffice.vicor.com [69.26.56.53]) by mx1.freebsd.org (Postfix) with ESMTP id 087238FC12 for ; Tue, 12 Oct 2010 00:38:39 +0000 (UTC) Received: from [208.206.78.30] (port=50238 helo=dt.vicor.com) by postoffice.vicor.com with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.71) (envelope-from ) id 1P5St0-0000An-Uk; Mon, 11 Oct 2010 17:38:37 -0700 From: Devin Teske To: Russell Jackson In-Reply-To: <4CB3749C.1040000@csub.edu> References: <1286397912.27308.40.camel@localhost.localdomain> <4CB3749C.1040000@csub.edu> Content-Type: text/plain Organization: Vicor, Inc Date: Mon, 11 Oct 2010 17:38:34 -0700 Message-Id: <1286843914.30494.55.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-41.el4) Content-Transfer-Encoding: 7bit X-Scan-Signature: 7cae7f85fe1875c3bbf6d4261624bd4e X-Scan-Host: postoffice.vicor.com Cc: freebsd-hackers@freebsd.org Subject: Re: sysconf -- a sysctl(8)-like utility for managing /etc/rc.conf et. al. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 00:38:40 -0000 On Mon, 2010-10-11 at 13:33 -0700, Russell Jackson wrote: > 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/ > Very cool. However... $ uname -spr FreeBSD 8.1-RELEASE-p1 amd64 $ which augtool $ type augtool -bash: type: augtool: not found Not like I'm running bare... $ pkg_info -Ia | wc -l 399 Unfortunately, augtool doesn't even appear to be packaged for FreeBSD: $ pwd /repos/FreeBSD-8.1/8.1-RELEASE/packages $ ls | head -4 All INDEX MOVED UPDATING $ awk -F'|' '/augtool/ {print $1}' < INDEX $ awk -F'|' '/lexx/ {print $1}' < INDEX lexxia-0.901 $ awk -F'|' '/yacc/ {print $1}' < INDEX afay-041111 byaccj-1.14 ebnf2yacc-0.1.1 lemon-1.69 ruby18-byaccr-0.1 showgrammar-1.1 cocor-1.7_1 Not as a binary package nor could I find it in the ports tree. At this point, we're developing a script that is to be a candidate for inclusion into the base-distribution of FreeBSD, so any/all use of augtool is out unless it gets included in the base OS. Thanks for the heads-up though... looks really powerful. -- Cheers, Devin Teske -> CONTACT INFORMATION <- Business Solutions Consultant II FIS - fisglobal.com 510-735-5650 Mobile 510-621-2038 Office 510-621-2020 Office Fax 909-477-4578 Home/Fax devin.teske@fisglobal.com -> LEGAL DISCLAIMER <- This message contains confidential and proprietary information of the sender, and is intended only for the person(s) to whom it is addressed. Any use, distribution, copying or disclosure by any other person is strictly prohibited. If you have received this message in error, please notify the e-mail sender immediately, and delete the original message without making a copy. -> END TRANSMISSION <-