On Tue, Dec 11, 2001 at 07:51:39PM -0800, Christopher Maujean wrote:
> I was wondering how many people kept their /etc under CVS control. I
> haven't found any cons to it so far, but it's not mentioned in any of my
> "sysadmin" books. Are there reasons (besides not wanting to take the
> extra steps to change a config file, and the potential security hole
> generated by not properly configuring the CVS pserver) not to? 

I don't keep /etc under CVS, but it does sound like a good idea ...

Except ... 

It could be a PITA to put $Id$ tags in every file, and make sure they 
don't affect the workings of the file.

(most) package managers (OpenBSD has a policy that forbids fiddling with 
/etc, instead, new versions of config files are installed to 
$PREFIX/share/examples/$name_of_pkg) keep track of files in /etc and 
modifying them could lead to more PITAes at update/upgrade time

But, how many config files do you really need to keep tabs on?  It might
be easier to just write a sh or perl script, or Makefile for that matter,
to copy the files you want to save to a safe place and then maybe even 
automatically produce diffs of your version vs the default version?

I could like something like that ...

/ec/Makefile.lo-tek
*-----------------*
DIR=    /etc

FILES=  rc.conf.local rc.local rc.shutdown mail/sendmail.cf mail/aliases \
        hosts group passwd fstab sshd_config

XDIRS=  mail

SAVE_DIR= /var/save/root

DIFF_DIR= /var/save/diffs

INSTALL_DATA= /usr/bin/install -c -m 444

INSTALL_DIR= /usr/bin/install -d

save-dir:
        test -d ${SAVE_DIR} || ${INSTALL_DIR} ${SAVE_DIR}

xdirs:
.for i in ${XDIRS}
        ${INSTALL_DIR} ${SAVE_DIR}/${i}
.endfor

save: save-dir xdirs
.for i in ${FILES}
        ${INSTALL_DATA} ${DIR}/${i} ${SAVE_DIR}/${i}
.endfor

update: save
        echo "garbage" >> /etc/hosts
        echo "Eugene\nUnix\nand\nGNU\n/Linux\nUsers\nGroup\nwas\nhere!" \
                >> /etc/mail/sendmail.cf
        # as "for example"s, more interesting would be
        # cd / && tar zxpvf /pub/EUGLIX/etc01.tgz
        # apt-get update && apt-get upgrade
        # but then, these .for loops don't work
        # with GNU make (wouldn't be hard to "port"
        # though)

diff-dir:
        ${INSTALL_DIR} ${DIFF_DIR}

diff: update diff-dir
.for i in ${FILES}
        cmp -s ${DIR}/${i} ${SAVE_DIR}/${i} || \
        diff -u ${DIR}/${i} ${SAVE_DIR}/${i} > \
                ${DIFF_DIR}/${i:S/\//-/g}.diff || /usr/bin/true
.endfor

recover: diff
.for i in ${FILES}
        test -f ${DIFF_DIR}/${i:S/\//-/g}.diff && \
                patch -p 0 < ${DIFF_DIR}/${i:S/\//-/g}.diff || \
                /usr/bin/true
.endfor
*------------------*

-- 
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>

Reply via email to