Making -i and -U default behavior for mergemaster (was: Re: svn commit: r179669 - head/sbin/rcorder)

From: Mike Makonnen <mtm_at_wubethiopia.com>
Date: Wed, 11 Jun 2008 17:07:14 +0300
Hi Doug,

The -i and -U options to mergemaster are such timesavers that I was 
wondering if they shouldn't be turned on by default. The attached patch 
makes this the default behavior and uses the -I and -X command line 
switches to turn it off.

Cheers.
-- 
Mike Makonnen       | GPG-KEY: http://people.freebsd.org/~mtm/mtm.asc
mtm _at_ FreeBSD.Org   | AC7B 5672 2D11 F4D0 EBF8  5279 5359 2B82 7CD4 1F55
FreeBSD             | http://www.freebsd.org

Index: usr.sbin/mergemaster/mergemaster.8
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mergemaster/mergemaster.8,v
retrieving revision 1.36
diff -u -r1.36 mergemaster.8
--- usr.sbin/mergemaster/mergemaster.8	30 Apr 2006 22:09:47 -0000	1.36
+++ usr.sbin/mergemaster/mergemaster.8	11 Jun 2008 13:34:28 -0000
_at__at_ -32,7 +32,7 _at__at_
 .Nd merge configuration files, et al during an upgrade
 .Sh SYNOPSIS
 .Nm
-.Op Fl scrvahipCPU
+.Op Fl scrvahpCIPX
 .Op Fl m Ar /path/to/sources
 .Op Fl t Ar /path/to/temp/root
 .Op Fl d
_at__at_ -193,9 +193,6 _at__at_
 -w superfluous.
 .It Fl h
 Display usage and help information.
-.It Fl i
-Automatically install any files that do not exist in the
-destination directory.
 .It Fl p
 Pre-buildworld mode.
 Compares only files known to be essential to the success of
_at__at_ -207,6 +204,9 _at__at_
 .Nm
 run,
 compares your rc.conf[.local] options to the defaults.
+.It Fl i
+Prompt the user to manually install any files that do not exist in the
+destination directory.
 .It Fl P
 Preserve files that you replace in
 .Pa /var/tmp/mergemaster/preserved-files-<date> ,
_at__at_ -243,7 +243,7 _at__at_
 .It Fl D Ar /path
 Specify the destination directory for the installed files.
 .It Fl U
-Attempt to auto upgrade files that have not been user modified.
+Prompt the user to upgrade files that have not been user modified.
 .El
 .Sh ENVIRONMENT
 The
Index: usr.sbin/mergemaster/mergemaster.sh
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mergemaster/mergemaster.sh,v
retrieving revision 1.56
diff -u -r1.56 mergemaster.sh
--- usr.sbin/mergemaster/mergemaster.sh	26 May 2008 10:40:09 -0000	1.56
+++ usr.sbin/mergemaster/mergemaster.sh	11 Jun 2008 13:53:29 -0000
_at__at_ -24,7 +24,6 _at__at_
   echo "  -v  Be more verbose about the process, include additional checks"
   echo "  -a  Leave all files that differ to merge by hand"
   echo "  -h  Display more complete help"
-  echo '  -i  Automatically install files that do not exist in destination directory'
   echo '  -p  Pre-buildworld mode, only compares crucial files'
   echo '  -C  Compare local rc.conf variables to the defaults'
   echo '  -P  Preserve files that are overwritten'
_at__at_ -35,7 +34,8 _at__at_
   echo "  -w N  Specify a screen width in columns to sdiff"
   echo "  -A architecture  Alternative architecture name to pass to make"
   echo '  -D /path/directory  Specify the destination directory to install files to'
-  echo "  -U Attempt to auto upgrade files that have not been user modified."
+  echo '  -I Prompt the user to install files that do not exist in destination directory'
+  echo "  -X Prompt the user to upgrade files that have not been user modified."
   echo ''
 }
 
_at__at_ -260,15 +260,20 _at__at_
   . "$HOME/.mergemasterrc"
 fi
 
+# Set default options
+#
+AUTO_UPGRADE=yes
+AUTO_INSTALL=yes
+
 # Check the command line options
 #
-while getopts ":ascrvhipCPm:t:du:w:D:A:U" COMMAND_LINE_ARGUMENT ; do
+while getopts ":ascrvhipCIPXm:t:du:w:D:A:U" COMMAND_LINE_ARGUMENT ; do
   case "${COMMAND_LINE_ARGUMENT}" in
   A)
     ARCHSTRING='MACHINE_ARCH='${OPTARG}
     ;;
-  U)
-    AUTO_UPGRADE=yes
+  X)
+    unset AUTO_UPGRADE
     ;;
   s)
     STRICT=yes
_at__at_ -294,8 +299,8 _at__at_
     display_help
     exit 0
     ;;
-  i)
-    AUTO_INSTALL=yes
+  I)
+    unset AUTO_INSTALL
     ;;
   C)
     COMP_CONFS=yes
_at__at_ -1028,15 +1033,15 _at__at_
   '')
     (
       echo ''
-      echo '*** You chose the automatic install option for files that did not'
-      echo '    exist on your system.  The following were installed for you:'
+      echo '*** The following files did not exist on your system. They were'
+      echo '    automatically installed for you:'
       echo "${AUTO_INSTALLED_FILES}"
     ) | ${PAGER}
     ;;
   *)
     echo ''
-    echo '*** You chose the automatic install option for files that did not'
-    echo '    exist on your system.  The following were installed for you:'
+    echo '*** The following files did not exist on your system. They were'
+    echo '    automatically  installed for you:'
     echo "${AUTO_INSTALLED_FILES}"
     ;;
   esac
_at__at_ -1050,15 +1055,15 _at__at_
   '')
     (
       echo ''
-      echo '*** You chose the automatic upgrade option for files that you did'
-      echo '    not alter on your system.  The following were upgraded for you:'
+      echo '*** The following files were automatically upgraded for you'
+      echo '    because they contained no local modifications:'
       echo "${AUTO_UPGRADED_FILES}"
     ) | ${PAGER}
     ;;
   *)
     echo ''
-    echo '*** You chose the automatic upgrade option for files that you did'
-    echo '    not alter on your system.  The following were upgraded for you:'
+    echo '*** The following files were automatically upgraded for you'
+    echo '    because they contained no local modifications:'
     echo "${AUTO_UPGRADED_FILES}"
     ;;
   esac
Received on Wed Jun 11 2008 - 12:18:22 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:31 UTC