From owner-freebsd-questions@FreeBSD.ORG Sat Sep 25 02:11:26 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BC9C106566B for ; Sat, 25 Sep 2010 02:11:26 +0000 (UTC) (envelope-from vogelke@hcst.net) Received: from beta.hcst.com (beta.hcst.com [192.52.183.241]) by mx1.freebsd.org (Postfix) with ESMTP id D6AE78FC08 for ; Sat, 25 Sep 2010 02:11:25 +0000 (UTC) Received: from beta.hcst.com (localhost [127.0.0.1]) by beta.hcst.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o8P1qTkP000837 for ; Fri, 24 Sep 2010 21:52:29 -0400 Received: (from vogelke@localhost) by beta.hcst.com (8.14.3/8.14.3/Submit) id o8P1qTRH000836; Fri, 24 Sep 2010 21:52:29 -0400 Received: by kev.msw.wpafb.af.mil (Postfix, from userid 32768) id 38206BF5F; Fri, 24 Sep 2010 21:50:48 -0400 (EDT) To: freebsd-questions@freebsd.org In-reply-to: (message from David Allen on Fri, 24 Sep 2010 15:04:45 -0800) Organization: Array Infotech X-Disclaimer: I don't speak for the USAF or Array Infotech. X-GPG-ID: 1024D/711752A0 2006-06-27 Karl Vogel X-GPG-Fingerprint: 56EB 6DBF 4224 C953 F417 CC99 4C7C 7D46 7117 52A0 References: Message-Id: <20100925015049.38206BF5F@kev.msw.wpafb.af.mil> Date: Fri, 24 Sep 2010 21:50:48 -0400 (EDT) From: vogelke+unix@pobox.com (Karl Vogel) Subject: Re: Multiple Machines X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vogelke+unix@pobox.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2010 02:11:26 -0000 >> On Fri, 24 Sep 2010 15:04:45 -0800, >> David Allen said: D> I'm wondering what folks are doing when setting up multiple (more than D> 1, but less than 10) machines. Consider, for example, some ordinary D> files such as the following: D> /root/.cshrc /home/username/.bashrc The first thing I'd recommend for root and home dotfiles is placing them under revision control. I'm (slowly) moving to GIT, but for now RCS does the trick just fine: me% echo $RCSINIT -zLT me% ident .vimrc .zshrc .vimrc: $Revision: 1.40 $ $Date: 2010-08-16 15:02:52-04 $ $Source: /home/vogelke/RCS/.vimrc,v $ $Host: example.org $ $UUID: a4f4bf9d-514d-37c7-a0e1-04b41434e869 $ .zshrc: $Revision: 1.21 $ $Date: 2010-09-24 20:13:04-04 $ $Source: /home/vogelke/RCS/.zshrc,v $ $Host: example.org $ $UUID: da56ec7f-14be-39b5-8583-d31b5afb80eb $ I use the RCSINIT environment variable to prepend "-zLT" to the argument list for rcs commands so I get dates in localtime with the timezone appended. A short script called "mkrcs" creates the RCS strings shown above; I like including the FQDN of the host on which the file was created, along with a random UUID. After I get a set of dotfiles I'm happy with, I usually make separate tarballs for regular users and root. D> /etc/fstab /etc/resolv.conf /etc files go under revision control with an extra step; just after installation, back up /etc. root# cd /etc root# mkdir /etc.orig root# find . -depth -print | pax -rwd -pe /etc.orig I also get a signature of all installed files: root# cd / root# find . -type f -print | grep -v '^./proc/' | sort | xargs md5 -r This goes in /root/orig.md5 after stripping out /tmp, /var/tmp, /var/log, /var/run, etc. D> Some files are identical, some require different permissions, and some D> (like fstab) consist of customizations that need to be added. Short of D> enabling root ssh logins or writing makefiles, what would be the best D> approach to handing the above? Any system I maintain gets a directory called "/doc/sitelog/hostname". Tarballs, patches, etc. all go under that directory. If I upgrade a system or install a similar one, the tarballs and patches handle most of the gruntwork. I use a script like the one below to figure out what files I've added to (or removed from) /etc and make patches for the modified files. Patches go in their own /tmp/work$$ directory and look like this: root# cat /tmp/work81394/etc-shells *** /etc.orig/shells Sun May 7 00:00:23 2006 --- /etc/shells Wed Sep 9 21:06:04 2009 *************** *** 6,9 **** --- 6,13 ---- /bin/sh /bin/csh + /bin/ksh /bin/tcsh + /bin/bash + /usr/local/bin/ksh + /usr/local/bin/zsh -- Karl Vogel I don't speak for the USAF or my company Hopefully digesting of this tasty post would not cause too much of farting. --Yaroslav Halchenko, after reading a good debian-users message --------------------------------------------------------------------------- #!/bin/sh # $flist echo "results in $work" >$2 for x in `cat $flist` do cur="/etc/$x" orig="/etc.orig/$x" if test -f "$cur" -a -f "$orig"; then patch=`echo $cur | sed -e 's!^/!!' -e 's!/!-!g'` cmp -s $orig $cur || diff -c $orig $cur > $work/$patch elif test -f "$cur"; then echo ADD: $cur elif test -f "$orig"; then echo DEL: $cur fi done rm $flist exit 0