Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Oct 2002 21:22:14 -0600
From:      Chad David <davidc@issci.ca>
To:        "Greg 'groggy' Lehey" <grog@FreeBSD.ORG>
Cc:        Daniel Eischen <eischen@pcnet1.pcnet.com>, "M. Warner Losh" <imp@bsdimp.com>, FreeBSD-current@FreeBSD.ORG
Subject:   Re: Removing old binaries (was: Do we still need portmap(8)?)
Message-ID:  <20021008032214.GA14225@colnta.acns.ab.ca>
In-Reply-To: <20021008010539.GE57557@wantadilla.lemis.com>
References:  <20021007234610.GT14070@wantadilla.lemis.com> <Pine.GSO.4.10.10210072004230.1519-100000@pcnet1.pcnet.com> <20021008010539.GE57557@wantadilla.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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        davidc@acns.ab.ca
www.FreeBSD.org   davidc@freebsd.org
ACNS Inc.         Calgary, Alberta Canada

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mergemaster.patch"

--- /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.

--45Z9DzgjV8m4Oswq--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021008032214.GA14225>