From owner-freebsd-current Mon Oct 7 20:23: 4 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A2F9C37B401; Mon, 7 Oct 2002 20:22:59 -0700 (PDT) Received: from colnta.acns.ab.ca (mail.acns.ab.ca [142.179.151.95]) by mx1.FreeBSD.org (Postfix) with ESMTP id 381D743E97; Mon, 7 Oct 2002 20:22:56 -0700 (PDT) (envelope-from davidc@colnta.acns.ab.ca) Received: from colnta.acns.ab.ca (localhost [127.0.0.1]) by colnta.acns.ab.ca (8.12.6/8.12.5) with ESMTP id g983MFmI014395; Mon, 7 Oct 2002 21:22:16 -0600 (MDT) (envelope-from davidc@colnta.acns.ab.ca) Received: (from davidc@localhost) by colnta.acns.ab.ca (8.12.6/8.12.6/Submit) id g983MEuh014394; Mon, 7 Oct 2002 21:22:14 -0600 (MDT) Date: Mon, 7 Oct 2002 21:22:14 -0600 From: Chad David To: "Greg 'groggy' Lehey" Cc: Daniel Eischen , "M. Warner Losh" , FreeBSD-current@FreeBSD.ORG Subject: Re: Removing old binaries (was: Do we still need portmap(8)?) Message-ID: <20021008032214.GA14225@colnta.acns.ab.ca> Mail-Followup-To: Greg 'groggy' Lehey , Daniel Eischen , "M. Warner Losh" , FreeBSD-current@FreeBSD.ORG References: <20021007234610.GT14070@wantadilla.lemis.com> <20021008010539.GE57557@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="45Z9DzgjV8m4Oswq" Content-Disposition: inline In-Reply-To: <20021008010539.GE57557@wantadilla.lemis.com> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --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