Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Dec 2009 23:14:04 +0000 (UTC)
From:      Doug Barton <dougb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r201291 - head/usr.sbin/mergemaster
Message-ID:  <200912302314.nBUNE4GD076016@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dougb
Date: Wed Dec 30 23:14:03 2009
New Revision: 201291
URL: http://svn.freebsd.org/changeset/base/201291

Log:
  Add some patches contributed by jhb:
  1. Don't prompt the user for "-U but no db" error if we're using -a
  2. Add an option to delete stale rc.d files automatically if the user
  has DELETE_STALE_RC_FILES in their rc file. Lack of command line option
  for this is not an oversight.
  3. Add []'s around the terminal $ for the $FreeBSD$ test for -F
  
  For one bug raised by jhb I did a more thorough solution:
  There were a lot of things that "snuck in" between the end of the test
  for -r and the start of the comparison. One of them is the creation of
  the mtree db, as pointed out by jhb. Fix this problem more thoroughly
  by moving the end of the test down to where it should/used to be, right
  before the comparison. As a result, indent the interloping code to match.

Modified:
  head/usr.sbin/mergemaster/mergemaster.sh

Modified: head/usr.sbin/mergemaster/mergemaster.sh
==============================================================================
--- head/usr.sbin/mergemaster/mergemaster.sh	Wed Dec 30 23:01:49 2009	(r201290)
+++ head/usr.sbin/mergemaster/mergemaster.sh	Wed Dec 30 23:14:03 2009	(r201291)
@@ -358,7 +358,11 @@ case "${AUTO_UPGRADE}" in
     echo "    Skipping auto-upgrade on this run."
     echo "    It will be created for the next run when this one is complete."
     echo ''
-    press_to_continue
+    case "${AUTO_RUN}" in
+    '')
+      press_to_continue
+      ;;
+    esac
     unset AUTO_UPGRADE
   fi
   ;;
@@ -665,31 +669,32 @@ case "${RERUN}" in
   for file in ${IGNORE_FILES}; do
     test -e ${TEMPROOT}/${file} && unlink ${TEMPROOT}/${file}
   done
-  ;; # End of the "RERUN" test
-esac
 
-# We really don't want to have to deal with files like login.conf.db, pwd.db,
-# or spwd.db.  Instead, we want to compare the text versions, and run *_mkdb.
-# Prompt the user to do so below, as needed.
-#
-rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd
-
-# We only need to compare things like freebsd.cf once
-find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null
-
-# Delete stuff we do not need to keep the mtree database small,
-# and to make the actual comparison faster.
-find ${TEMPROOT}/usr -type l -delete 2>/dev/null
-find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null
-find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null
+  # We really don't want to have to deal with files like login.conf.db, pwd.db,
+  # or spwd.db.  Instead, we want to compare the text versions, and run *_mkdb.
+  # Prompt the user to do so below, as needed.
+  #
+  rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd
+
+  # We only need to compare things like freebsd.cf once
+  find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null
 
-# Build the mtree database in a temporary location.
-MTREENEW=`mktemp -t mergemaster.mtree`
-case "${PRE_WORLD}" in
-'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null
-    ;;
-*) # We don't want to mess with the mtree database on a pre-world run.
-   ;;
+  # Delete stuff we do not need to keep the mtree database small,
+  # and to make the actual comparison faster.
+  find ${TEMPROOT}/usr -type l -delete 2>/dev/null
+  find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null
+  find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null
+
+  # Build the mtree database in a temporary location.
+  MTREENEW=`mktemp -t mergemaster.mtree`
+  case "${PRE_WORLD}" in
+  '') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null
+      ;;
+  *) # We don't want to mess with the mtree database on a pre-world run or
+     # when re-scanning a previously-built tree.
+     ;;
+  esac
+  ;; # End of the "RERUN" test
 esac
 
 # Get ready to start comparing files
@@ -965,6 +970,12 @@ if [ -z "${PRE_WORLD}" -a -z "${RERUN}" 
       esac
       sleep 2
       ;;
+    *)
+      if [ -n "${DELETE_STALE_RC_FILES}" ]; then
+        echo '      *** Deleting ... '
+        rm ${STALE_RC_FILES}
+        echo '                       done.'
+      fi
     esac
     ;;
   esac
@@ -1093,7 +1104,7 @@ for COMPFILE in `find . -type f | sort`;
       # If the user chose the -F option, test for that before proceeding
       #
       if [ -n "$FREEBSD_ID" ]; then
-        if diff -q -I'[$]FreeBSD:.*$' "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \
+        if diff -q -I'[$]FreeBSD.*[$]' "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \
             /dev/null 2>&1; then
           if mm_install "${COMPFILE}"; then
             echo "*** Updated revision control Id for ${DESTDIR}${COMPFILE#.}"



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