From owner-freebsd-bugs Wed May 27 05:41:49 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA20455 for freebsd-bugs-outgoing; Wed, 27 May 1998 05:41:49 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from goliath.camtech.net.au (goliath.camtech.net.au [203.5.73.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA20437; Wed, 27 May 1998 05:41:34 -0700 (PDT) (envelope-from thyerm@camtech.net.au) Received: from camtech.net.au (dialup-ad-5-13.camtech.net.au [203.28.0.173]) by goliath.camtech.net.au (8.8.5/8.8.2) with ESMTP id WAA07711; Wed, 27 May 1998 22:08:24 +0930 (CST) Message-ID: <356C0A01.CB451BD7@camtech.net.au> Date: Wed, 27 May 1998 22:11:37 +0930 From: Matthew Thyer X-Mailer: Mozilla 4.05 [en] (X11; U; FreeBSD 3.0-CURRENT i386) MIME-Version: 1.0 To: Poul-Henning Kamp CC: freebsd-bugs@FreeBSD.ORG Subject: Re: misc/5147 References: <199805270952.CAA17930@freefall.freebsd.org> Content-Type: multipart/mixed; boundary="------------7C1D6C18EB242300A336CE93" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org This is a multi-part message in MIME format. --------------7C1D6C18EB242300A336CE93 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I include version 1.9 of my etcud script I use to help me see whats changed with the files in /usr/src/etc. Sure I admit its a bit of a hack but at least it works for all platforms now. I think other peoples efforts in this field are more 'correct' e.g. ``Making the world'' your own by: Nik Clayton, Kees Jan Koster, A Joseph Kosy, Greg Lehey, Wes Peters, Joseph Stein, and Studded, But I get the feeling that what people really do is see what's changed in /usr/src/etc and compare it with /etc (as well as reading the lists). That's what this script does (except for reading the lists ;) ). You can close the PR as I see that there is at least a mention that the Makefile should be read: http://www.FreeBSD.org/handbook/handbook259.html But maybe you'd like to include mention of ``Making the world'' your own or my script in the handbook as the above entry is barely noticeable. -- /=====================================================================\ |Work: Matthew.Thyer@dsto.defence.gov.au | Home: thyerm@camtech.net.au| \=====================================================================/ --------------7C1D6C18EB242300A336CE93 Content-Type: text/plain; charset=us-ascii; name="etcud" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="etcud" #!/bin/sh # # etcud 1.9 - Compare /etc with /usr/src/etc to check for updated files (for # this machines hardware platform). # # etcud [-a] [-v] [-d] [-n] [-t] [-r ] [-i | -e ] # # This script compares the MD5 checksums of all files found in the etc # directory of the source distribution (/usr/src/etc by default) with # those in /etc to alert you when /etc files need updating. # # Options: # # -a Also output information for files where the checksums match. # -v Display RCS version strings if present. # -d Display diffs between the files. # -n Non-exact mode. i.e. dont use '-x' with egrep for inclusion # and exclusion patterns. For power users only! # -t Typical usage. This is the same as etcud -e $DEF_EXCL # -r Set the root directory of the source distribution. # -i Inclusion filename pattern (those files to check). # -e Exclusion filename pattern (those file to ignore). # # Inclusion and exclusion patterns must be an egrep pattern which is a list # of file names separated by the pipe character. The filenames must be # relative to the etc directory of the source distribution (/usr/src/etc # by default). # # By default the script will use egrep -x which means the patterns must # exactly match for the files to be included or excluded. This is # generally what you want as you probably want to be able to type # "etcud -e hosts" to exclude the file /etc/hosts but not the file # /etc/hosts.lpd. Power users can use -n to disable the use of -x # with egrep. This can be useful when dealing with the ppp directory # for example. # # NOTES # - You can use EITHER an exclusion OR an inclusion file pattern, not # both. Subsequent uses will be ignored with a warning. # # - Use of the typical option (-t) will run etcud with the default # exclusion pattern, set at $DEF_EXCL below. This mode overrides # any previously specified inclusion or exclusion patterns with a # warning. This mode also silently ignores -n. # # - Version 1.9 knows what this platform is for dealing with etc.i386/ttys etc. # it ignores subdirectories in /usr/src/etc that start with 'etc.' other # than etc.`uname -m` (by default). # # - Previous versions were not worth mentioning (including my first attempt # sent in as a pr). # # AUTHOR: Matthew Thyer 1997, 1998 # ############################################################################### # The default directory for the source distribution DEF_SRC_ROOT=/usr/src # The typical exclusion list DEF_EXCL="group|hosts|motd|shells|rc.local|master.passwd" # # You shouldn't change this unless you want to make your /etc for another # platform (e.g. put PLATFORM=alpha) PLATFORM=`uname -m` # opt_all=0 opt_ver=0 opt_diffs=0 opt_non_exact=0 opt_typical=0 opt_inc=0 opt_exc=0 error=0 cmd_name=`basename $0` usage () { echo "Usage: $cmd_name [-a] [-v] [-d] [-n] [-t] [-r ] [-i | -e ]" echo " -a Also output information for files where the checksums match" echo " -v Display RCS version strings if present" echo " -d Display diffs between the files" echo " -n Non-exact mode - i.e. dont use '-x' with egrep" echo " -t Typical usage. This is the same as etcud -e \"$DEF_EXCL\"" echo " -r Directory where the source distribution is found" echo " -i Inclusion filename pattern (those files to check)" echo " -e Exclusion filename pattern (those file to ignore)" } show_ver () { the_ver=`grep '$Id:' $src_files/$x` if [ $? -eq 0 ] ; then echo "$src_files/$x VER> $the_ver" fi the_ver=`grep '$Id:' $the_file` if [ $? -eq 0 ] ; then echo " $the_file VER> $the_ver" fi } do_check () { # First determine if we should check this file (and what its home is) case $x in etc\.${PLATFORM}/MAKEDEV) the_file=/dev/MAKEDEV ;; etc\.${PLATFORM}/*) the_file=/etc/`echo $x | awk -F/ '{print $NF}'` ;; etc\.*/*) the_file=SKIP ;; *Makefile) the_file=SKIP ;; MAKEDEV\.local) the_file=/dev/MAKEDEV.local ;; *) the_file=/etc/$x ;; esac if [ $the_file != SKIP ] ; then if [ -r $the_file ] ; then if [ `md5 $the_file | cut -d' ' -f4` != `md5 $src_files/$x | cut -d' ' -f4` ] ; then echo MISMATCH for $src_files/$x $the_file if [ $opt_ver -eq 1 ] ; then show_ver fi if [ $opt_diffs -eq 1 ] ; then diff $the_file $src_files/$x echo fi elif [ $opt_all -eq 1 ] ; then echo CHECK OK for $src_files/$x $the_file if [ $opt_ver -eq 1 ] ; then show_ver fi fi else # the file is not readable.... why ? perhaps it doesn't exist if [ ! -f $the_file ] ; then echo NONEXISTANT $the_file. Maybe you should cp -p $src_files/$x $the_file else echo -n $the_file is not readable.... fi fi fi } # The main program begins..... # First get the options while [ $# -ne 0 ] ; do case $1 in -a) opt_all=1 ;; -v) opt_ver=1 ;; -d) opt_diffs=1 ;; -n) opt_non_exact=1 ;; -t) opt_typical=1 if [ $opt_inc -eq 1 -o $opt_exc -eq 1 ] ; then echo "Warning: Typical usage overriding prior inclusion or exclusion pattern" opt_inc=0 fi opt_exc=1 patt=$DEF_EXCL ;; -r) shift if [ $# -eq 0 ] ; then error=1 echo "Error: -r requires an argument" usage break else if [ -d $1 ] ; then SRC_ROOT=$1 else error=1 echo "Error: Source directory \"$1\" does not exist" usage break fi fi ;; -i) shift if [ $# -eq 0 ] ; then error=1 echo "Error: -i requires an argument" usage break else if [ $opt_inc -eq 1 -o $opt_exc -eq 1 ] ; then echo "Warning: subsequent inclusion pattern ignored" else patt=$1 opt_inc=1 fi fi ;; -e) shift if [ $# -eq 0 ] ; then error=1 echo "Error: -e requires an argument" usage break else if [ $opt_inc -eq 1 -o $opt_exc -eq 1 ] ; then echo "Warning: subsequent exclusion pattern ignored" else patt=$1 opt_exc=1 fi fi ;; *) error=1 usage break ;; esac shift done if [ $error -eq 1 ] ; then exit fi src_files=`echo ${SRC_ROOT:=$DEF_SRC_ROOT}/etc | sed 's/\/\/$//'` cd $src_files # Can only do non_exact mode if we are not doing a typical egrep_flags="-x" if [ $opt_non_exact -eq 1 -a $opt_typical -eq 0 ] ; then egrep_flags="" fi if [ $opt_exc -eq 1 ] ; then egrep_flags=$egrep_flags" -v " fi if [ $opt_inc -eq 1 -o $opt_exc -eq 1 ] ; then find . -type f -exec echo {} \; | sed 's/^\.\///' | egrep $egrep_flags $patt | while read x ; do do_check done else find . -type f -exec echo {} \; | sed 's/^\.\///' | while read x ; do do_check done fi --------------7C1D6C18EB242300A336CE93-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message