Date: Sun, 6 Nov 2011 07:59:34 +0000 (UTC) From: Doug Barton <dougb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r227148 - stable/8/usr.sbin/mergemaster Message-ID: <201111060759.pA67xYRc007140@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dougb Date: Sun Nov 6 07:59:34 2011 New Revision: 227148 URL: http://svn.freebsd.org/changeset/base/227148 Log: MFC r227013: 1. Add a new option, --run-updates, to always or never run the newalises, pwd_mkdb, etc. updates at the end of the comparison. 2. Add an update to the end to handle /etc/localtime, if it exists. If /var/db/zoneinfo exists, automatically update /etc/localtime, which should (hopefully) be safe to do. If not, prompt the user to run tzsetup. 3. Update run_it_now(), the function that handles input for the updates, to make sure that we got a valid answer, and to handle the --run-updates option if supplied. Modified: stable/8/usr.sbin/mergemaster/mergemaster.8 stable/8/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/8/usr.sbin/mergemaster/ (props changed) Modified: stable/8/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 07:54:42 2011 (r227147) +++ stable/8/usr.sbin/mergemaster/mergemaster.8 Sun Nov 6 07:59:34 2011 (r227148) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2011 +.Dd November 1, 2011 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -34,6 +34,7 @@ .Nm .Op Fl scrvhpCP .Op Fl a|iFU +.Op Fl -run-updates=[always|never] .Op Fl m Ar /path/to/sources .Op Fl t Ar /path/to/temp/root .Op Fl d @@ -246,6 +247,11 @@ rc file. Attempt to auto upgrade files that have not been user modified. This option can be dangerous when there are critical changes in the new versions that affect your running system. +.It Fl -run-updates=[always|never] +Specify always or never to run newaliases, pwd_mkdb, etc. +at the end of the comparison run. +If this option is omitted the default is to prompt the user +for each update as necessary. .It Fl m Ar /path/to/sources Specify the path to the directory where you want to do the .Xr make 1 . @@ -365,6 +371,9 @@ with all values commented out: # ***DANGEROUS*** #AUTO_UPGRADE= # +# Either always or never run newaliases, pwd_mkdb at the end (--run-updates) +#RUN_UPDATES= +# # Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf (-C) #COMP_CONFS= # Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.sh Sun Nov 6 07:54:42 2011 (r227147) +++ stable/8/usr.sbin/mergemaster/mergemaster.sh Sun Nov 6 07:59:34 2011 (r227148) @@ -15,7 +15,7 @@ PATH=/bin:/usr/bin:/usr/sbin display_usage () { VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` echo "mergemaster version ${VERSION_NUMBER}" - echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]]' + echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]] [--run-updates=always|never]' echo ' [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]' echo "Options:" echo " -s Strict comparison (diff every pair of files)" @@ -31,6 +31,7 @@ display_usage () { echo ' -P Preserve files that are overwritten' echo " -U Attempt to auto upgrade files that have not been user modified" echo ' ***DANGEROUS***' + echo ' --run-updates= Specify always or never to run newalises, pwd_mkdb, etc.' echo '' echo " -m /path/directory Specify location of source to do the make in" echo " -t /path/directory Specify temp root directory" @@ -262,6 +263,20 @@ if [ -r "$HOME/.mergemasterrc" ]; then . "$HOME/.mergemasterrc" fi +for var in "$@" ; do + case "$var" in + --run-updates*) + RUN_UPDATES=`echo ${var#--run-updates=} | tr [:upper:] [:lower:]` + ;; + *) + newopts="$newopts $var" + ;; + esac +done + +set -- $newopts +unset var newopts + # Check the command line options # while getopts ":ascrvhipCPm:t:du:w:D:A:FU" COMMAND_LINE_ARGUMENT ; do @@ -1226,34 +1241,43 @@ case "${AUTO_UPGRADED_FILES}" in esac run_it_now () { - case "${AUTO_RUN}" in - '') - unset YES_OR_NO - echo '' - echo -n ' Would you like to run it now? y or n [n] ' - read YES_OR_NO + [ -n "$AUTO_RUN" ] && return + + local answer + + echo '' + while : ; do + if [ "$RUN_UPDATES" = always ]; then + answer=y + elif [ "$RUN_UPDATES" = never ]; then + answer=n + else + echo -n ' Would you like to run it now? y or n [n] ' + read answer + fi - case "${YES_OR_NO}" in + case "$answer" in y) echo " Running ${1}" echo '' eval "${1}" + return ;; ''|n) - echo '' - echo " *** Cancelled" - echo '' + if [ ! "$RUN_UPDATES" = never ]; then + echo '' + echo " *** Cancelled" + echo '' + fi echo " Make sure to run ${1} yourself" + return ;; *) echo '' - echo " *** Sorry, I do not understand your answer (${YES_OR_NO})" + echo " *** Sorry, I do not understand your answer (${answer})" echo '' - echo " Make sure to run ${1} yourself" esac - ;; - *) ;; - esac + done } case "${NEED_NEWALIASES}" in @@ -1312,6 +1336,19 @@ case "${NEED_PWD_MKDB}" in ;; esac +if [ -e "${DESTDIR}/etc/localtime" ]; then # Ignore if TZ == UTC + echo '' + if [ -f "${DESTDIR}/var/db/zoneinfo" ]; then + echo "*** Reinstalling `cat ${DESTDIR}/var/db/zoneinfo` as ${DESTDIR}/etc/localtime" + [ -n "${DESTDIR}" ] && tzs_args="-C ${DESTDIR}" + tzsetup $tzs_args -r + else + echo "*** There is no ${DESTDIR}/var/db/zoneinfo file to update ${DESTDIR}/etc/localtime." + echo ' You should run tzsetup' + run_it_now tzsetup + fi +fi + echo '' if [ -r "${MM_EXIT_SCRIPT}" ]; then
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111060759.pA67xYRc007140>