From owner-freebsd-questions@FreeBSD.ORG Sat Jun 2 11:06:01 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7C49C16A421 for ; Sat, 2 Jun 2007 11:06:01 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr12.xs4all.nl (smtp-vbr12.xs4all.nl [194.109.24.32]) by mx1.freebsd.org (Postfix) with ESMTP id 29D1A13C45D for ; Sat, 2 Jun 2007 11:06:00 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr12.xs4all.nl (8.13.8/8.13.8) with ESMTP id l52B5wns018041; Sat, 2 Jun 2007 13:05:59 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id 81E20B820; Sat, 2 Jun 2007 13:05:58 +0200 (CEST) Date: Sat, 2 Jun 2007 13:05:58 +0200 From: Roland Smith To: Maxim Khitrov Message-ID: <20070602110558.GA16693@slackbox.xs4all.nl> Mail-Followup-To: Maxim Khitrov , freebsd-questions@freebsd.org References: <26ddd1750706011227g224eaa1dh93233400c704595e@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tKW2IUtsqtDRztdT" Content-Disposition: inline In-Reply-To: <26ddd1750706011227g224eaa1dh93233400c704595e@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.15 (2007-04-06) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: freebsd-questions@freebsd.org Subject: Re: Recommendations for config file revision control 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: Sat, 02 Jun 2007 11:06:01 -0000 --tKW2IUtsqtDRztdT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 01, 2007 at 03:27:57PM -0400, Maxim Khitrov wrote: > Hi everyone, >=20 > I'm currently setting up a new server, and I'd like to keep track of > all changes made to various config files (in /etc, /usr/local/etc, and > a few other places perhaps). My first thought was to setup a > subversion server which would contain the partial directory structure > that matches that of the server's starting at /. It would contain > versioned copies of all the configuration files that I want to keep > track of in their appropriate locations. What I would do then is write > a hook for subversion that will issue an automatic export command > (don't want .svn directories everywhere) every time a commit is made > to the repository. So to edit some configuration file I would first > checkout a working copy of the repository to some other location, make > the change and commit it. The server would be automatically updated > with the new file and I would be able to keep track of every change. Because I didn't want my config file all over the place, I've put them in a directory tree called ~/setup, with subdirectories for etc, boot, kernel configuration etc. This directory tree is managed with git, because you don't have to check in every single file like with RCS. So e.g. all the changes that I did for the Xorg upgrade are captured in a single commit. Since git doesn't support keyword expansion, and I always use emacs for editing, I use emacs's time-stamp facility to keep the time and date of the last save. I use an install script to install the config files where they belong, and take appropriate post-install action. One could put the directories like /etc under git's direct control as well. That would save the installation step, and capture any system-made modifications with git-status. But you'd have to manage the repository as root. ----------------- install script for /etc config files --------------------= -- #!/bin/sh # Shell script to facilitate installing files. # Time-stamp: <2007-05-20 21:32:43 rsmith> # Installs a normal file. I () { install -b -v -p -m 644 $1 $2 |grep install || { return 1 } } # Files that need to be installed as root go here. do_root() { I devfs.conf /etc I devfs.rules /etc I fbtab /etc I fstab /etc I passwd /etc I group /etc I hosts /etc I login.conf /etc && cap_mkdb /etc/login.conf I csh.cshrc /etc I cshrc.root /root/.cshrc I login.access /etc I locate.rc /etc I manpath.config /etc I motd /etc I periodic.conf /etc I pkgtools.conf /usr/local/etc I portmaster.rc /etc I profile /etc I rc.conf /etc I pf.conf /etc && /etc/rc.d/pf reload I ntp.conf /etc && /etc/rc.d/ntpd restart I rc.shutdown.local /etc I resolv.conf /etc I sysctl.conf /etc I ttys /etc I make.conf /etc I newsyslog.conf /etc I mtools.conf /usr/local/etc I smartd.conf /usr/local/etc I cdrecord /usr/local/etc I esd.conf /usr/local/etc # X11 config files cd X11 I xorg.conf /etc/X11 cd .. # SANE config files. cd sane I dll.conf /usr/local/etc/sane.d I epson.conf /usr/local/etc/sane.d cd .. # Install root's crontab file if ! crontab -l|diff - crontab.root >/dev/null; then echo "Updating crontab." crontab -u root crontab.root fi } # Main program if [ `id -u` -eq 0 ]; then do_root fi ----------------- install script for /etc config files --------------------= -- 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) --tKW2IUtsqtDRztdT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.3 (FreeBSD) iD8DBQFGYU8WEnfvsMMhpyURAiqkAJ9bbR7AnXXecQrZvlKLv7imNzFdEQCfQ0JN 0pnZlMke8Qj0PiFc9suoR8E= =YKAw -----END PGP SIGNATURE----- --tKW2IUtsqtDRztdT--