what does it do ?

commitrc is a tool to put your /etc files (and the like) under cvs/svn.

It is useful to see diff in /etc/passwd, routing information, dns zones, to keep an history of what happened to the box. It is also a safe backup of configs when tweaking software behavior.


to add a file :

 $ cd /etc ; commitrc fstab

to commit all files (wherever you are)

 $ commitrc

to diff :

 $ commitrc diff (wherever you are)

to commitrc a specific file already added to cvs :

 $ commitrc ci fstab

to remove 2 files from cvs ;

 $ commitrc rm fstab passwd

to know which files are missing from cvs

 commitrc missing

print files in current directory which are not in commitrc

 commitrc missing ls

list files in current directory which are not in commitrc

 commitrc ls

list files in current directory which are in commitrc

updatec, commitc, diffc : to update, commit, diff common stock (including commitrc)

it can be used with trac when using svn : http://projects.edgewall.com/trac/wiki/TracDownload

a tool yet to be included :

 commitrc_default_files.pl -e

svn / cvs messages

commitrc -m'added the -m option'

track messages

commitrc -m15 will produce the message 're: #15' which connect the commit to the 15th ticket in track




copy commitrc and commitrc-renew-files-svn in /usr/local/bin

 cp commitrc commitrc-renew-files-svn /usr/local/bin


create repository

create your cvsroot if it''s not done already :

 export CVSROOT=/var/cvs
 cvs init

or, with svn :

 svnadmin create --fs-type fsfs /var/svn

in tmp, create your arborescence:

 cd /tmp
 mkdir -p infrastructure/servers infrastructure/tools/common

in common pou will put your stuff common to all boxes. files /etc and /usr will be linked by regen.sh

so, in infrastructure/tools/common/usr/local/bin, copy commitrc

import it :

 cvs import -mn infrastructure infrastructure start


 svn import -mn infrastructure file:///var/svn/infrastructure
 svn import -mn infrastructure (https|svn)://yoursvnhost/infrastructure

delete and try a checkout

 rm -r infrastructure
 svn co file:///var/svn/infrastructure

installing commitrc on a server

operations to do on the cvs server (ie on a checkout, somewhere else)

 machine=`hostname -s`
 cd infrastructure/servers
 mkdir -p $machine/idata

with cvs :

 echo almost empty file for cvs > $machine/idata/cpu && 
 cvs add $machine 
 cvs add $machine/idata 
 cvs add $machine/idata/cpu && 
 cvs ci -m'new' $machine &&

with svn :

 svn add $machine
 svn ci -mn

operation to do on the client machine

if using ssh/cvs :

you could set :

 [ ! -d /root/.ssh ] &&  mkdir /root/.ssh 
echo host yourcvshost >> /root/.ssh/config
echo port  >> /root/.ssh/config

#[ ! -f ~/.ssh/id_rsa ] && ssh-keygen -t rsa -b 2048 [ ! -f ~/.ssh/id_dsa ] && ssh-keygen -P '' -f /root/.ssh/id_dsa -t dsa -b 2048

put your ssh key on the server, with the user you choose : user cvs@yourcvshost

 export CVS_RSH=/usr/bin/ssh
export CVSROOT=:ext:cvs@yourcvshost:/cvs 
mkdir /root/cvs
cd /root/cvs && 
cvs co `hostname -s` &&
cvs co common && 
(cd common &&  ./regen.sh)

or :

 mkdir /root/cvs 
 cd /root/cvs
 svn co file:///var/svn/infrastructure/servers/`hostname -s`
 svn co file:///var/svn/infrastructure/tools/common

 svn co (https|svn)://yoursvnhost/svn/infrastructure/servers/`hostname -s`
 svn co (https|svn)://yoursvnhost/svn/infrastructure/tools/common
 cd common &&  ./regen.sh


WARNINGS vi replace the link by the file ! so never edit a file in /root/cvs cvs 1.11.1p1 from redhat 7.3, debian woody 3.0, chmod the linked file to 644 if it is 664 (ie following umask)

if there is no arguments, every thing in /root/cvs/$hostname is commited

commitrc does not handle $Id / $Log tags ... find /root/cvs/$hostname -type f |grep -v CVS

on multiple boxes at the same time : sleep `perl -e 'print rand(10)'` ; commitrc diff

regen.sh in infrastructure/tools/common

see regen.sh in the distribion files


rewrite in perl ?

commitrc diff |grep -- --- : will list changed files


2.0.4 : added doc

2.0.3 : added doc cleanup better cvs tags finding better commit message

2.0.2 : added commitrc ls

2.0.1 : better comment block. shell is so...