mergemaster.sh (67859) | mergemaster.sh (67949) |
---|---|
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-2000 Douglas Barton 9# Doug@gorean.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-2000 Douglas Barton 9# Doug@gorean.org 10 |
11# $FreeBSD: head/usr.sbin/mergemaster/mergemaster.sh 67859 2000-10-29 09:40:22Z dougb $ | 11# $FreeBSD: head/usr.sbin/mergemaster/mergemaster.sh 67949 2000-10-30 10:33:51Z dougb $ |
12 13PATH=/bin:/usr/bin:/usr/sbin:/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:/sbin 14 15display_usage () { 16 VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` 17 echo "mergemaster version ${VERSION_NUMBER}" |
18 echo "Usage: mergemaster [-scrvah] [-m /path] [-t /path] [-d] [-u N] [-w N]" | 18 echo 'Usage: mergemaster [-scrvahi] [-m /path]' 19 echo ' [-t /path] [-d] [-u N] [-w N] [-D /path]' |
19 echo "Options:" 20 echo " -s Strict comparison (diff every pair of files)" 21 echo " -c Use context diff instead of unified diff" 22 echo " -r Re-run on a previously cleaned directory (skip temproot creation)" 23 echo " -v Be more verbose about the process, include additional checks" 24 echo " -a Leave all files that differ to merge by hand" 25 echo " -h Display more complete help" | 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' |
|
26 echo " -m /path/directory Specify location of source to do the make in" 27 echo " -t /path/directory Specify temp root directory" 28 echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)" 29 echo " -u N Specify a numeric umask" 30 echo " -w N Specify a screen width in columns to sdiff" | 28 echo " -m /path/directory Specify location of source to do the make in" 29 echo " -t /path/directory Specify temp root directory" 30 echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)" 31 echo " -u N Specify a numeric umask" 32 echo " -w N Specify a screen width in columns to sdiff" |
33 echo ' -D /path/directory Specify the destination directory to install files to' |
|
31 echo '' 32} 33 34display_help () { | 34 echo '' 35} 36 37display_help () { |
35 echo "* To create a temporary root environment, compare CVS revision \$Ids" 36 echo " for files that have them, and compare diffs for files that do not," 37 echo " or have different ones, just type, mergemaster" | |
38 echo "* To specify a directory other than /var/tmp/temproot for the" 39 echo " temporary root environment, use -t /path/to/temp/root" 40 echo "* The -w option takes a number as an argument for the column width" 41 echo " of the screen. The default is 80." | 38 echo "* To specify a directory other than /var/tmp/temproot for the" 39 echo " temporary root environment, use -t /path/to/temp/root" 40 echo "* The -w option takes a number as an argument for the column width" 41 echo " of the screen. The default is 80." |
42 echo "* The -a option causes mergemaster to run without prompting" | 42 echo '* The -a option causes mergemaster to run without prompting.' |
43} 44 | 43} 44 |
45 | |
46# Loop allowing the user to use sdiff to merge files and display the merged 47# file. 48merge_loop () { 49 case "${VERBOSE}" in 50 '') ;; 51 *) 52 echo " *** Type h at the sdiff prompt (%) to get usage help" 53 ;; 54 esac 55 echo '' 56 MERGE_AGAIN=yes 57 while [ "${MERGE_AGAIN}" = "yes" ]; do 58 # Prime file.merged so we don't blat the owner/group id's 59 cp -p "${COMPFILE}" "${COMPFILE}.merged" 60 sdiff -o "${COMPFILE}.merged" --text --suppress-common-lines \ | 45# Loop allowing the user to use sdiff to merge files and display the merged 46# file. 47merge_loop () { 48 case "${VERBOSE}" in 49 '') ;; 50 *) 51 echo " *** Type h at the sdiff prompt (%) to get usage help" 52 ;; 53 esac 54 echo '' 55 MERGE_AGAIN=yes 56 while [ "${MERGE_AGAIN}" = "yes" ]; do 57 # Prime file.merged so we don't blat the owner/group id's 58 cp -p "${COMPFILE}" "${COMPFILE}.merged" 59 sdiff -o "${COMPFILE}.merged" --text --suppress-common-lines \ |
61 --width=${SCREEN_WIDTH:-80} "${COMPFILE#.}" "${COMPFILE}" | 60 --width=${SCREEN_WIDTH:-80} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" |
62 INSTALL_MERGED=V 63 while [ "${INSTALL_MERGED}" = "v" -o "${INSTALL_MERGED}" = "V" ]; do 64 echo '' 65 echo " Use 'i' to install merged file" 66 echo " Use 'r' to re-do the merge" 67 echo " Use 'v' to view the merged file" 68 echo " Default is to leave the temporary file to deal with by hand" 69 echo '' --- 32 unchanged lines hidden (view full) --- 102 103# Loop showing user differences between files, allow merge, skip or install 104# options 105diff_loop () { 106 107 HANDLE_COMPFILE=v 108 109 while [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" -o "${HANDLE_COMPFILE}" = "NOT V" ]; do | 61 INSTALL_MERGED=V 62 while [ "${INSTALL_MERGED}" = "v" -o "${INSTALL_MERGED}" = "V" ]; do 63 echo '' 64 echo " Use 'i' to install merged file" 65 echo " Use 'r' to re-do the merge" 66 echo " Use 'v' to view the merged file" 67 echo " Default is to leave the temporary file to deal with by hand" 68 echo '' --- 32 unchanged lines hidden (view full) --- 101 102# Loop showing user differences between files, allow merge, skip or install 103# options 104diff_loop () { 105 106 HANDLE_COMPFILE=v 107 108 while [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" -o "${HANDLE_COMPFILE}" = "NOT V" ]; do |
110 if [ -f "${COMPFILE#.}" -a -f "${COMPFILE}" ]; then | 109 if [ -f "${DESTDIR}${COMPFILE#.}" -a -f "${COMPFILE}" ]; then |
111 if [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" ]; then 112 ( | 110 if [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" ]; then 111 ( |
112 echo '' |
|
113 echo " *** Displaying differences between ${COMPFILE} and installed version:" 114 echo '' | 113 echo " *** Displaying differences between ${COMPFILE} and installed version:" 114 echo '' |
115 diff "${DIFF_FLAG}" "${COMPFILE#.}" "${COMPFILE}" | 115 diff "${DIFF_FLAG}" "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" |
116 ) | ${PAGER} 117 echo '' 118 fi 119 else | 116 ) | ${PAGER} 117 echo '' 118 fi 119 else |
120 echo '' |
|
120 echo " *** There is no installed version of ${COMPFILE}" | 121 echo " *** There is no installed version of ${COMPFILE}" |
121 NO_INSTALLED=yes | 122 case "${AUTO_INSTALL}" in 123 [Yy][Ee][Ss]) 124 echo '' 125 if mm_install "${COMPFILE}"; then 126 echo " *** ${COMPFILE} installed successfully" 127 # Make the list print one file per line 128 AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES} ${DESTDIR}${COMPFILE#.} 129" 130 else 131 echo " *** Problem installing ${COMPFILE}, it will remain to merge by hand" 132 fi 133 return 134 ;; 135 *) 136 NO_INSTALLED=yes 137 ;; 138 esac |
122 fi 123 124 echo " Use 'd' to delete the temporary ${COMPFILE}" 125 echo " Use 'i' to install the temporary ${COMPFILE}" 126 case "${NO_INSTALLED}" in 127 '') 128 echo " Use 'm' to merge the old and new versions" 129 echo " Use 'v' to view to differences between the old and new versions again" --- 44 unchanged lines hidden (view full) --- 174 # invalid choice, show menu again. 175 echo "invalid choice: ${HANDLE_COMPFILE}" 176 echo '' 177 HANDLE_COMPFILE="NOT V" 178 continue 179 ;; 180 esac # End of "How to handle files that are different" 181 done | 139 fi 140 141 echo " Use 'd' to delete the temporary ${COMPFILE}" 142 echo " Use 'i' to install the temporary ${COMPFILE}" 143 case "${NO_INSTALLED}" in 144 '') 145 echo " Use 'm' to merge the old and new versions" 146 echo " Use 'v' to view to differences between the old and new versions again" --- 44 unchanged lines hidden (view full) --- 191 # invalid choice, show menu again. 192 echo "invalid choice: ${HANDLE_COMPFILE}" 193 echo '' 194 HANDLE_COMPFILE="NOT V" 195 continue 196 ;; 197 esac # End of "How to handle files that are different" 198 done |
182 echo '' | |
183 unset NO_INSTALLED 184 echo '' 185 case "${VERBOSE}" in 186 '') ;; 187 *) 188 sleep 3 189 ;; 190 esac 191} 192 193# Set the default path for the temporary root environment 194# 195TEMPROOT='/var/tmp/temproot' 196 197# Read .mergemasterrc before command line so CLI can override 198# | 199 unset NO_INSTALLED 200 echo '' 201 case "${VERBOSE}" in 202 '') ;; 203 *) 204 sleep 3 205 ;; 206 esac 207} 208 209# Set the default path for the temporary root environment 210# 211TEMPROOT='/var/tmp/temproot' 212 213# Read .mergemasterrc before command line so CLI can override 214# |
199if [ -f "$HOME/.mergemasterrc" ]; then | 215if [ -r "$HOME/.mergemasterrc" ]; then |
200 . "$HOME/.mergemasterrc" 201fi 202 203# Check the command line options 204# | 216 . "$HOME/.mergemasterrc" 217fi 218 219# Check the command line options 220# |
205while getopts ":ascrvhm:t:du:w:" COMMAND_LINE_ARGUMENT ; do | 221while getopts ":ascrvhim:t:du:w:D:" COMMAND_LINE_ARGUMENT ; do |
206 case "${COMMAND_LINE_ARGUMENT}" in 207 s) 208 STRICT=yes 209 ;; 210 c) 211 DIFF_FLAG='-c' 212 ;; 213 r) --- 8 unchanged lines hidden (view full) --- 222 AUTO_RUN=yes 223 unset VERBOSE 224 ;; 225 h) 226 display_usage 227 display_help 228 exit 0 229 ;; | 222 case "${COMMAND_LINE_ARGUMENT}" in 223 s) 224 STRICT=yes 225 ;; 226 c) 227 DIFF_FLAG='-c' 228 ;; 229 r) --- 8 unchanged lines hidden (view full) --- 238 AUTO_RUN=yes 239 unset VERBOSE 240 ;; 241 h) 242 display_usage 243 display_help 244 exit 0 245 ;; |
246 i) 247 AUTO_INSTALL=yes 248 ;; |
|
230 m) 231 SOURCEDIR=${OPTARG} 232 ;; 233 t) 234 TEMPROOT=${OPTARG} 235 ;; 236 d) 237 TEMPROOT=${TEMPROOT}.`date +%m%d.%H.%M` 238 ;; 239 u) 240 NEW_UMASK=${OPTARG} 241 ;; 242 w) 243 SCREEN_WIDTH=${OPTARG} 244 ;; | 249 m) 250 SOURCEDIR=${OPTARG} 251 ;; 252 t) 253 TEMPROOT=${OPTARG} 254 ;; 255 d) 256 TEMPROOT=${TEMPROOT}.`date +%m%d.%H.%M` 257 ;; 258 u) 259 NEW_UMASK=${OPTARG} 260 ;; 261 w) 262 SCREEN_WIDTH=${OPTARG} 263 ;; |
264 D) 265 DESTDIR=${OPTARG} 266 ;; |
|
245 *) 246 display_usage 247 exit 1 248 ;; 249 esac 250done 251 252echo '' --- 148 unchanged lines hidden (view full) --- 401 *) 402 echo " *** Press [Enter] or [Return] key to continue" 403 read ANY_KEY 404 unset ANY_KEY 405 ;; 406 esac 407 408 { cd ${SOURCEDIR} && | 267 *) 268 display_usage 269 exit 1 270 ;; 271 esac 272done 273 274echo '' --- 148 unchanged lines hidden (view full) --- 423 *) 424 echo " *** Press [Enter] or [Return] key to continue" 425 read ANY_KEY 426 unset ANY_KEY 427 ;; 428 esac 429 430 { cd ${SOURCEDIR} && |
431 make DESTDIR=${DESTDIR} distrib-dirs && |
|
409 make DESTDIR=${TEMPROOT} distrib-dirs && 410 make DESTDIR=${TEMPROOT} -DNO_MAKEDEV distribution;} || 411 { echo ''; 412 echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to the"; 413 echo " temproot environment"; 414 echo ''; 415 exit 1;} 416 | 432 make DESTDIR=${TEMPROOT} distrib-dirs && 433 make DESTDIR=${TEMPROOT} -DNO_MAKEDEV distribution;} || 434 { echo ''; 435 echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to the"; 436 echo " temproot environment"; 437 echo ''; 438 exit 1;} 439 |
440 # Doing the inventory and removing files that we don't want to compare only makes 441 # sense if we are not doing a rerun, since we have no way of knowing what happened 442 # to the files during previous incarnations. 443 case "${VERBOSE}" in 444 '') ;; 445 *) 446 echo '' 447 echo ' *** The following files exist only in the installed version of' 448 echo " ${DESTDIR}/etc. In the vast majority of cases these files" 449 echo ' are necessary parts of the system and should not be deleted.' 450 echo ' However because these files are not updated by this process you' 451 echo ' might want to verify their status before rebooting your system.' 452 echo '' 453 echo ' *** Press [Enter] or [Return] key to continue' 454 read ANY_KEY 455 unset ANY_KEY 456 diff -qr ${DESTDIR}/etc ${TEMPROOT}/etc | grep "^Only in /etc" | ${PAGER} 457 echo '' 458 echo ' *** Press [Enter] or [Return] key to continue' 459 read ANY_KEY 460 unset ANY_KEY 461 ;; 462 esac 463 |
|
417 # We really don't want to have to deal with these files, since 418 # master.passwd is the real file that should be compared, then 419 # the user should run pwd_mkdb if necessary. | 464 # We really don't want to have to deal with these files, since 465 # master.passwd is the real file that should be compared, then 466 # the user should run pwd_mkdb if necessary. |
420 # Only do this if we are not rerun'ing, since if we are the 421 # files will not be there. | |
422 # 423 rm ${TEMPROOT}/etc/spwd.db ${TEMPROOT}/etc/passwd ${TEMPROOT}/etc/pwd.db 424 425 # Avoid comparing the motd if the user specifies it in .mergemasterrc 426 case "${IGNORE_MOTD}" in 427 '') ;; 428 *) rm ${TEMPROOT}/etc/motd 429 ;; --- 4 unchanged lines hidden (view full) --- 434 rm ${TEMPROOT}/dev/MAKEDEV ${TEMPROOT}/dev/MAKEDEV.local 435 fi 436 437 ;; # End of the "RERUN" test 438esac 439 440# Get ready to start comparing files 441 | 467 # 468 rm ${TEMPROOT}/etc/spwd.db ${TEMPROOT}/etc/passwd ${TEMPROOT}/etc/pwd.db 469 470 # Avoid comparing the motd if the user specifies it in .mergemasterrc 471 case "${IGNORE_MOTD}" in 472 '') ;; 473 *) rm ${TEMPROOT}/etc/motd 474 ;; --- 4 unchanged lines hidden (view full) --- 479 rm ${TEMPROOT}/dev/MAKEDEV ${TEMPROOT}/dev/MAKEDEV.local 480 fi 481 482 ;; # End of the "RERUN" test 483esac 484 485# Get ready to start comparing files 486 |
442case "${VERBOSE}" in 443'') ;; 444*) 445 echo '' 446 echo " *** The following files exist only in the installed version" 447 echo " of /etc. In the far majority of cases these files are" 448 echo " necessary parts of the system and should not be deleted," 449 echo " however because these files are not updated by this process" 450 echo " you might want to verify their status before rebooting your system." 451 echo '' 452 echo " *** Press [Enter] or [Return] key to continue" 453 read ANY_KEY 454 unset ANY_KEY 455 diff -qr /etc ${TEMPROOT}/etc | grep "^Only in /etc" | ${PAGER} 456 echo '' 457 echo " *** Press [Enter] or [Return] key to continue" 458 read ANY_KEY 459 unset ANY_KEY 460 ;; 461esac 462 | |
463# Check umask if not specified on the command line, 464# and we are not doing an autorun 465# 466if [ -z "${NEW_UMASK}" -a -z "${AUTO_RUN}" ]; then 467 USER_UMASK=`umask` 468 case "${USER_UMASK}" in 469 0022) ;; 470 *) --- 14 unchanged lines hidden (view full) --- 485 NEW_UMASK="${NEW_UMASK:-$USER_UMASK}" 486 ;; 487 esac 488 echo '' 489fi 490 491CONFIRMED_UMASK=${NEW_UMASK:-0022} 492 | 487# Check umask if not specified on the command line, 488# and we are not doing an autorun 489# 490if [ -z "${NEW_UMASK}" -a -z "${AUTO_RUN}" ]; then 491 USER_UMASK=`umask` 492 case "${USER_UMASK}" in 493 0022) ;; 494 *) --- 14 unchanged lines hidden (view full) --- 509 NEW_UMASK="${NEW_UMASK:-$USER_UMASK}" 510 ;; 511 esac 512 echo '' 513fi 514 515CONFIRMED_UMASK=${NEW_UMASK:-0022} 516 |
493# Warn users who have an /etc/sysconfig file | 517# Warn users who still have ${DESTDIR}/etc/sysconfig |
494# | 518# |
495if [ -f /etc/sysconfig ]; then 496 echo " *** There is an /etc/sysconfig file on this system. Starting with" 497 echo " FreeBSD version 2.2.2 those settings have moved from /etc/sysconfig" 498 echo " to /etc/rc.conf. If you are upgrading an older system make sure" 499 echo " that you transfer your settings by hand from sysconfig to rc.conf and" 500 echo " install the rc.conf file. If you have already made this transition," 501 echo " you should consider renaming or deleting the /etc/sysconfig file." | 519if [ -e "${DESTDIR}/etc/sysconfig" ]; then |
502 echo '' | 520 echo '' |
521 echo " *** There is a sysconfig file on this system in ${DESTDIR}/etc/." 522 echo '' 523 echo ' Starting with FreeBSD version 2.2.2 those settings moved from' 524 echo ' /etc/sysconfig to /etc/rc.conf. If you are upgrading an older' 525 echo ' system make sure that you transfer your settings by hand from' 526 echo ' sysconfig to rc.conf and install the rc.conf file. If you' 527 echo ' have already made this transition, you should consider' 528 echo ' renaming or deleting the sysconfig file.' 529 echo '' |
|
503 case "${AUTO_RUN}" in 504 '') 505 echo -n "Continue with the merge process? [yes] " 506 read CONT_OR_NOT 507 508 case "${CONT_OR_NOT}" in 509 [nN]*) 510 exit 0 511 ;; 512 *) 513 echo " *** Continuing" 514 echo '' 515 ;; 516 esac 517 ;; 518 *) ;; 519 esac 520fi 521 | 530 case "${AUTO_RUN}" in 531 '') 532 echo -n "Continue with the merge process? [yes] " 533 read CONT_OR_NOT 534 535 case "${CONT_OR_NOT}" in 536 [nN]*) 537 exit 0 538 ;; 539 *) 540 echo " *** Continuing" 541 echo '' 542 ;; 543 esac 544 ;; 545 *) ;; 546 esac 547fi 548 |
522echo '' 523echo "*** Beginning comparison" 524echo '' 525 526cd "${TEMPROOT}" 527 | |
528# Use the umask/mode information to install the files 529# Create directories as needed 530# 531mm_install () { 532 local INSTALL_DIR 533 INSTALL_DIR=${1#.} 534 INSTALL_DIR=${INSTALL_DIR%/*} | 549# Use the umask/mode information to install the files 550# Create directories as needed 551# 552mm_install () { 553 local INSTALL_DIR 554 INSTALL_DIR=${1#.} 555 INSTALL_DIR=${INSTALL_DIR%/*} |
556 |
|
535 case "${INSTALL_DIR}" in 536 '') 537 INSTALL_DIR=/ 538 ;; 539 esac 540 | 557 case "${INSTALL_DIR}" in 558 '') 559 INSTALL_DIR=/ 560 ;; 561 esac 562 |
541 if [ -n "${INSTALL_DIR}" -a ! -d "${INSTALL_DIR}" ]; then | 563 if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then |
542 DIR_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ oct("$ARGV[1]"))' "${TEMPROOT}/${INSTALL_DIR}" "${CONFIRMED_UMASK}"` | 564 DIR_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ oct("$ARGV[1]"))' "${TEMPROOT}/${INSTALL_DIR}" "${CONFIRMED_UMASK}"` |
543 install -d -o root -g wheel -m "${DIR_MODE}" "${INSTALL_DIR}" | 565 install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}" |
544 fi 545 546 FILE_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ oct("$ARGV[1]"))' "${1}" "${CONFIRMED_UMASK}"` 547 548 if [ ! -x "${1}" ]; then 549 case "${1#.}" in | 566 fi 567 568 FILE_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ oct("$ARGV[1]"))' "${1}" "${CONFIRMED_UMASK}"` 569 570 if [ ! -x "${1}" ]; then 571 case "${1#.}" in |
550 /dev/MAKEDEV) 551 NEED_MAKEDEV=yes 552 ;; | |
553 /etc/mail/aliases) 554 NEED_NEWALIASES=yes 555 ;; 556 /etc/login.conf) 557 NEED_CAP_MKDB=yes 558 ;; 559 /etc/master.passwd) | 572 /etc/mail/aliases) 573 NEED_NEWALIASES=yes 574 ;; 575 /etc/login.conf) 576 NEED_CAP_MKDB=yes 577 ;; 578 /etc/master.passwd) |
560 install -m 600 "${1}" "${INSTALL_DIR}" | 579 install -m 600 "${1}" "${DESTDIR}${INSTALL_DIR}" |
561 NEED_PWD_MKDB=yes 562 DONT_INSTALL=yes 563 ;; 564 /.cshrc | /.profile) 565 case "${LINK_EXPLAINED}" in 566 '') 567 echo " *** Historically BSD derived systems have had a" 568 echo " hard link from /.cshrc and /.profile to" 569 echo " their namesakes in /root. Please indicate" 570 echo " your preference below for bringing your" 571 echo " installed files up to date." 572 echo '' 573 LINK_EXPLAINED=yes 574 ;; 575 esac 576 577 echo " Use 'd' to delete the temporary ${COMPFILE}" | 580 NEED_PWD_MKDB=yes 581 DONT_INSTALL=yes 582 ;; 583 /.cshrc | /.profile) 584 case "${LINK_EXPLAINED}" in 585 '') 586 echo " *** Historically BSD derived systems have had a" 587 echo " hard link from /.cshrc and /.profile to" 588 echo " their namesakes in /root. Please indicate" 589 echo " your preference below for bringing your" 590 echo " installed files up to date." 591 echo '' 592 LINK_EXPLAINED=yes 593 ;; 594 esac 595 596 echo " Use 'd' to delete the temporary ${COMPFILE}" |
578 echo " Use 'l' to delete the existing ${COMPFILE#.} and create the link" | 597 echo " Use 'l' to delete the existing ${DESTDIR}${COMPFILE#.} and create the link" |
579 echo '' 580 echo " Default is to leave the temporary file to deal with by hand" 581 echo '' 582 echo -n " How should I handle ${COMPFILE}? [Leave it to install later] " 583 read HANDLE_LINK 584 585 case "${HANDLE_LINK}" in 586 [dD]*) 587 rm "${COMPFILE}" 588 echo '' 589 echo " *** Deleting ${COMPFILE}" 590 ;; 591 [lL]*) 592 echo '' | 598 echo '' 599 echo " Default is to leave the temporary file to deal with by hand" 600 echo '' 601 echo -n " How should I handle ${COMPFILE}? [Leave it to install later] " 602 read HANDLE_LINK 603 604 case "${HANDLE_LINK}" in 605 [dD]*) 606 rm "${COMPFILE}" 607 echo '' 608 echo " *** Deleting ${COMPFILE}" 609 ;; 610 [lL]*) 611 echo '' |
593 if [ -e "${COMPFILE#.}" ]; then 594 rm "${COMPFILE#.}" 595 fi 596 if ln "/root/${COMPFILE##*/}" "${COMPFILE#.}"; then 597 echo " *** Link from ${COMPFILE#.} to /root/${COMPFILE##*/} installed successfully" | 612 rm -f "${DESTDIR}${COMPFILE#.}" 613 if ln "${DESTDIR}/root/${COMPFILE##*/}" "${DESTDIR}${COMPFILE#.}"; then 614 echo " *** Link from ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/} installed successfully" |
598 rm "${COMPFILE}" 599 else | 615 rm "${COMPFILE}" 616 else |
600 echo " *** Error linking ${COMPFILE#.} to /root/${COMPFILE##*/}, ${COMPFILE} will remain to install by hand" | 617 echo " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}, ${COMPFILE} will remain to install by hand" |
601 fi 602 ;; 603 *) 604 echo " *** ${COMPFILE} will remain for your consideration" 605 ;; 606 esac 607 DONT_INSTALL=yes 608 ;; 609 esac 610 611 case "${DONT_INSTALL}" in 612 '') | 618 fi 619 ;; 620 *) 621 echo " *** ${COMPFILE} will remain for your consideration" 622 ;; 623 esac 624 DONT_INSTALL=yes 625 ;; 626 esac 627 628 case "${DONT_INSTALL}" in 629 '') |
613 install -m "${FILE_MODE}" "${1}" "${INSTALL_DIR}" | 630 install -m "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}" |
614 ;; 615 *) 616 unset DONT_INSTALL 617 ;; 618 esac | 631 ;; 632 *) 633 unset DONT_INSTALL 634 ;; 635 esac |
619 | |
620 else | 636 else |
621 install -m "${FILE_MODE}" "${1}" "${INSTALL_DIR}" | 637 case "${1#.}" in 638 /dev/MAKEDEV) 639 NEED_MAKEDEV=yes 640 ;; 641 esac 642 install -m "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}" |
622 fi 623 return $? 624} 625 | 643 fi 644 return $? 645} 646 |
626compare_ids () { 627 case "${1}" in 628 "${2}") 629 echo " *** Temp ${COMPFILE} and installed have the same ${IDTAG}, deleting" 630 rm "${COMPFILE}" 631 ;; 632 esac 633} | 647echo '' 648echo "*** Beginning comparison" 649echo '' |
634 | 650 |
651cd "${TEMPROOT}" 652 653if [ -r "${MM_PRE_COMPARE_SCRIPT}" ]; then 654 . "${MM_PRE_COMPARE_SCRIPT}" 655fi 656 |
|
635# Using -size +0 avoids uselessly checking the empty log files created 636# by ${SOURCEDIR}/Makefile and the device entries in ./dev, but does | 657# Using -size +0 avoids uselessly checking the empty log files created 658# by ${SOURCEDIR}/Makefile and the device entries in ./dev, but does |
637# check the scripts in ./dev, as we'd like. | 659# check the scripts in ./dev, as we'd like (assuming no devfs of course). |
638# 639for COMPFILE in `find . -type f -size +0`; do | 660# 661for COMPFILE in `find . -type f -size +0`; do |
662 663 # First, check to see if the file exists in DESTDIR. If not, the 664 # diff_loop function knows how to handle it. 665 # 666 if [ ! -e "${DESTDIR}${COMPFILE#.}" ]; then 667 diff_loop 668 continue 669 fi 670 |
|
640 case "${STRICT}" in 641 '' | [Nn][Oo]) 642 # Compare CVS $Id's first so if the file hasn't been modified 643 # local changes will be ignored. 644 # If the files have the same $Id, delete the one in temproot so the 645 # user will have less to wade through if files are left to merge by hand. | 671 case "${STRICT}" in 672 '' | [Nn][Oo]) 673 # Compare CVS $Id's first so if the file hasn't been modified 674 # local changes will be ignored. 675 # If the files have the same $Id, delete the one in temproot so the 676 # user will have less to wade through if files are left to merge by hand. |
646 # Take the $Id -> $FreeBSD tag change into account | |
647 # | 677 # |
648 FREEBSDID1=`grep "[$]FreeBSD:" ${COMPFILE#.} 2>/dev/null` 649 FREEBSDID2=`grep "[$]FreeBSD:" ${COMPFILE} 2>/dev/null` | 678 # Reduce complexity and improve portability by using ident 679 # 680 CVSID1=`ident ${DESTDIR}${COMPFILE#.} 2>&1` 681 CVSID1="${CVSID1#${DESTDIR}}" 682 CVSID2=`ident ${COMPFILE} 2>&1` |
650 | 683 |
651 if [ -n "${FREEBSDID1}" -a -n "${FREEBSDID2}" ]; then 652 IDTAG='$FreeBSD' 653 compare_ids "${FREEBSDID1}" "${FREEBSDID2}" 654 else 655 CVSID1=`grep "[$]Id:" ${COMPFILE#.} 2>/dev/null` 656 CVSID2=`grep "[$]Id:" ${COMPFILE} 2>/dev/null` 657 658 if [ -n "${CVSID1}" -a -n "${CVSID2}" ]; then 659 IDTAG='$Id' 660 compare_ids "${CVSID1}" "${CVSID2}" 661 fi 662 fi | 684 case "${CVSID2}" in 685 *'no id keywords'*) 686 ;; 687 ."${CVSID1}") 688 echo " *** Temp ${COMPFILE} and installed have the same CVS Id, deleting" 689 rm "${COMPFILE}" 690 ;; 691 esac |
663 ;; 664 esac 665 666 # If the file is still here either because the $Ids are different, the 667 # file doesn't have an $Id, or we're using STRICT mode; look at the diff. 668 # 669 if [ -f "${COMPFILE}" ]; then 670 671 # Do an absolute diff first to see if the files are actually different. 672 # If they're not different, delete the one in temproot. 673 # | 692 ;; 693 esac 694 695 # If the file is still here either because the $Ids are different, the 696 # file doesn't have an $Id, or we're using STRICT mode; look at the diff. 697 # 698 if [ -f "${COMPFILE}" ]; then 699 700 # Do an absolute diff first to see if the files are actually different. 701 # If they're not different, delete the one in temproot. 702 # |
674 if diff -q "${COMPFILE#.}" "${COMPFILE}" > /dev/null 2>&1; then | 703 if diff -q "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > /dev/null 2>&1; then |
675 echo " *** Temp ${COMPFILE} and installed are the same, deleting" 676 rm "${COMPFILE}" 677 else 678 # Ok, the files are different, so show the user where they differ. Use user's 679 # choice of diff methods; and user's pager if they have one. Use more if not. 680 # Use unified diffs by default. Context diffs give me a headache. :) 681 # 682 case "${AUTO_RUN}" in --- 73 unchanged lines hidden (view full) --- 756'') ;; 757*) 758 echo '' 759 echo "*** You installed a new master.passwd file, so make sure that you run" 760 echo " 'pwd_mkdb -p /etc/master.passwd' to rebuild your password files" 761 ;; 762esac 763 | 704 echo " *** Temp ${COMPFILE} and installed are the same, deleting" 705 rm "${COMPFILE}" 706 else 707 # Ok, the files are different, so show the user where they differ. Use user's 708 # choice of diff methods; and user's pager if they have one. Use more if not. 709 # Use unified diffs by default. Context diffs give me a headache. :) 710 # 711 case "${AUTO_RUN}" in --- 73 unchanged lines hidden (view full) --- 785'') ;; 786*) 787 echo '' 788 echo "*** You installed a new master.passwd file, so make sure that you run" 789 echo " 'pwd_mkdb -p /etc/master.passwd' to rebuild your password files" 790 ;; 791esac 792 |
793case "${AUTO_INSTALLED_FILES}" in 794'') ;; 795*) 796 ( 797 echo '' 798 echo '*** You chose the automatic install option for files that did not exist' 799 echo ' on your system. The following files were installed for you:' 800 echo "${AUTO_INSTALLED_FILES}" 801 ) | ${PAGER} 802 ;; 803esac 804 |
|
764echo '' 765 | 805echo '' 806 |
807if [ -r "${MM_EXIT_SCRIPT}" ]; then 808 . "${MM_EXIT_SCRIPT}" 809fi 810 |
|
766exit 0 767 | 811exit 0 812 |