[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Script to keep a history of changes done to /etc/

One of the script I have written as part of my work here at the
University of Oslo is a little fragment to maintain a history of the
changes done in /etc/.  I believe this script can be useful for all
installations, and was allowed to release it as GPL.  Here is the
script.  It require a minor rewrite to go into the debian-edu-config
package.  I'll try to find time to do that unless someone beats me to
it.  Anyone want to improve it?

Share and enjoy.

# Author:  Petter Reinholdtsen
# Date:    2004-09-08
# License: GNU Public License v2 or later at your choice
# Store a copy of /etc/ in CVS, and keep track of changes.  Run this
# script from CVS at least once a day, to track changes.

export CVSROOT


if [ ! -x $CVS ] ; then
    msg="error: Missing $CVS, unable to continue."
    logger -t usit-etcvs "$msg"
    echo $msg
    exit 1

# Bootstrap if running for the first time
if [ ! -d $CVSROOT/CVSROOT ] ; then
    mkdir -p $CVSROOT
    $CVS -d $CVSROOT init

# Limit access
chown root $CVSROOT
chmod 700 $CVSROOT

hostname=`uname -n`
hosttag=`echo $hostname | sed "s/\\./_/g"`
tag=`date +current_%Y%m%dT%H%M`

cd /etc

# We can either import it all
logger -t usit-etcvs "Importing current /etc/ to $CVSROOT"
$CVS -Q -d $CVSROOT import -m "Import current version." \
    etc-$hostname $hosttag $tag

# or we can loop over all files, add new files and commit the change.

Reply to: