Deleted Added
full compact
mergemaster.sh (189763) mergemaster.sh (189992)
1#!/bin/sh
2
3# mergemaster
4
5# Compare files created by /usr/src/etc/Makefile (or the directory
6# the user specifies) with the currently installed copies.
7
8# Copyright 1998-2009 Douglas Barton
9# DougB@FreeBSD.org
10
1#!/bin/sh
2
3# mergemaster
4
5# Compare files created by /usr/src/etc/Makefile (or the directory
6# the user specifies) with the currently installed copies.
7
8# Copyright 1998-2009 Douglas Barton
9# DougB@FreeBSD.org
10
11# $FreeBSD: head/usr.sbin/mergemaster/mergemaster.sh 189763 2009-03-13 08:48:33Z dougb $
11# $FreeBSD: head/usr.sbin/mergemaster/mergemaster.sh 189992 2009-03-18 21:51:11Z dougb $
12
13PATH=/bin:/usr/bin:/usr/sbin
14
15display_usage () {
16 VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`
17 echo "mergemaster version ${VERSION_NUMBER}"
12
13PATH=/bin:/usr/bin:/usr/sbin
14
15display_usage () {
16 VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`
17 echo "mergemaster version ${VERSION_NUMBER}"
18 echo 'Usage: mergemaster [-scrvahipCPU]'
18 echo 'Usage: mergemaster [-scrvahipFCPU]'
19 echo ' [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]'
20 echo "Options:"
21 echo " -s Strict comparison (diff every pair of files)"
22 echo " -c Use context diff instead of unified diff"
23 echo " -r Re-run on a previously cleaned directory (skip temproot creation)"
24 echo " -v Be more verbose about the process, include additional checks"
25 echo " -a Leave all files that differ to merge by hand"
26 echo " -h Display more complete help"
27 echo ' -i Automatically install files that do not exist in destination directory'
28 echo ' -p Pre-buildworld mode, only compares crucial files'
19 echo ' [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]'
20 echo "Options:"
21 echo " -s Strict comparison (diff every pair of files)"
22 echo " -c Use context diff instead of unified diff"
23 echo " -r Re-run on a previously cleaned directory (skip temproot creation)"
24 echo " -v Be more verbose about the process, include additional checks"
25 echo " -a Leave all files that differ to merge by hand"
26 echo " -h Display more complete help"
27 echo ' -i Automatically install files that do not exist in destination directory'
28 echo ' -p Pre-buildworld mode, only compares crucial files'
29 echo ' -F Install files that differ only by revision control Id ($FreeBSD: head/usr.sbin/mergemaster/mergemaster.sh 189992 2009-03-18 21:51:11Z dougb $)'
29 echo ' -C Compare local rc.conf variables to the defaults'
30 echo ' -P Preserve files that are overwritten'
31 echo " -U Attempt to auto upgrade files that have not been user modified"
32 echo ''
33 echo " -m /path/directory Specify location of source to do the make in"
34 echo " -t /path/directory Specify temp root directory"
35 echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)"
36 echo " -u N Specify a numeric umask"

--- 222 unchanged lines hidden (view full) ---

259
260# Assign the location of the mtree database
261#
262MTREEDB=${MTREEDB:-/var/db}
263MTREEFILE="${MTREEDB}/mergemaster.mtree"
264
265# Check the command line options
266#
30 echo ' -C Compare local rc.conf variables to the defaults'
31 echo ' -P Preserve files that are overwritten'
32 echo " -U Attempt to auto upgrade files that have not been user modified"
33 echo ''
34 echo " -m /path/directory Specify location of source to do the make in"
35 echo " -t /path/directory Specify temp root directory"
36 echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)"
37 echo " -u N Specify a numeric umask"

--- 222 unchanged lines hidden (view full) ---

260
261# Assign the location of the mtree database
262#
263MTREEDB=${MTREEDB:-/var/db}
264MTREEFILE="${MTREEDB}/mergemaster.mtree"
265
266# Check the command line options
267#
267while getopts ":ascrvhipCPm:t:du:w:D:A:U" COMMAND_LINE_ARGUMENT ; do
268while getopts ":ascrvhipCPm:t:du:w:D:A:FU" COMMAND_LINE_ARGUMENT ; do
268 case "${COMMAND_LINE_ARGUMENT}" in
269 A)
270 ARCHSTRING='TARGET_ARCH='${OPTARG}
271 ;;
269 case "${COMMAND_LINE_ARGUMENT}" in
270 A)
271 ARCHSTRING='TARGET_ARCH='${OPTARG}
272 ;;
273 F)
274 FREEBSD_ID=yes
275 ;;
272 U)
273 AUTO_UPGRADE=yes
274 ;;
275 s)
276 STRICT=yes
277 unset DIFF_OPTIONS
278 ;;
279 c)

--- 736 unchanged lines hidden (view full) ---

1016 echo " *** Temp ${COMPFILE} and installed are the same, deleting"
1017 rm "${COMPFILE}"
1018 else
1019 # Ok, the files are different, so show the user where they differ.
1020 # Use user's choice of diff methods; and user's pager if they have one.
1021 # Use more if not.
1022 # Use unified diffs by default. Context diffs give me a headache. :)
1023 #
276 U)
277 AUTO_UPGRADE=yes
278 ;;
279 s)
280 STRICT=yes
281 unset DIFF_OPTIONS
282 ;;
283 c)

--- 736 unchanged lines hidden (view full) ---

1020 echo " *** Temp ${COMPFILE} and installed are the same, deleting"
1021 rm "${COMPFILE}"
1022 else
1023 # Ok, the files are different, so show the user where they differ.
1024 # Use user's choice of diff methods; and user's pager if they have one.
1025 # Use more if not.
1026 # Use unified diffs by default. Context diffs give me a headache. :)
1027 #
1028 # If the user chose the -F option, test for that before proceeding
1029 #
1030 if [ -n "$FREEBSD_ID" ]; then
1031 if diff -q -I'[$]FreeBSD:.*$' "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \
1032 /dev/null 2>&1; then
1033 if mm_install "${COMPFILE}"; then
1034 echo "*** Updated revision control Id for ${DESTDIR}${COMPFILE#.}"
1035 else
1036 echo "*** Problem installing ${COMPFILE}, it will remain to merge by hand later"
1037 fi
1038 continue
1039 fi
1040 fi
1024 case "${AUTO_RUN}" in
1025 '')
1026 # prompt user to install/delete/merge changes
1027 diff_loop
1028 ;;
1029 *)
1030 # If this is an auto run, make it official
1031 echo " *** ${COMPFILE} will remain for your consideration"

--- 220 unchanged lines hidden ---
1041 case "${AUTO_RUN}" in
1042 '')
1043 # prompt user to install/delete/merge changes
1044 diff_loop
1045 ;;
1046 *)
1047 # If this is an auto run, make it official
1048 echo " *** ${COMPFILE} will remain for your consideration"

--- 220 unchanged lines hidden ---