From owner-freebsd-questions@FreeBSD.ORG Sun Mar 29 12:45:26 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9473F10656BD for ; Sun, 29 Mar 2009 12:45:26 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr5.xs4all.nl (smtp-vbr5.xs4all.nl [194.109.24.25]) by mx1.freebsd.org (Postfix) with ESMTP id 402668FC0C for ; Sun, 29 Mar 2009 12:45:25 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr5.xs4all.nl (8.13.8/8.13.8) with ESMTP id n2TCjOcb022090; Sun, 29 Mar 2009 14:45:24 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id 42D57BA9E; Sun, 29 Mar 2009 14:45:24 +0200 (CEST) Date: Sun, 29 Mar 2009 14:45:24 +0200 From: Roland Smith To: Glen Barber Message-ID: <20090329124524.GA48814@slackbox.xs4all.nl> References: <4ad871310903290437q269964d7k54a449f405fb31b2@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline In-Reply-To: <4ad871310903290437q269964d7k54a449f405fb31b2@mail.gmail.com> X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: "freebsd-questions@freebsd.org" Subject: Re: [OT] - Best Practices(TM) for Configuration File Changes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Mar 2009 12:45:27 -0000 --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 29, 2009 at 07:37:27AM -0400, Glen Barber wrote: > Hello, list. >=20 > Before I pose my question, I am not intending to start a flame-war of > any sort -- I'm just searching for "different" ways of doing things. >=20 > With so many different version control systems available (aside from > the traditional "keep current backups" solution), I am curious: >=20 > Q: What is *your* favorite/suggestion solution to keep (working) > versions of configuration files, in case something goes awry? >=20 > I am specifically targeting configuration files because they are what > I change the most, in avoidance of "It worked 10 minutes ago..." > situations. My configuration files are kept in git managed directories under ~/setup/. Every directory is its own repository. The reason that I'm using git is because it does what I need, is small and fast and doesn't require an external reporitory. For configuration files which are usually plain text all revision control systems would probably work OK. Every directory contains two perl scripts, check.pl and install.pl that respectively check the differences between files in the repository and in the filesystem and install files. Both these programs read a file called 'filelist.'. This is a text file that has on every line a file in the reposirory, a permission, and its location in the filesystem (e.g. under /etc or /usr/local/etc for user root, or in $HOME for other users) and any post-install commands. Both scripts only process the filelists for the user that is running the script. Excerpt from filelist.root: # List of files that should be installed as root, # with their install locations. # Time-stamp: <2009-03-04 20:52:39 rsmith> # setup file perm system file commands etc/login.conf 644 /etc/login.conf cap_mkdb /etc/login= =2Econf etc/make.conf 644 /etc/make.conf etc/manpath.config 644 /etc/manpath.config etc/master.passwd 600 /etc/master.passwd pwd_mkdb -p /etc/ma= ster.passwd etc/mergemaster.rc 644 /etc/mergemaster.rc etc/named.conf 644 /var/named/etc/namedb/named.conf etc/ntp.conf 644 /etc/ntp.conf /etc/rc.d/ntpd rest= art The file from the first column is installed in the location in the third column with the permissions listed in the second column. The rest of the line (if any) is interpreted as a list of commands and executed by a subshe= ll. This system makes it easy to see if there are any differences between the configuration files in the repository and the real configuration files (e.g. after a mergemaster run). And it can install every file in its correct place. It also makes sure that users can only install their own files, by reading only that user's filelist. Roland --=20 R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAknPbWQACgkQEnfvsMMhpyVYFgCfYQUsFFrtu28BhN3cCqXhan4p O5EAoIG4yChostMpvrXFKd6dOlZd22p0 =vxoY -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1--