Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jun 2007 13:05:58 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        Maxim Khitrov <mkhitrov@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Recommendations for config file revision control
Message-ID:  <20070602110558.GA16693@slackbox.xs4all.nl>
In-Reply-To: <26ddd1750706011227g224eaa1dh93233400c704595e@mail.gmail.com>
References:  <26ddd1750706011227g224eaa1dh93233400c704595e@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



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