Deleted Added
full compact
mergemaster.sh (225736) mergemaster.sh (227145)
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-2011 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-2011 Douglas Barton
9# dougb@FreeBSD.org
10
11# $FreeBSD: stable/9/usr.sbin/mergemaster/mergemaster.sh 224726 2011-08-09 07:42:19Z dougb $
11# $FreeBSD: stable/9/usr.sbin/mergemaster/mergemaster.sh 227145 2011-11-06 07:47:38Z 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 [-scrvhpCP] [-a|[-iFU]]'
18 echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]] [--run-updates=always|never]'
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)'
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 ' ***DANGEROUS***'
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)'
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 ' ***DANGEROUS***'
34 echo ' --run-updates= Specify always or never to run newalises, pwd_mkdb, etc.'
34 echo ''
35 echo " -m /path/directory Specify location of source to do the make in"
36 echo " -t /path/directory Specify temp root directory"
37 echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)"
38 echo " -u N Specify a numeric umask"
39 echo " -w N Specify a screen width in columns to sdiff"
40 echo " -A architecture Alternative architecture name to pass to make"
41 echo ' -D /path/directory Specify the destination directory to install files to'

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

257fi
258
259# Read .mergemasterrc before command line so CLI can override
260#
261if [ -r "$HOME/.mergemasterrc" ]; then
262 . "$HOME/.mergemasterrc"
263fi
264
35 echo ''
36 echo " -m /path/directory Specify location of source to do the make in"
37 echo " -t /path/directory Specify temp root directory"
38 echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)"
39 echo " -u N Specify a numeric umask"
40 echo " -w N Specify a screen width in columns to sdiff"
41 echo " -A architecture Alternative architecture name to pass to make"
42 echo ' -D /path/directory Specify the destination directory to install files to'

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

258fi
259
260# Read .mergemasterrc before command line so CLI can override
261#
262if [ -r "$HOME/.mergemasterrc" ]; then
263 . "$HOME/.mergemasterrc"
264fi
265
266for var in "$@" ; do
267 case "$var" in
268 --run-updates*)
269 RUN_UPDATES=`echo ${var#--run-updates=} | tr [:upper:] [:lower:]`
270 ;;
271 *)
272 newopts="$newopts $var"
273 ;;
274 esac
275done
276
277set -- $newopts
278unset var newopts
279
265# Check the command line options
266#
267while 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 ;;
272 F)

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

1219 echo ' not alter on your system. The following were upgraded for you:'
1220 echo "${AUTO_UPGRADED_FILES}"
1221 ;;
1222 esac
1223 ;;
1224esac
1225
1226run_it_now () {
280# Check the command line options
281#
282while getopts ":ascrvhipCPm:t:du:w:D:A:FU" COMMAND_LINE_ARGUMENT ; do
283 case "${COMMAND_LINE_ARGUMENT}" in
284 A)
285 ARCHSTRING='TARGET_ARCH='${OPTARG}
286 ;;
287 F)

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

1234 echo ' not alter on your system. The following were upgraded for you:'
1235 echo "${AUTO_UPGRADED_FILES}"
1236 ;;
1237 esac
1238 ;;
1239esac
1240
1241run_it_now () {
1227 case "${AUTO_RUN}" in
1228 '')
1229 unset YES_OR_NO
1230 echo ''
1231 echo -n ' Would you like to run it now? y or n [n] '
1232 read YES_OR_NO
1242 [ -n "$AUTO_RUN" ] && return
1233
1243
1234 case "${YES_OR_NO}" in
1244 local answer
1245
1246 echo ''
1247 while : ; do
1248 if [ "$RUN_UPDATES" = always ]; then
1249 answer=y
1250 elif [ "$RUN_UPDATES" = never ]; then
1251 answer=n
1252 else
1253 echo -n ' Would you like to run it now? y or n [n] '
1254 read answer
1255 fi
1256
1257 case "$answer" in
1235 y)
1236 echo " Running ${1}"
1237 echo ''
1238 eval "${1}"
1258 y)
1259 echo " Running ${1}"
1260 echo ''
1261 eval "${1}"
1262 return
1239 ;;
1240 ''|n)
1263 ;;
1264 ''|n)
1241 echo ''
1242 echo " *** Cancelled"
1243 echo ''
1265 if [ ! "$RUN_UPDATES" = never ]; then
1266 echo ''
1267 echo " *** Cancelled"
1268 echo ''
1269 fi
1244 echo " Make sure to run ${1} yourself"
1270 echo " Make sure to run ${1} yourself"
1271 return
1245 ;;
1246 *)
1247 echo ''
1272 ;;
1273 *)
1274 echo ''
1248 echo " *** Sorry, I do not understand your answer (${YES_OR_NO})"
1275 echo " *** Sorry, I do not understand your answer (${answer})"
1249 echo ''
1276 echo ''
1250 echo " Make sure to run ${1} yourself"
1251 esac
1277 esac
1252 ;;
1253 *) ;;
1254 esac
1278 done
1255}
1256
1257case "${NEED_NEWALIASES}" in
1258'') ;;
1259*)
1260 echo ''
1261 if [ -n "${DESTDIR}" ]; then
1262 echo "*** You installed a new aliases file into ${DESTDIR}/etc/mail, but"

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

1305 else
1306 echo " '/usr/sbin/pwd_mkdb -p /etc/master.passwd'"
1307 echo " to rebuild your password files"
1308 run_it_now '/usr/sbin/pwd_mkdb -p /etc/master.passwd'
1309 fi
1310 ;;
1311esac
1312
1279}
1280
1281case "${NEED_NEWALIASES}" in
1282'') ;;
1283*)
1284 echo ''
1285 if [ -n "${DESTDIR}" ]; then
1286 echo "*** You installed a new aliases file into ${DESTDIR}/etc/mail, but"

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

1329 else
1330 echo " '/usr/sbin/pwd_mkdb -p /etc/master.passwd'"
1331 echo " to rebuild your password files"
1332 run_it_now '/usr/sbin/pwd_mkdb -p /etc/master.passwd'
1333 fi
1334 ;;
1335esac
1336
1337if [ -e "${DESTDIR}/etc/localtime" ]; then # Ignore if TZ == UTC
1338 echo ''
1339 if [ -f "${DESTDIR}/var/db/zoneinfo" ]; then
1340 echo "*** Reinstalling `cat ${DESTDIR}/var/db/zoneinfo` as ${DESTDIR}/etc/localtime"
1341 [ -n "${DESTDIR}" ] && tzs_args="-C ${DESTDIR}"
1342 tzsetup $tzs_args -r
1343 else
1344 echo "*** There is no ${DESTDIR}/var/db/zoneinfo file to update ${DESTDIR}/etc/localtime."
1345 echo ' You should run tzsetup'
1346 run_it_now tzsetup
1347 fi
1348fi
1349
1313echo ''
1314
1315if [ -r "${MM_EXIT_SCRIPT}" ]; then
1316 . "${MM_EXIT_SCRIPT}"
1317fi
1318
1319case "${COMP_CONFS}" in
1320'') ;;

--- 51 unchanged lines hidden ---
1350echo ''
1351
1352if [ -r "${MM_EXIT_SCRIPT}" ]; then
1353 . "${MM_EXIT_SCRIPT}"
1354fi
1355
1356case "${COMP_CONFS}" in
1357'') ;;

--- 51 unchanged lines hidden ---