5 # Compare files created by /usr/src/etc/Makefile (or the directory
6 # the user specifies) with the currently installed copies.
8 # Copyright 1998-2004 Douglas Barton
13 PATH
=/bin
:/usr
/bin
:/usr
/sbin
16 VERSION_NUMBER
=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`
17 echo "mergemaster version ${VERSION_NUMBER}"
18 echo 'Usage: mergemaster [-scrvahipCP] [-m /path]'
19 echo ' [-t /path] [-d] [-u N] [-w N] [-D /path]'
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 ' -C Compare local rc.conf variables to the defaults'
30 echo ' -P Preserve files that are overwritten'
31 echo " -m /path/directory Specify location of source to do the make in"
32 echo " -t /path/directory Specify temp root directory"
33 echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)"
34 echo " -u N Specify a numeric umask"
35 echo " -w N Specify a screen width in columns to sdiff"
36 echo " -A architecture Alternative architecture name to pass to make"
37 echo ' -D /path/directory Specify the destination directory to install files to'
38 echo " -U Attempt to auto upgrade files that have not been user modified."
43 echo "* To specify a directory other than /var/tmp/temproot for the"
44 echo " temporary root environment, use -t /path/to/temp/root"
45 echo "* The -w option takes a number as an argument for the column width"
46 echo " of the screen. The default is 80."
47 echo '* The -a option causes mergemaster to run without prompting.'
50 # Loop allowing the user to use sdiff to merge files and display the merged
56 echo " *** Type h at the sdiff prompt (%) to get usage help"
61 while [ "${MERGE_AGAIN}" = "yes" ]; do
62 # Prime file.merged so we don't blat the owner/group id's
63 cp -p "${COMPFILE}" "${COMPFILE}.merged"
64 sdiff -o "${COMPFILE}.merged" --text --suppress-common-lines \
65 --width=${SCREEN_WIDTH:-80} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}"
67 while [ "${INSTALL_MERGED}" = "v
" -o "${INSTALL_MERGED}" = "V
" ]; do
69 echo " Use
'i' to
install merged
file"
70 echo " Use
'r' to re-do the merge
"
71 echo " Use
'v' to view the merged
file"
72 echo " Default is to leave the temporary
file to deal with by hand
"
74 echo -n " *** How should I deal with the merged
file?
[Leave it
for later
] "
77 case "${INSTALL_MERGED}" in
79 mv "${COMPFILE}.merged
" "${COMPFILE}"
81 if mm_install "${COMPFILE}"; then
82 echo " *** Merged version of
${COMPFILE} installed successfully
"
84 echo " *** Problem installing
${COMPFILE}, it will remain to merge by hand later
"
89 rm "${COMPFILE}.merged
"
92 ${PAGER} "${COMPFILE}.merged
"
95 echo " *** ${COMPFILE} will remain
for your consideration
"
99 echo "invalid choice
: ${INSTALL_MERGED}"
107 # Loop showing user differences between files, allow merge, skip or install
113 while [ "${HANDLE_COMPFILE}" = "v
" -o "${HANDLE_COMPFILE}" = "V
" -o \
114 "${HANDLE_COMPFILE}" = "NOT V
" ]; do
115 if [ -f "${DESTDIR}${COMPFILE#.}" -a -f "${COMPFILE}" ]; then
116 if [ -n "${AUTO_UPGRADE}" ]; then
117 if echo "${CHANGED}" | grep -qsv ${DESTDIR}${COMPFILE#.}; then
119 echo " *** ${COMPFILE} has not been user modified."
122 if mm_install
"${COMPFILE}"; then
123 echo " *** ${COMPFILE} upgraded successfully"
125 # Make the list print one file per line
126 AUTO_UPGRADED_FILES
="${AUTO_UPGRADED_FILES} ${DESTDIR}${COMPFILE#.}
129 echo " *** Problem upgrading ${COMPFILE}, it will remain to merge by hand"
134 if [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" ]; then
136 echo ' ====================================================================== '
139 echo " *** Displaying differences between ${COMPFILE} and installed version:"
141 diff ${DIFF_FLAG} ${DIFF_OPTIONS} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}"
147 echo " *** There is no installed version of
${COMPFILE}"
149 case "${AUTO_INSTALL}" in
152 if mm_install "${COMPFILE}"; then
153 echo " *** ${COMPFILE} installed successfully
"
155 # Make the list print one file per line
156 AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES} ${DESTDIR}${COMPFILE#.}
159 echo " *** Problem installing
${COMPFILE}, it will remain to merge by hand
"
169 echo " Use
'd' to delete the temporary
${COMPFILE}"
170 echo " Use
'i' to
install the temporary
${COMPFILE}"
171 case "${NO_INSTALLED}" in
173 echo " Use
'm' to merge the temporary and installed versions
"
174 echo " Use
'v' to view the
diff results again
"
178 echo " Default is to leave the temporary
file to deal with by hand
"
180 echo -n "How should I deal with this?
[Leave it
for later
] "
183 case "${HANDLE_COMPFILE}" in
187 echo " *** Deleting
${COMPFILE}"
191 if mm_install "${COMPFILE}"; then
192 echo " *** ${COMPFILE} installed successfully
"
194 echo " *** Problem installing
${COMPFILE}, it will remain to merge by hand
"
198 case "${NO_INSTALLED}" in
200 # interact with user to merge files
205 echo " *** There is no installed version of
${COMPFILE}"
207 HANDLE_COMPFILE="NOT V
"
209 esac # End of "No installed version of
file but user selected merge
" test
216 echo " *** ${COMPFILE} will remain
for your consideration
"
219 # invalid choice, show menu again.
220 echo "invalid choice
: ${HANDLE_COMPFILE}"
222 HANDLE_COMPFILE="NOT V
"
225 esac # End of "How to handle files that are different
"
237 press_to_continue () {
239 echo -n ' *** Press the [Enter] or [Return] key to continue '
243 # Set the default path for the temporary root environment
245 TEMPROOT='/var/tmp/temproot'
247 # Assign the location of the mtree database
249 MTREEDB='/var/db/mergemaster.mtree'
251 # Read /etc/mergemaster.rc first so the one in $HOME can override
253 if [ -r /etc/mergemaster.rc ]; then
254 . /etc/mergemaster.rc
257 # Read .mergemasterrc before command line so CLI can override
259 if [ -r "$HOME/.mergemasterrc
" ]; then
260 . "$HOME/.mergemasterrc
"
263 # Check the command line options
265 while getopts ":ascrvhipCPm
:t
:du
:w
:D
:A
:U
" COMMAND_LINE_ARGUMENT ; do
266 case "${COMMAND_LINE_ARGUMENT}" in
268 ARCHSTRING='MACHINE_ARCH='${OPTARG}
284 case "${AUTO_RUN}" in
318 TEMPROOT=${TEMPROOT}.`date +%m%d.%H.%M`
324 SCREEN_WIDTH=${OPTARG}
336 # Don't force the user to set this in the mergemaster rc file
337 if [ -n "${PRESERVE_FILES}" -a -z "${PRESERVE_FILES_DIR}" ]; then
338 PRESERVE_FILES_DIR=/var/tmp/mergemaster/preserved-files-`date +%y%m%d-%H%M%S`
341 # Check the for the mtree database in DESTDIR.
342 if [ ! -f ${DESTDIR}${MTREEDB} ]; then
343 echo "*** Unable to
find mtree database. Skipping auto-upgrade.
"
349 # If the user has a pager defined, make sure we can run it
351 case "${DONT_CHECK_PAGER}" in
353 while ! type "${PAGER%% *}" >/dev/null && [ -n "${PAGER}" ]; do
354 echo " *** Your PAGER environment variable specifies
'${PAGER}', but
"
355 echo " due to the limited PATH that I use
for security reasons
,"
356 echo " I cannot execute it. So
, what would you like to
do?
"
358 echo " Use
'e' to
exit mergemaster and fix your PAGER variable
"
359 if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then
360 echo " Use
'l' to
set PAGER to
'less' for this run
"
362 echo " Use
'm' to use plain old
'more' as your PAGER
for this run
"
364 echo " Default is to use plain old
'more' "
366 echo -n "What should I
do?
[Use
'more'] "
369 case "${FIXPAGER}" in
374 if [ -x /usr/bin/less ]; then
376 elif [ -x /usr/local/bin/less ]; then
377 PAGER=/usr/local/bin/less
380 echo " *** Fatal Error
:"
381 echo " You asked to use
'less' as your pager
, but I can
't"
382 echo " find it in /usr/bin or /usr/local/bin"
391 echo "invalid choice: ${FIXPAGER}"
398 # If user has a pager defined, or got assigned one above, use it.
403 if [ -n "${VERBOSE}" -a ! "${PAGER}" = "more" ]; then
404 echo " *** You have ${PAGER} defined as your pager so we will use that"
409 # Assign the diff flag once so we will not have to keep testing it
411 DIFF_FLAG=${DIFF_FLAG:--u}
413 # Assign the source directory
415 SOURCEDIR=${SOURCEDIR:-/usr/src/etc}
417 # Check DESTDIR against the mergemaster mtree database to see what
418 # files the user changed from the reference files.
421 if [ -n "${AUTO_UPGRADE}" -a -f "${DESTDIR}${MTREEDB}" ]; then
422 for file in `mtree -eq -f ${DESTDIR}${MTREEDB} -p ${DESTDIR}/ \
423 2>/dev/null | awk '($2 == "changed") {print
$1}'`; do
424 if [ -f "${DESTDIR}/$file" ]; then
425 CHANGED="${CHANGED} ${DESTDIR}/$file"
430 # Check the width of the user's terminal
435 0|
'') ;; # No-op, since the input is not valid
437 case "${SCREEN_WIDTH}" in
438 '') SCREEN_WIDTH
="${w}" ;;
439 "${w}") ;; # No-op, since they are the same
441 echo -n "*** You entered ${SCREEN_WIDTH} as your screen width, but stty "
442 echo "thinks it is ${w}."
444 echo -n "What would you like to use? [${w}] "
446 case "${SCREEN_WIDTH}" in
447 '') SCREEN_WIDTH
="${w}" ;;
454 # Define what CVS $Id tag to look for to aid portability.
459 rm -rf "${TEMPROOT}" 2>/dev
/null
460 chflags
-R 0 "${TEMPROOT}" 2>/dev
/null
461 rm -rf "${TEMPROOT}" ||
exit 1
466 # Set up the loop to test for the existence of the
467 # temp root directory.
470 while [ "${TEST_TEMP_ROOT}" = "yes" ]; do
471 if [ -d "${TEMPROOT}" ]; then
472 echo "*** The directory specified for the temporary root environment,"
473 echo " ${TEMPROOT}, exists. This can be a security risk if untrusted"
474 echo " users have access to the system."
476 case "${AUTO_RUN}" in
478 echo " Use 'd' to delete the old ${TEMPROOT} and continue"
479 echo " Use 't' to select a new temporary root directory"
480 echo " Use 'e' to exit mergemaster"
482 echo " Default is to use ${TEMPROOT} as is"
484 echo -n "How should I deal with this? [Use the existing ${TEMPROOT}] "
487 case "${DELORNOT}" in
490 echo " *** Deleting the old ${TEMPROOT}"
492 delete_temproot ||
exit 1
496 echo " *** Enter new directory name for temporary root environment"
504 echo " *** Leaving ${TEMPROOT} intact"
510 echo "invalid choice: ${DELORNOT}"
516 # If this is an auto-run, try a hopefully safe alternative then
518 TEMPROOT
=/var
/tmp
/temproot.
`date +%m%d.%H.%M.%S`
526 echo "*** Creating the temporary root environment in ${TEMPROOT}"
528 if mkdir
-p "${TEMPROOT}"; then
529 echo " *** ${TEMPROOT} ready for use"
532 if [ ! -d "${TEMPROOT}" ]; then
534 echo " *** FATAL ERROR: Cannot create ${TEMPROOT}"
539 echo " *** Creating and populating directory structure in ${TEMPROOT}"
549 case "${PRE_WORLD}" in
555 make DESTDIR
=${DESTDIR} ${ARCHSTRING} distrib-dirs
558 make DESTDIR
=${TEMPROOT} ${ARCHSTRING} distrib-dirs
&&
559 MAKEOBJDIRPREFIX
=${TEMPROOT}/usr
/obj
make ${ARCHSTRING} obj
&&
560 MAKEOBJDIRPREFIX
=${TEMPROOT}/usr
/obj
make ${ARCHSTRING} all
&&
561 MAKEOBJDIRPREFIX
=${TEMPROOT}/usr
/obj
make ${ARCHSTRING} \
562 DESTDIR
=${TEMPROOT} distribution
;} ||
564 echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to";
565 echo " the temproot environment";
570 # Only set up files that are crucial to {build|install}world
571 { mkdir
-p ${TEMPROOT}/etc
&&
572 cp -p ${SOURCEDIR}/master.passwd
${TEMPROOT}/etc
&&
573 cp -p ${SOURCEDIR}/group ${TEMPROOT}/etc;} ||
575 echo ' *** FATAL ERROR: Cannot copy files to the temproot environment';
581 # Doing the inventory and removing files that we don't want to compare only
582 # makes sense if we are not doing a rerun, since we have no way of knowing
583 # what happened to the files during previous incarnations.
588 echo ' *** The following files exist only in the installed version of'
589 echo " ${DESTDIR}/etc. In the vast majority of cases these files"
590 echo ' are necessary parts of the system and should not be deleted.'
591 echo ' However because these files are not updated by this process you'
592 echo ' might want to verify their status before rebooting your system.'
595 diff -qr ${DESTDIR}/etc ${TEMPROOT}/etc | grep "^Only in ${DESTDIR}/etc" | ${PAGER}
601 # Avoid comparing the motd if the user specifies it in .mergemasterrc
602 case "${IGNORE_MOTD}" in
604 *) rm -f ${TEMPROOT}/etc
/motd
608 # Avoid trying to update MAKEDEV if /dev is on a devfs
609 if /sbin
/sysctl vfs.devfs.generation
> /dev
/null
2>&1 ; then
610 rm -f ${TEMPROOT}/dev
/MAKEDEV
${TEMPROOT}/dev
/MAKEDEV.
local
613 ;; # End of the "RERUN" test
616 # We really don't want to have to deal with files like login.conf.db, pwd.db,
617 # or spwd.db. Instead, we want to compare the text versions, and run *_mkdb.
618 # Prompt the user to do so below, as needed.
620 rm -f ${TEMPROOT}/etc
/*.db
${TEMPROOT}/etc
/passwd
622 # We only need to compare things like freebsd.cf once
623 find ${TEMPROOT}/usr
/obj
-type f
-delete 2>/dev
/null
625 # Delete 0 length files to make the mtree database as small as possible.
626 find ${TEMPROOT} -type f
-size 0 -delete 2>/dev
/null
628 # Build the mtree database in a temporary location.
629 # TODO: Possibly use mktemp instead for security reasons?
630 case "${PRE_WORLD}" in
631 '') mtree
-ci -p ${TEMPROOT} -k size,md5digest > ${DESTDIR}${MTREEDB}.new
2>/dev
/null
633 *) # We don't want to mess with the mtree database on a pre-world run.
637 # Get ready to start comparing files
639 # Check umask if not specified on the command line,
640 # and we are not doing an autorun
642 if [ -z "${NEW_UMASK}" -a -z "${AUTO_RUN}" ]; then
644 case "${USER_UMASK}" in
648 echo " *** Your umask is currently set to ${USER_UMASK}. By default, this script"
649 echo " installs all files with the same user, group and modes that"
650 echo " they are created with by ${SOURCEDIR}/Makefile, compared to"
651 echo " a umask of 022. This umask allows world read permission when"
652 echo " the file's default permissions have it."
654 echo " No world permissions can sometimes cause problems. A umask of"
655 echo " 022 will restore the default behavior, but is not mandatory."
656 echo " /etc/master.passwd is a special case. Its file permissions"
657 echo " will be 600 (rw-------) if installed."
659 echo -n "What umask should I use? [${USER_UMASK}] "
662 NEW_UMASK
="${NEW_UMASK:-$USER_UMASK}"
668 CONFIRMED_UMASK
=${NEW_UMASK:-0022}
671 # Warn users who still have old rc files
673 for file in atm devfs diskless1 diskless2 network network6 pccard \
674 serial syscons sysctl alpha amd64 i386 ia64 sparc64
; do
675 if [ -f "${DESTDIR}/etc/rc.${file}" ]; then
681 case "${OLD_RC_PRESENT}" in
684 echo " *** There are elements of the old rc system in ${DESTDIR}/etc/."
686 echo ' While these scripts will not hurt anything, they are not'
687 echo ' functional on an up to date system, and can be removed.'
690 case "${AUTO_RUN}" in
692 echo -n 'Move these files to /var/tmp/mergemaster/old_rc? [yes] '
695 case "${MOVE_OLD_RC}" in
698 mkdir
-p /var
/tmp
/mergemaster
/old_rc
699 for file in atm devfs diskless1 diskless2 network network6 pccard \
700 serial syscons sysctl alpha amd64 i386 ia64 sparc64
; do
701 if [ -f "${DESTDIR}/etc/rc.${file}" ]; then
702 mv ${DESTDIR}/etc
/rc.
${file} /var
/tmp
/mergemaster
/old_rc
/
705 echo ' The files have been moved'
714 # Use the umask/mode information to install the files
715 # Create directories as needed
717 do_install_and_rm
() {
718 case "${PRESERVE_FILES}" in
720 if [ -f "${3}/${2##*/}" ]; then
721 mkdir
-p ${PRESERVE_FILES_DIR}/${2%/*}
722 cp ${3}/${2##*/} ${PRESERVE_FILES_DIR}/${2%/*}
727 install -m "${1}" "${2}" "${3}" &&
731 # 4095 = "obase=10;ibase=8;07777" | bc
734 OCTAL
=$
(( ~$
(echo "obase=10; ibase=8; ${CONFIRMED_UMASK}" |
bc) & 4095 &
735 $
(echo "obase=10; ibase=8; $(stat -f "%OMp
%OLp
" ${1})" |
bc) ))
736 printf "%04o\n" ${OCTAL}
742 INSTALL_DIR
=${INSTALL_DIR%/*}
744 case "${INSTALL_DIR}" in
750 if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then
751 DIR_MODE
=`find_mode "${TEMPROOT}/${INSTALL_DIR}"`
752 install -d -o root
-g wheel
-m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}"
755 FILE_MODE
=`find_mode "${1}"`
757 if [ ! -x "${1}" ]; then
766 do_install_and_rm
600 "${1}" "${DESTDIR}${INSTALL_DIR}"
771 case "${AUTO_INSTALL}" in
773 case "${LINK_EXPLAINED}" in
775 echo " *** Historically BSD derived systems have had a"
776 echo " hard link from /.cshrc and /.profile to"
777 echo " their namesakes in /root. Please indicate"
778 echo " your preference below for bringing your"
779 echo " installed files up to date."
785 echo " Use 'd' to delete the temporary ${COMPFILE}"
786 echo " Use 'l' to delete the existing ${DESTDIR}${COMPFILE#.} and create the link"
788 echo " Default is to leave the temporary file to deal with by hand"
790 echo -n " How should I handle ${COMPFILE}? [Leave it to install later] "
793 *) # Part of AUTO_INSTALL
798 case "${HANDLE_LINK}" in
802 echo " *** Deleting ${COMPFILE}"
806 rm -f "${DESTDIR}${COMPFILE#.}"
807 if ln "${DESTDIR}/root/${COMPFILE##*/}" "${DESTDIR}${COMPFILE#.}"; then
808 echo " *** Link from ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/} installed successfully"
811 echo " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}, ${COMPFILE} will remain to install by hand"
815 echo " *** ${COMPFILE} will remain for your consideration"
822 case "${DONT_INSTALL}" in
824 do_install_and_rm
"${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}"
830 else # File matched -x
836 do_install_and_rm
"${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}"
841 if [ ! -d "${TEMPROOT}" ]; then
842 echo "*** FATAL ERROR: The temproot directory (${TEMPROOT})"
843 echo ' has disappeared!'
849 echo "*** Beginning comparison"
852 # Pre-world does not populate /etc/rc.d.
853 # It is very possible that a previous run would have deleted files in
854 # ${TEMPROOT}/etc/rc.d, thus creating a lot of false positives.
855 if [ -z "${PRE_WORLD}" -a -z "${RERUN}" ]; then
856 echo " *** Checking ${DESTDIR}/etc/rc.d for stale files"
858 cd "${DESTDIR}/etc/rc.d" &&
860 if [ ! -e "${TEMPROOT}/etc/rc.d/${file}" ]; then
861 STALE_RC_FILES
="${STALE_RC_FILES} ${file}"
864 case "${STALE_RC_FILES}" in
866 echo ' *** No stale files found'
869 echo " *** The following files exist in ${DESTDIR}/etc/rc.d but not in"
870 echo " ${TEMPROOT}/etc/rc.d/:"
872 echo "${STALE_RC_FILES}"
874 echo ' The presence of stale files in this directory can cause the'
875 echo ' dreaded unpredictable results, and therefore it is highly'
876 echo ' recommended that you delete them.'
877 case "${AUTO_RUN}" in
880 echo -n ' *** Delete them now? [n] '
881 read DELETE_STALE_RC_FILES
882 case "${DELETE_STALE_RC_FILES}" in
884 echo ' *** Deleting ... '
889 echo ' *** Files will not be deleted'
902 if [ -r "${MM_PRE_COMPARE_SCRIPT}" ]; then
903 .
"${MM_PRE_COMPARE_SCRIPT}"
906 # Using -size +0 avoids uselessly checking the empty log files created
907 # by ${SOURCEDIR}/Makefile and the device entries in ./dev, but does
908 # check the scripts in ./dev, as we'd like (assuming no devfs of course).
910 for COMPFILE
in `find . -type f -size +0`; do
912 # First, check to see if the file exists in DESTDIR. If not, the
913 # diff_loop function knows how to handle it.
915 if [ ! -e "${DESTDIR}${COMPFILE#.}" ]; then
916 case "${AUTO_RUN}" in
921 case "${AUTO_INSTALL}" in
923 # If this is an auto run, make it official
924 echo " *** ${COMPFILE} will remain for your consideration"
937 # Compare CVS $Id's first so if the file hasn't been modified
938 # local changes will be ignored.
939 # If the files have the same $Id, delete the one in temproot so the
940 # user will have less to wade through if files are left to merge by hand.
942 CVSID1
=`grep "[$]${CVS_ID_TAG}:" ${DESTDIR}${COMPFILE#.} 2>/dev/null`
943 CVSID2
=`grep "[$]${CVS_ID_TAG}:" ${COMPFILE} 2>/dev/null` || CVSID2
=none
947 echo " *** Temp ${COMPFILE} and installed have the same CVS Id, deleting"
954 # If the file is still here either because the $Ids are different, the
955 # file doesn't have an $Id, or we're using STRICT mode; look at the diff.
957 if [ -f "${COMPFILE}" ]; then
959 # Do an absolute diff first to see if the files are actually different.
960 # If they're not different, delete the one in temproot.
962 if diff -q ${DIFF_OPTIONS} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \
964 echo " *** Temp
${COMPFILE} and installed are the same
, deleting
"
967 # Ok, the files are different, so show the user where they differ.
968 # Use user's choice of diff methods; and user's pager if they have one.
970 # Use unified diffs by default. Context diffs give me a headache. :)
972 case "${AUTO_RUN}" in
974 # prompt user to install/delete/merge changes
978 # If this is an auto run, make it official
979 echo " *** ${COMPFILE} will remain
for your consideration
"
982 fi # Yes, the files are different
983 fi # Yes, the file still remains to be checked
984 done # This is for the do way up there at the beginning of the comparison
987 echo "*** Comparison complete
"
989 if [ -f "${DESTDIR}${MTREEDB}.new
" ]; then
990 echo "*** Saving mtree database
for future upgrades
"
991 mv -f ${DESTDIR}${MTREEDB}.new ${DESTDIR}${MTREEDB} 2>/dev/null
996 TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null`
997 if [ -n "${TEST_FOR_FILES}" ]; then
998 echo "*** Files that remain
for you to merge by hand
:"
999 find "${TEMPROOT}" -type f -size +0
1003 case "${AUTO_RUN}" in
1005 echo -n "Do you wish to delete what is left of
${TEMPROOT}?
[no
] "
1008 case "${DEL_TEMPROOT}" in
1010 if delete_temproot; then
1011 echo " *** ${TEMPROOT} has been deleted
"
1013 echo " *** Unable to delete
${TEMPROOT}"
1017 echo " *** ${TEMPROOT} will remain
"
1024 case "${AUTO_INSTALLED_FILES}" in
1027 case "${AUTO_RUN}" in
1031 echo '*** You chose the automatic install option for files that did not'
1032 echo ' exist on your system. The following were installed for you:'
1033 echo "${AUTO_INSTALLED_FILES}"
1038 echo '*** You chose the automatic install option for files that did not'
1039 echo ' exist on your system. The following were installed for you:'
1040 echo "${AUTO_INSTALLED_FILES}"
1046 case "${AUTO_UPGRADED_FILES}" in
1049 case "${AUTO_RUN}" in
1053 echo '*** You chose the automatic upgrade option for files that you did'
1054 echo ' not alter on your system. The following were upgraded for you:'
1055 echo "${AUTO_UPGRADED_FILES}"
1060 echo '*** You chose the automatic upgrade option for files that you did'
1061 echo ' not alter on your system. The following were upgraded for you:'
1062 echo "${AUTO_UPGRADED_FILES}"
1069 case "${AUTO_RUN}" in
1073 echo -n ' Would you like to run it now? y or n [n] '
1076 case "${YES_OR_NO}" in
1078 echo " Running
${1}"
1084 echo " *** Cancelled
"
1086 echo " Make sure to run
${1} yourself
"
1090 echo " *** Sorry
, I
do not understand your answer
(${YES_OR_NO})"
1092 echo " Make sure to run
${1} yourself
"
1099 case "${NEED_MAKEDEV}" in
1103 echo "*** You installed a new
${DESTDIR}/dev
/MAKEDEV
script, so
make sure that you run
"
1104 echo " 'cd ${DESTDIR}/dev && /bin/sh MAKEDEV all' to rebuild your devices
"
1105 run_it_now "cd ${DESTDIR}/dev
&& /bin
/sh MAKEDEV all
"
1109 case "${NEED_NEWALIASES}" in
1113 if [ -n "${DESTDIR}" ]; then
1114 echo "*** You installed a new aliases
file into
${DESTDIR}/etc
/mail, but
"
1115 echo " the newaliases
command is limited to the directories configured
"
1116 echo " in sendmail.cf. Make sure to create your aliases database by
"
1117 echo " hand when your sendmail configuration is
done.
"
1119 echo "*** You installed a new aliases
file, so
make sure that you run
"
1120 echo " '/usr/bin/newaliases' to rebuild your aliases database
"
1121 run_it_now '/usr/bin/newaliases'
1126 case "${NEED_CAP_MKDB}" in
1130 echo "*** You installed a login.conf
file, so
make sure that you run
"
1131 echo " '/usr/bin/cap_mkdb ${DESTDIR}/etc/login.conf'"
1132 echo " to rebuild your login.conf database
"
1133 run_it_now "/usr
/bin
/cap_mkdb
${DESTDIR}/etc
/login.conf
"
1137 case "${NEED_PWD_MKDB}" in
1141 echo "*** You installed a new master.passwd
file, so
make sure that you run
"
1142 if [ -n "${DESTDIR}" ]; then
1143 echo " '/usr/sbin/pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd'"
1144 echo " to rebuild your password files
"
1145 run_it_now "/usr
/sbin
/pwd_mkdb
-d ${DESTDIR}/etc
-p ${DESTDIR}/etc
/master.passwd
"
1147 echo " '/usr/sbin/pwd_mkdb -p /etc/master.passwd'"
1148 echo " to rebuild your password files
"
1149 run_it_now '/usr/sbin/pwd_mkdb -p /etc/master.passwd'
1156 if [ -r "${MM_EXIT_SCRIPT}" ]; then
1157 . "${MM_EXIT_SCRIPT}"
1160 case "${COMP_CONFS}" in
1163 . ${DESTDIR}/etc/defaults/rc.conf
1166 echo "*** Comparing conf files
: ${rc_conf_files}"
1168 for CONF_FILE in ${rc_conf_files}; do
1169 if [ -r "${DESTDIR}${CONF_FILE}" ]; then
1171 echo "*** From
${DESTDIR}${CONF_FILE}"
1172 echo "*** From
${DESTDIR}/etc
/defaults
/rc.conf
"
1174 for RC_CONF_VAR in `grep -i ^[a-z] ${DESTDIR}${CONF_FILE} |
1175 cut -d '=' -f 1`; do
1177 grep -w ^${RC_CONF_VAR} ${DESTDIR}${CONF_FILE}
1178 grep -w ^${RC_CONF_VAR} ${DESTDIR}/etc/defaults/rc.conf ||
1179 echo ' * No default variable with this name'
1187 case "${PRE_WORLD}" in
1190 MAKE_CONF="${SOURCEDIR%etc}share
/examples
/etc
/make.conf
"
1193 echo '*** Comparing make variables'
1195 echo "*** From
${DESTDIR}/etc
/make.conf
"
1196 echo "*** From
${MAKE_CONF}"
1198 for MAKE_VAR in `grep -i ^[a-z] ${DESTDIR}/etc/make.conf | cut -d '=' -f 1`; do
1200 grep -w ^${MAKE_VAR} ${DESTDIR}/etc/make.conf
1201 grep -w ^#${MAKE_VAR} ${MAKE_CONF} ||
1202 echo ' * No example variable with this name'