summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mergemaster
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2009-12-30 23:14:03 +0000
committerdougb <dougb@FreeBSD.org>2009-12-30 23:14:03 +0000
commit4f1a52f3e8ed618f35790bb65d28445b14c967de (patch)
tree106cafd49f1fb76cc337155ae1ac872be5778148 /usr.sbin/mergemaster
parentc056a4415da4cfa7c0dfa135980513b773bfccea (diff)
downloadFreeBSD-src-4f1a52f3e8ed618f35790bb65d28445b14c967de.zip
FreeBSD-src-4f1a52f3e8ed618f35790bb65d28445b14c967de.tar.gz
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.
Diffstat (limited to 'usr.sbin/mergemaster')
-rwxr-xr-xusr.sbin/mergemaster/mergemaster.sh57
1 files changed, 34 insertions, 23 deletions
diff --git a/usr.sbin/mergemaster/mergemaster.sh b/usr.sbin/mergemaster/mergemaster.sh
index 7a33c4d..5703bf3 100755
--- a/usr.sbin/mergemaster/mergemaster.sh
+++ b/usr.sbin/mergemaster/mergemaster.sh
@@ -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 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
+ # 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
+ # 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.
- ;;
+ # 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}" ]; then
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`; do
# 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#.}"
OpenPOWER on IntegriCloud