On Tue, Oct 08, 2002 at 10:35:39AM +0930, Greg 'groggy' Lehey wrote:
> On Monday,  7 October 2002 at 20:07:37 -0400, Daniel Eischen wrote:
> > On Tue, 8 Oct 2002, Greg 'groggy' Lehey wrote:
> >
> > I'd prefer this as a job for mergemaster, asking you confirmation
> > for each binary.
> 
> I'd much rather not have to do *anything* manually.  That includes
> updating /etc, but that's a much larger can of worms.

A year of so ago I made the following updates to mergemaster to solve
(some of) this problem for me.  Its very simple and I'm sure its not for
everybody (and that it doesn't apply cleanly to the current mergemaster),
but I think the idea is sound.

This is the config that I use (for example):

ignore://etc/crontab/
ignore://etc/shells/
ignore://etc/inetd.conf/
ignore://etc/motd/
ignore://etc/sysctl.conf/
igrore://etc/syslog.conf
ignore://etc/passwd/
ignore://etc/master.passwd/
ignore://etc/group/
ignore://etc/printcap/
ignore://etc/ntp.conf/
ignore://etc/exports/
...

-- 
Chad David        [EMAIL PROTECTED]
www.FreeBSD.org   [EMAIL PROTECTED]
ACNS Inc.         Calgary, Alberta Canada
--- /usr/home/davidc/dev/bsd/src/usr.sbin/mergemaster/mergemaster.sh    Mon Aug 27 
17:41:23 2001
+++ mergemaster Mon Sep  3 18:56:56 2001
@@ -15,8 +15,8 @@
 display_usage () {
   VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`
   echo "mergemaster version ${VERSION_NUMBER}"
-  echo 'Usage: mergemaster [-scrvahi] [-m /path]'
-  echo '         [-t /path] [-d] [-u N] [-w N] [-D /path]'
+  echo 'Usage: mergemaster [-scrvahiAX] [-m /path]'
+  echo '         [-t /path] [-d] [-u N] [-w N] [-D /path] [-C /path]'
   echo "Options:"
   echo "  -s  Strict comparison (diff every pair of files)"
   echo "  -c  Use context diff instead of unified diff"
@@ -31,9 +31,49 @@
   echo "  -u N  Specify a numeric umask"
   echo "  -w N  Specify a screen width in columns to sdiff"
   echo '  -D /path/directory  Specify the destination directory to install files to'
+  echo "  -A Process files automatically from the mergemaster auto config file" 
+  echo "  -C /path/auto_config_file  Specify location of auto config file to use" 
+  echo "  -X In the case of -A set the default to install.  Normally the default is 
+ignore"
   echo ''
 }
 
+PROC_AUTO_CONF_FILE=/etc/mergemaster_auto.conf
+PROC_AUTO_RET_ERROR=-1
+PROC_AUTO_RET_DEFAULT=0
+PROC_AUTO_RET_IGNORE=1
+PROC_AUTO_RET_INSTALL=2
+PROC_AUTO_RET_DELETE=3
+
+proc_auto_check_file () {
+  F=$1
+
+  if [ ! -f ${PROC_AUTO_CONF_FILE} ] ; then
+    return ${PROC_AUTO_RET_ERROR}
+  fi
+
+  FL=`grep \/${F}\/ ${PROC_AUTO_CONF_FILE}`
+
+  if [ ${#FL} -le 0 ] ; then
+    return ${PROC_AUTO_RET_DEFAULT}
+  fi
+
+  ACT=`echo ${FL} | cut -f 1 -d :`
+  case "${ACT}" in
+    "ignore" | "IGNORE")
+      return ${PROC_AUTO_RET_IGNORE}
+      ;;
+    "install" | "INSTALL")
+      return ${PROC_AUTO_RET_INSTALL}
+      ;;
+    "delete" | "DELETE")
+      return ${PROC_AUTO_RET_DELETE}
+      ;;
+    *)
+      return ${PROC_AUTO_RET_DEFAULT}
+      ;;
+  esac
+}
+
 display_help () {
   echo "* To specify a directory other than /var/tmp/temproot for the"
   echo "  temporary root environment, use -t /path/to/temp/root"
@@ -226,8 +266,20 @@
 
 # Check the command line options
 #
-while getopts ":ascrvhim:t:du:w:D:" COMMAND_LINE_ARGUMENT ; do
+while getopts ":ascrvhim:t:du:w:D:AC:X" COMMAND_LINE_ARGUMENT ; do
   case "${COMMAND_LINE_ARGUMENT}" in
+  A)
+    PROC_AUTO=yes
+    AUTO_RUN=yes
+       AUTO_INSTALL=yes
+    unset VERBOSE
+  ;;
+  C)
+    PROC_AUTO_CONF_FILE=${OPTARG}
+    ;;
+  X)
+    PROC_AUTO_DEFAULT_TO_INSTALL=yes
+    ;;
   s)
     STRICT=yes
     ;;
@@ -673,7 +725,7 @@
       unset DONT_INSTALL
       ;;
     esac
-  else # File matched -x
+  else  # File matched -x
     case "${1#.}" in
     /dev/MAKEDEV)
       NEED_MAKEDEV=yes
@@ -699,6 +751,44 @@
 # check the scripts in ./dev, as we'd like (assuming no devfs of course).
 #
 for COMPFILE in `find . -type f -size +0`; do
+
+  # If set to "yes", then ignore normal processing XXXCPD
+  if [ x${PROC_AUTO} = "xyes" ] ; then
+    proc_auto_check_file ${COMPFILE#.}
+    _PROC_AUTO_CHECK_RET=$?
+
+    if [ ${_PROC_AUTO_CHECK_RET} -eq ${PROC_AUTO_RET_ERROR} ] ; then
+      echo proc_auto_check_file failed
+      exit 1
+    elif [ ${_PROC_AUTO_CHECK_RET} -eq ${PROC_AUTO_RET_DEFAULT} ] ; then
+         echo proc_auto_ret_default for ${COMPFILE}
+      if [ x${PROC_AUTO_DEFAULT_TO_INSTALL} = "xyes" ] ; then
+               echo default to install is set to yes
+        if ! mm_install ${COMPFILE} ; then
+          echo mm_install failed
+          exit 1
+        fi
+      else
+        continue
+      fi
+    elif [ ${_PROC_AUTO_CHECK_RET} -eq ${PROC_AUTO_RET_INSTALL} ] ; then
+         echo proc_auto_ret_install for ${COMPFILE}
+      if ! mm_install ${COMPFILE} ; then
+        echo mm_install failed
+        exit 1
+      fi
+    elif [ ${_PROC_AUTO_CHECK_RET} -eq ${PROC_AUTO_RET_IGNORE} ] ; then
+         echo proc_auto_ret_ignore for ${COMPFILE}
+      continue
+    elif [ ${_PROC_AUTO_CHECK_RET} -eq ${PROC_AUTO_RET_DELETE} ] ; then
+         echo proc_auto_ret_delete for ${COMPFILE}
+      rm -f ${COMPFILE}
+    else
+      proc_auto_check_file returned an invalid result
+      exit 1
+    fi
+    continue
+  fi
 
   # First, check to see if the file exists in DESTDIR.  If not, the
   # diff_loop function knows how to handle it.

Reply via email to