mergemaster.sh revision 97380
152400Sbillf#!/bin/sh 252400Sbillf 352400Sbillf# mergemaster 452400Sbillf 552400Sbillf# Compare files created by /usr/src/etc/Makefile (or the directory 652400Sbillf# the user specifies) with the currently installed copies. 752400Sbillf 890564Sdougb# Copyright 1998-2002 Douglas Barton 973651Sdougb# DougB@FreeBSD.org 1052400Sbillf 1152495Sbillf# $FreeBSD: head/usr.sbin/mergemaster/mergemaster.sh 97380 2002-05-28 07:25:44Z dougb $ 1252400Sbillf 1368507SdougbPATH=/bin:/usr/bin:/usr/sbin 1452400Sbillf 1552400Sbillfdisplay_usage () { 1652533Sbillf VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` 1752400Sbillf echo "mergemaster version ${VERSION_NUMBER}" 1891193Sdougb echo 'Usage: mergemaster [-scrvahipC] [-m /path]' 1967949Sdougb echo ' [-t /path] [-d] [-u N] [-w N] [-D /path]' 2052400Sbillf echo "Options:" 2152400Sbillf echo " -s Strict comparison (diff every pair of files)" 2252400Sbillf echo " -c Use context diff instead of unified diff" 2352400Sbillf echo " -r Re-run on a previously cleaned directory (skip temproot creation)" 2452400Sbillf echo " -v Be more verbose about the process, include additional checks" 2552400Sbillf echo " -a Leave all files that differ to merge by hand" 2652400Sbillf echo " -h Display more complete help" 2767949Sdougb echo ' -i Automatically install files that do not exist in destination directory' 2891193Sdougb echo ' -p Pre-buildworld mode, only compares crucial files' 2991193Sdougb echo ' -C Compare local rc.conf variables to the defaults' 3052400Sbillf echo " -m /path/directory Specify location of source to do the make in" 3152400Sbillf echo " -t /path/directory Specify temp root directory" 3252400Sbillf echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)" 3352400Sbillf echo " -u N Specify a numeric umask" 3452400Sbillf echo " -w N Specify a screen width in columns to sdiff" 3567949Sdougb echo ' -D /path/directory Specify the destination directory to install files to' 3652400Sbillf echo '' 3752400Sbillf} 3852400Sbillf 3952400Sbillfdisplay_help () { 4052400Sbillf echo "* To specify a directory other than /var/tmp/temproot for the" 4152400Sbillf echo " temporary root environment, use -t /path/to/temp/root" 4252400Sbillf echo "* The -w option takes a number as an argument for the column width" 4367859Sdougb echo " of the screen. The default is 80." 4467949Sdougb echo '* The -a option causes mergemaster to run without prompting.' 4552400Sbillf} 4652400Sbillf 4758910Salfred# Loop allowing the user to use sdiff to merge files and display the merged 4858910Salfred# file. 4958910Salfredmerge_loop () { 5067850Sdougb case "${VERBOSE}" in 5167850Sdougb '') ;; 5267850Sdougb *) 5367850Sdougb echo " *** Type h at the sdiff prompt (%) to get usage help" 5467850Sdougb ;; 5567850Sdougb esac 5667850Sdougb echo '' 5767850Sdougb MERGE_AGAIN=yes 5867850Sdougb while [ "${MERGE_AGAIN}" = "yes" ]; do 5967850Sdougb # Prime file.merged so we don't blat the owner/group id's 6067850Sdougb cp -p "${COMPFILE}" "${COMPFILE}.merged" 6167850Sdougb sdiff -o "${COMPFILE}.merged" --text --suppress-common-lines \ 6267949Sdougb --width=${SCREEN_WIDTH:-80} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" 6367850Sdougb INSTALL_MERGED=V 6467850Sdougb while [ "${INSTALL_MERGED}" = "v" -o "${INSTALL_MERGED}" = "V" ]; do 6567850Sdougb echo '' 6667850Sdougb echo " Use 'i' to install merged file" 6767850Sdougb echo " Use 'r' to re-do the merge" 6867850Sdougb echo " Use 'v' to view the merged file" 6967850Sdougb echo " Default is to leave the temporary file to deal with by hand" 7067850Sdougb echo '' 7167859Sdougb echo -n " *** How should I deal with the merged file? [Leave it for later] " 7267859Sdougb read INSTALL_MERGED 7358910Salfred 7467850Sdougb case "${INSTALL_MERGED}" in 7567850Sdougb [iI]) 7667850Sdougb mv "${COMPFILE}.merged" "${COMPFILE}" 7767850Sdougb echo '' 7867850Sdougb if mm_install "${COMPFILE}"; then 7967850Sdougb echo " *** Merged version of ${COMPFILE} installed successfully" 8067859Sdougb else 8167850Sdougb echo " *** Problem installing ${COMPFILE}, it will remain to merge by hand later" 8267859Sdougb fi 8367850Sdougb unset MERGE_AGAIN 8467850Sdougb ;; 8567850Sdougb [rR]) 8667850Sdougb rm "${COMPFILE}.merged" 8767859Sdougb ;; 8867850Sdougb [vV]) 8967850Sdougb ${PAGER} "${COMPFILE}.merged" 9067850Sdougb ;; 9167850Sdougb '') 9267850Sdougb echo " *** ${COMPFILE} will remain for your consideration" 9367850Sdougb unset MERGE_AGAIN 9467850Sdougb ;; 9567850Sdougb *) 9667850Sdougb echo "invalid choice: ${INSTALL_MERGED}" 9767850Sdougb INSTALL_MERGED=V 9867850Sdougb ;; 9967850Sdougb esac 10067850Sdougb done 10167850Sdougb done 10258910Salfred} 10358910Salfred 10458910Salfred# Loop showing user differences between files, allow merge, skip or install 10558910Salfred# options 10658910Salfreddiff_loop () { 10758910Salfred 10867850Sdougb HANDLE_COMPFILE=v 10958910Salfred 11077323Sdougb while [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" -o \ 11177323Sdougb "${HANDLE_COMPFILE}" = "NOT V" ]; do 11267949Sdougb if [ -f "${DESTDIR}${COMPFILE#.}" -a -f "${COMPFILE}" ]; then 11367850Sdougb if [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" ]; then 11490564Sdougb echo '' 11590564Sdougb echo ' ====================================================================== ' 11690564Sdougb echo '' 11767850Sdougb ( 11867949Sdougb echo '' 11967850Sdougb echo " *** Displaying differences between ${COMPFILE} and installed version:" 12067850Sdougb echo '' 12167949Sdougb diff "${DIFF_FLAG}" "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" 12267850Sdougb ) | ${PAGER} 12367850Sdougb echo '' 12467850Sdougb fi 12567850Sdougb else 12667949Sdougb echo '' 12767850Sdougb echo " *** There is no installed version of ${COMPFILE}" 12891193Sdougb echo '' 12967949Sdougb case "${AUTO_INSTALL}" in 13067949Sdougb [Yy][Ee][Ss]) 13167949Sdougb echo '' 13267949Sdougb if mm_install "${COMPFILE}"; then 13367949Sdougb echo " *** ${COMPFILE} installed successfully" 13468507Sdougb echo '' 13567949Sdougb # Make the list print one file per line 13667949Sdougb AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES} ${DESTDIR}${COMPFILE#.} 13767949Sdougb" 13867949Sdougb else 13967949Sdougb echo " *** Problem installing ${COMPFILE}, it will remain to merge by hand" 14067949Sdougb fi 14167949Sdougb return 14267949Sdougb ;; 14367949Sdougb *) 14467949Sdougb NO_INSTALLED=yes 14567949Sdougb ;; 14667949Sdougb esac 14767850Sdougb fi 14867859Sdougb 14967850Sdougb echo " Use 'd' to delete the temporary ${COMPFILE}" 15067850Sdougb echo " Use 'i' to install the temporary ${COMPFILE}" 15167850Sdougb case "${NO_INSTALLED}" in 15267850Sdougb '') 15377326Sdougb echo " Use 'm' to merge the temporary and installed versions" 15477326Sdougb echo " Use 'v' to view the diff results again" 15567850Sdougb ;; 15667850Sdougb esac 15767850Sdougb echo '' 15867850Sdougb echo " Default is to leave the temporary file to deal with by hand" 15967850Sdougb echo '' 16067859Sdougb echo -n "How should I deal with this? [Leave it for later] " 16167859Sdougb read HANDLE_COMPFILE 16267859Sdougb 16367850Sdougb case "${HANDLE_COMPFILE}" in 16467850Sdougb [dD]) 16567850Sdougb rm "${COMPFILE}" 16667850Sdougb echo '' 16767850Sdougb echo " *** Deleting ${COMPFILE}" 16867850Sdougb ;; 16967850Sdougb [iI]) 17067850Sdougb echo '' 17167850Sdougb if mm_install "${COMPFILE}"; then 17267850Sdougb echo " *** ${COMPFILE} installed successfully" 17367850Sdougb else 17467850Sdougb echo " *** Problem installing ${COMPFILE}, it will remain to merge by hand" 17567850Sdougb fi 17667850Sdougb ;; 17767850Sdougb [mM]) 17867850Sdougb case "${NO_INSTALLED}" in 17967850Sdougb '') 18067850Sdougb # interact with user to merge files 18167850Sdougb merge_loop 18267850Sdougb ;; 18367850Sdougb *) 18467850Sdougb echo '' 18567850Sdougb echo " *** There is no installed version of ${COMPFILE}" 18667850Sdougb echo '' 18767850Sdougb HANDLE_COMPFILE="NOT V" 18867850Sdougb ;; 18967850Sdougb esac # End of "No installed version of file but user selected merge" test 19067850Sdougb ;; 19167850Sdougb [vV]) 19267850Sdougb continue 19367850Sdougb ;; 19467850Sdougb '') 19567850Sdougb echo '' 19667850Sdougb echo " *** ${COMPFILE} will remain for your consideration" 19767850Sdougb ;; 19867850Sdougb *) 19967850Sdougb # invalid choice, show menu again. 20067850Sdougb echo "invalid choice: ${HANDLE_COMPFILE}" 20167850Sdougb echo '' 20267850Sdougb HANDLE_COMPFILE="NOT V" 20367850Sdougb continue 20467850Sdougb ;; 20567850Sdougb esac # End of "How to handle files that are different" 20667859Sdougb done 20767850Sdougb unset NO_INSTALLED 20867850Sdougb echo '' 20967850Sdougb case "${VERBOSE}" in 21067850Sdougb '') ;; 21167850Sdougb *) 21267850Sdougb sleep 3 21367850Sdougb ;; 21467850Sdougb esac 21558910Salfred} 21658910Salfred 21752400Sbillf# Set the default path for the temporary root environment 21852400Sbillf# 21952400SbillfTEMPROOT='/var/tmp/temproot' 22052400Sbillf 22173651Sdougb# Read /etc/mergemaster.rc first so the one in $HOME can override 22273651Sdougb# 22373651Sdougbif [ -r /etc/mergemaster.rc ]; then 22473651Sdougb . /etc/mergemaster.rc 22573651Sdougbfi 22673651Sdougb 22752400Sbillf# Read .mergemasterrc before command line so CLI can override 22852400Sbillf# 22967949Sdougbif [ -r "$HOME/.mergemasterrc" ]; then 23052400Sbillf . "$HOME/.mergemasterrc" 23152400Sbillffi 23252400Sbillf 23352400Sbillf# Check the command line options 23452400Sbillf# 23591193Sdougbwhile getopts ":ascrvhipCm:t:du:w:D:" COMMAND_LINE_ARGUMENT ; do 23652400Sbillf case "${COMMAND_LINE_ARGUMENT}" in 23752400Sbillf s) 23852400Sbillf STRICT=yes 23952400Sbillf ;; 24052400Sbillf c) 24152400Sbillf DIFF_FLAG='-c' 24252400Sbillf ;; 24352400Sbillf r) 24452400Sbillf RERUN=yes 24552400Sbillf ;; 24652400Sbillf v) 24752400Sbillf case "${AUTO_RUN}" in 24852400Sbillf '') VERBOSE=yes ;; 24952400Sbillf esac 25052400Sbillf ;; 25152400Sbillf a) 25252400Sbillf AUTO_RUN=yes 25352400Sbillf unset VERBOSE 25452400Sbillf ;; 25552400Sbillf h) 25652400Sbillf display_usage 25752400Sbillf display_help 25852400Sbillf exit 0 25952400Sbillf ;; 26067949Sdougb i) 26167949Sdougb AUTO_INSTALL=yes 26267949Sdougb ;; 26396045Sdougb C) 26496045Sdougb COMP_CONFS=yes 26596045Sdougb ;; 26691193Sdougb p) 26791193Sdougb PRE_WORLD=yes 26896045Sdougb unset COMP_CONFS 26996045Sdougb unset AUTO_RUN 27091193Sdougb ;; 27152400Sbillf m) 27252400Sbillf SOURCEDIR=${OPTARG} 27352400Sbillf ;; 27452400Sbillf t) 27552400Sbillf TEMPROOT=${OPTARG} 27652400Sbillf ;; 27752400Sbillf d) 27852400Sbillf TEMPROOT=${TEMPROOT}.`date +%m%d.%H.%M` 27952400Sbillf ;; 28052400Sbillf u) 28152400Sbillf NEW_UMASK=${OPTARG} 28252400Sbillf ;; 28352400Sbillf w) 28452400Sbillf SCREEN_WIDTH=${OPTARG} 28552400Sbillf ;; 28667949Sdougb D) 28767949Sdougb DESTDIR=${OPTARG} 28867949Sdougb ;; 28952400Sbillf *) 29052400Sbillf display_usage 29152400Sbillf exit 1 29252400Sbillf ;; 29352400Sbillf esac 29452400Sbillfdone 29552400Sbillf 29652400Sbillfecho '' 29752400Sbillf 29852400Sbillf# If the user has a pager defined, make sure we can run it 29952400Sbillf# 30052400Sbillfcase "${DONT_CHECK_PAGER}" in 30152400Sbillf'') 30264467Sbrian while ! type "${PAGER%% *}" >/dev/null && [ -n "${PAGER}" ]; do 30352400Sbillf echo " *** Your PAGER environment variable specifies '${PAGER}', but" 30464467Sbrian echo " due to the limited PATH that I use for security reasons," 30567859Sdougb echo " I cannot execute it. So, what would you like to do?" 30652400Sbillf echo '' 30752400Sbillf echo " Use 'e' to exit mergemaster and fix your PAGER variable" 30864467Sbrian if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then 30964467Sbrian echo " Use 'l' to set PAGER to 'less' for this run" 31052400Sbillf fi 31152400Sbillf echo " Use 'm' to use plain old 'more' as your PAGER for this run" 31252400Sbillf echo '' 31352400Sbillf echo " Default is to use plain old 'more' " 31452400Sbillf echo '' 31567859Sdougb echo -n "What should I do? [Use 'more'] " 31667859Sdougb read FIXPAGER 31767859Sdougb 31852400Sbillf case "${FIXPAGER}" in 31958910Salfred [eE]) 32052400Sbillf exit 0 32152400Sbillf ;; 32258910Salfred [lL]) 32364467Sbrian if [ -x /usr/bin/less ]; then 32464467Sbrian PAGER=/usr/bin/less 32564467Sbrian elif [ -x /usr/local/bin/less ]; then 32658910Salfred PAGER=/usr/local/bin/less 32764467Sbrian else 32864467Sbrian echo '' 32964467Sbrian echo " *** Fatal Error:" 33064467Sbrian echo " You asked to use 'less' as your pager, but I can't" 33164467Sbrian echo " find it in /usr/bin or /usr/local/bin" 33264467Sbrian exit 1 33358910Salfred fi 33452400Sbillf ;; 33560420Sbsd [mM]|'') 33652400Sbillf PAGER=more 33752400Sbillf ;; 33858910Salfred *) 33958910Salfred echo '' 34058910Salfred echo "invalid choice: ${FIXPAGER}" 34152400Sbillf esac 34252400Sbillf echo '' 34358910Salfred done 34452400Sbillf ;; 34552400Sbillfesac 34652400Sbillf 34752400Sbillf# If user has a pager defined, or got assigned one above, use it. 34852400Sbillf# If not, use more. 34952400Sbillf# 35052400SbillfPAGER=${PAGER:-more} 35152400Sbillf 35252400Sbillfif [ -n "${VERBOSE}" -a ! "${PAGER}" = "more" ]; then 35352400Sbillf echo " *** You have ${PAGER} defined as your pager so we will use that" 35452400Sbillf echo '' 35552400Sbillf sleep 3 35652400Sbillffi 35752400Sbillf 35852400Sbillf# Assign the diff flag once so we will not have to keep testing it 35952400Sbillf# 36052400SbillfDIFF_FLAG=${DIFF_FLAG:--u} 36152400Sbillf 36252400Sbillf# Assign the source directory 36352400Sbillf# 36452400SbillfSOURCEDIR=${SOURCEDIR:-/usr/src/etc} 36552400Sbillf 36696045Sdougb# Check the width of the user's terminal 36796045Sdougb# 36896045Sdougbif [ -t 0 ]; then 36996045Sdougb w=$(stty -a | sed -ne 's/.* \([0-9][0-9]*\) columns.*/\1/p') 37096045Sdougb case "${w}" in 37196045Sdougb 0|'') ;; # No-op, since the input is not valid 37296045Sdougb *) 37396045Sdougb case "${SCREEN_WIDTH}" in 37496045Sdougb '') SCREEN_WIDTH="${w}" ;; 37596045Sdougb "${w}") ;; # No-op, since they are the same 37696045Sdougb *) 37796045Sdougb echo -n "*** You entered ${SCREEN_WIDTH} as your screen width, but stty " 37896045Sdougb echo "thinks it is ${w}." 37996045Sdougb echo '' 38096045Sdougb echo -n "What would you like to use? [${w}] " 38196045Sdougb read SCREEN_WIDTH 38297380Sdougb case "${SCREEN_WIDTH}" in 38397380Sdougb '') SCREEN_WIDTH="${w}" ;; 38497380Sdougb esac 38596045Sdougb ;; 38696045Sdougb esac 38796045Sdougb esac 38896045Sdougbfi 38996045Sdougb 39073651Sdougb# Define what CVS $Id tag to look for to aid portability. 39173651Sdougb# 39273651SdougbCVS_ID_TAG=FreeBSD 39373651Sdougb 39452400Sbillfcase "${RERUN}" in 39552400Sbillf'') 39652400Sbillf # Set up the loop to test for the existence of the 39752400Sbillf # temp root directory. 39852400Sbillf # 39952400Sbillf TEST_TEMP_ROOT=yes 40052400Sbillf while [ "${TEST_TEMP_ROOT}" = "yes" ]; do 40152400Sbillf if [ -d "${TEMPROOT}" ]; then 40252400Sbillf echo "*** The directory specified for the temporary root environment," 40367859Sdougb echo " ${TEMPROOT}, exists. This can be a security risk if untrusted" 40452400Sbillf echo " users have access to the system." 40552400Sbillf echo '' 40652400Sbillf case "${AUTO_RUN}" in 40752400Sbillf '') 40852400Sbillf echo " Use 'd' to delete the old ${TEMPROOT} and continue" 40952400Sbillf echo " Use 't' to select a new temporary root directory" 41052400Sbillf echo " Use 'e' to exit mergemaster" 41152400Sbillf echo '' 41252400Sbillf echo " Default is to use ${TEMPROOT} as is" 41352400Sbillf echo '' 41467859Sdougb echo -n "How should I deal with this? [Use the existing ${TEMPROOT}] " 41567859Sdougb read DELORNOT 41667859Sdougb 41767859Sdougb case "${DELORNOT}" in 41867859Sdougb [dD]) 41967859Sdougb echo '' 42067859Sdougb echo " *** Deleting the old ${TEMPROOT}" 42167859Sdougb echo '' 42267859Sdougb rm -rf "${TEMPROOT}" 42367859Sdougb unset TEST_TEMP_ROOT 42452400Sbillf ;; 42567859Sdougb [tT]) 42667859Sdougb echo " *** Enter new directory name for temporary root environment" 42767859Sdougb read TEMPROOT 42867859Sdougb ;; 42967859Sdougb [eE]) 43067859Sdougb exit 0 43167859Sdougb ;; 43267859Sdougb '') 43367859Sdougb echo '' 43467859Sdougb echo " *** Leaving ${TEMPROOT} intact" 43567859Sdougb echo '' 43667859Sdougb unset TEST_TEMP_ROOT 43767859Sdougb ;; 43867859Sdougb *) 43967859Sdougb echo '' 44067859Sdougb echo "invalid choice: ${DELORNOT}" 44167859Sdougb echo '' 44267859Sdougb ;; 44367859Sdougb esac 44467859Sdougb ;; 44552400Sbillf *) 44677323Sdougb # If this is an auto-run, try a hopefully safe alternative then 44777323Sdougb # re-test anyway. 44852400Sbillf TEMPROOT=/var/tmp/temproot.`date +%m%d.%H.%M.%S` 44952400Sbillf ;; 45052400Sbillf esac 45152400Sbillf else 45252400Sbillf unset TEST_TEMP_ROOT 45352400Sbillf fi 45452400Sbillf done 45552400Sbillf 45652400Sbillf echo "*** Creating the temporary root environment in ${TEMPROOT}" 45752400Sbillf 45852400Sbillf if mkdir -p "${TEMPROOT}"; then 45952400Sbillf echo " *** ${TEMPROOT} ready for use" 46052400Sbillf fi 46152400Sbillf 46252400Sbillf if [ ! -d "${TEMPROOT}" ]; then 46352400Sbillf echo '' 46452400Sbillf echo " *** FATAL ERROR: Cannot create ${TEMPROOT}" 46552400Sbillf echo '' 46652400Sbillf exit 1 46752400Sbillf fi 46852400Sbillf 46952400Sbillf echo " *** Creating and populating directory structure in ${TEMPROOT}" 47052400Sbillf echo '' 47152400Sbillf 47252400Sbillf case "${VERBOSE}" in 47352400Sbillf '') ;; 47452400Sbillf *) 47552400Sbillf echo " *** Press [Enter] or [Return] key to continue" 47652400Sbillf read ANY_KEY 47752400Sbillf unset ANY_KEY 47852400Sbillf ;; 47952400Sbillf esac 48052400Sbillf 48191193Sdougb case "${PRE_WORLD}" in 48291193Sdougb '') 48391193Sdougb { cd ${SOURCEDIR} && 48491193Sdougb case "${DESTDIR}" in 48591193Sdougb '') ;; 48691193Sdougb *) 48768507Sdougb make DESTDIR=${DESTDIR} distrib-dirs 48891193Sdougb ;; 48991193Sdougb esac 49091193Sdougb make DESTDIR=${TEMPROOT} distrib-dirs && 49191193Sdougb make MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj obj && 49291193Sdougb make MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj DESTDIR=${TEMPROOT} \ 49391193Sdougb -DNO_MAKEDEV_RUN distribution;} || 49491193Sdougb { echo ''; 49591193Sdougb echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to"; 49691193Sdougb echo " the temproot environment"; 49791193Sdougb echo ''; 49891193Sdougb exit 1;} 49991193Sdougb ;; 50091193Sdougb *) 50191193Sdougb # Only set up files that are crucial to {build|install}world 50291193Sdougb { mkdir -p ${TEMPROOT}/etc && 50391193Sdougb cp -p ${SOURCEDIR}/master.passwd ${TEMPROOT}/etc && 50491193Sdougb cp -p ${SOURCEDIR}/group ${TEMPROOT}/etc;} || 50591193Sdougb { echo ''; 50691193Sdougb echo ' *** FATAL ERROR: Cannot copy files to the temproot environment'; 50791193Sdougb echo ''; 50891193Sdougb exit 1;} 50991193Sdougb ;; 51091193Sdougb esac 51152400Sbillf 51277323Sdougb # Doing the inventory and removing files that we don't want to compare only 51377323Sdougb # makes sense if we are not doing a rerun, since we have no way of knowing 51477323Sdougb # what happened to the files during previous incarnations. 51567949Sdougb case "${VERBOSE}" in 51667949Sdougb '') ;; 51767949Sdougb *) 51867949Sdougb echo '' 51967949Sdougb echo ' *** The following files exist only in the installed version of' 52067949Sdougb echo " ${DESTDIR}/etc. In the vast majority of cases these files" 52167949Sdougb echo ' are necessary parts of the system and should not be deleted.' 52267949Sdougb echo ' However because these files are not updated by this process you' 52367949Sdougb echo ' might want to verify their status before rebooting your system.' 52467949Sdougb echo '' 52567949Sdougb echo ' *** Press [Enter] or [Return] key to continue' 52667949Sdougb read ANY_KEY 52767949Sdougb unset ANY_KEY 52867949Sdougb diff -qr ${DESTDIR}/etc ${TEMPROOT}/etc | grep "^Only in /etc" | ${PAGER} 52967949Sdougb echo '' 53067949Sdougb echo ' *** Press [Enter] or [Return] key to continue' 53167949Sdougb read ANY_KEY 53267949Sdougb unset ANY_KEY 53367949Sdougb ;; 53467949Sdougb esac 53567949Sdougb 53652534Sbillf # Avoid comparing the motd if the user specifies it in .mergemasterrc 53752534Sbillf case "${IGNORE_MOTD}" in 53852534Sbillf '') ;; 53996045Sdougb *) rm -f ${TEMPROOT}/etc/motd 54052534Sbillf ;; 54152534Sbillf esac 54252534Sbillf 54365115Sben # Avoid trying to update MAKEDEV if /dev is on a devfs 54468507Sdougb if /sbin/sysctl vfs.devfs.generation > /dev/null 2>&1 ; then 54591193Sdougb rm -f ${TEMPROOT}/dev/MAKEDEV ${TEMPROOT}/dev/MAKEDEV.local 54665115Sben fi 54765115Sben 54852400Sbillf ;; # End of the "RERUN" test 54952400Sbillfesac 55052400Sbillf 55177478Sdougb# We really don't want to have to deal with these files, since 55277478Sdougb# master.passwd is the real file that should be compared, then 55377478Sdougb# the user should run pwd_mkdb if necessary. 55477478Sdougb# 55591193Sdougbrm -f ${TEMPROOT}/etc/spwd.db ${TEMPROOT}/etc/passwd ${TEMPROOT}/etc/pwd.db 55677478Sdougb 55794196Sdougb# We only need to compare things like freebsd.cf once 55896045Sdougbfind ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null 55994196Sdougb 56052400Sbillf# Get ready to start comparing files 56152400Sbillf 56252400Sbillf# Check umask if not specified on the command line, 56352400Sbillf# and we are not doing an autorun 56452400Sbillf# 56552400Sbillfif [ -z "${NEW_UMASK}" -a -z "${AUTO_RUN}" ]; then 56652400Sbillf USER_UMASK=`umask` 56752400Sbillf case "${USER_UMASK}" in 56877335Sdougb 0022|022) ;; 56952400Sbillf *) 57052400Sbillf echo '' 57167859Sdougb echo " *** Your umask is currently set to ${USER_UMASK}. By default, this script" 57252400Sbillf echo " installs all files with the same user, group and modes that" 57352400Sbillf echo " they are created with by ${SOURCEDIR}/Makefile, compared to" 57467859Sdougb echo " a umask of 022. This umask allows world read permission when" 57552400Sbillf echo " the file's default permissions have it." 57667859Sdougb echo " No world permissions can sometimes cause problems. A umask of" 57752400Sbillf echo " 022 will restore the default behavior, but is not mandatory." 57867859Sdougb echo " /etc/master.passwd is a special case. Its file permissions" 57952400Sbillf echo " will be 600 (rw-------) if installed." 58052400Sbillf echo '' 58167859Sdougb echo -n "What umask should I use? [${USER_UMASK}] " 58267859Sdougb read NEW_UMASK 58367859Sdougb 58452400Sbillf NEW_UMASK="${NEW_UMASK:-$USER_UMASK}" 58552400Sbillf ;; 58652400Sbillf esac 58752400Sbillf echo '' 58852400Sbillffi 58952400Sbillf 59052400SbillfCONFIRMED_UMASK=${NEW_UMASK:-0022} 59152400Sbillf 59267949Sdougb# Warn users who still have ${DESTDIR}/etc/sysconfig 59352400Sbillf# 59467949Sdougbif [ -e "${DESTDIR}/etc/sysconfig" ]; then 59552400Sbillf echo '' 59667949Sdougb echo " *** There is a sysconfig file on this system in ${DESTDIR}/etc/." 59767949Sdougb echo '' 59867949Sdougb echo ' Starting with FreeBSD version 2.2.2 those settings moved from' 59967949Sdougb echo ' /etc/sysconfig to /etc/rc.conf. If you are upgrading an older' 60067949Sdougb echo ' system make sure that you transfer your settings by hand from' 60167949Sdougb echo ' sysconfig to rc.conf and install the rc.conf file. If you' 60267949Sdougb echo ' have already made this transition, you should consider' 60367949Sdougb echo ' renaming or deleting the sysconfig file.' 60467949Sdougb echo '' 60552400Sbillf case "${AUTO_RUN}" in 60652400Sbillf '') 60767859Sdougb echo -n "Continue with the merge process? [yes] " 60867859Sdougb read CONT_OR_NOT 60967859Sdougb 61052400Sbillf case "${CONT_OR_NOT}" in 61152400Sbillf [nN]*) 61252400Sbillf exit 0 61352400Sbillf ;; 61452400Sbillf *) 61552400Sbillf echo " *** Continuing" 61652400Sbillf echo '' 61752400Sbillf ;; 61852400Sbillf esac 61952400Sbillf ;; 62052400Sbillf *) ;; 62152400Sbillf esac 62252400Sbillffi 62352400Sbillf 62452400Sbillf# Use the umask/mode information to install the files 62552400Sbillf# Create directories as needed 62652400Sbillf# 62778490Sdougbdo_install_and_rm () { 62878490Sdougb install -m "${1}" "${2}" "${3}" && 62991193Sdougb rm -f "${2}" 63078490Sdougb} 63178490Sdougb 63252400Sbillfmm_install () { 63352400Sbillf local INSTALL_DIR 63452400Sbillf INSTALL_DIR=${1#.} 63552400Sbillf INSTALL_DIR=${INSTALL_DIR%/*} 63667949Sdougb 63752400Sbillf case "${INSTALL_DIR}" in 63852400Sbillf '') 63952400Sbillf INSTALL_DIR=/ 64052400Sbillf ;; 64152400Sbillf esac 64252400Sbillf 64367949Sdougb if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then 64477323Sdougb DIR_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ \ 64577323Sdougb oct("$ARGV[1]"))' "${TEMPROOT}/${INSTALL_DIR}" "${CONFIRMED_UMASK}"` 64667949Sdougb install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}" 64752400Sbillf fi 64852400Sbillf 64977323Sdougb FILE_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ \ 65077323Sdougb oct("$ARGV[1]"))' "${1}" "${CONFIRMED_UMASK}"` 65152400Sbillf 65252400Sbillf if [ ! -x "${1}" ]; then 65352400Sbillf case "${1#.}" in 65464625Sgshapiro /etc/mail/aliases) 65552400Sbillf NEED_NEWALIASES=yes 65652400Sbillf ;; 65752400Sbillf /etc/login.conf) 65852400Sbillf NEED_CAP_MKDB=yes 65952400Sbillf ;; 66052400Sbillf /etc/master.passwd) 66178490Sdougb do_install_and_rm 600 "${1}" "${DESTDIR}${INSTALL_DIR}" 66252400Sbillf NEED_PWD_MKDB=yes 66352400Sbillf DONT_INSTALL=yes 66452400Sbillf ;; 66552400Sbillf /.cshrc | /.profile) 66677335Sdougb case "${AUTO_INSTALL}" in 66777335Sdougb '') 66852400Sbillf case "${LINK_EXPLAINED}" in 66952400Sbillf '') 67067859Sdougb echo " *** Historically BSD derived systems have had a" 67167859Sdougb echo " hard link from /.cshrc and /.profile to" 67267859Sdougb echo " their namesakes in /root. Please indicate" 67367859Sdougb echo " your preference below for bringing your" 67467859Sdougb echo " installed files up to date." 67552400Sbillf echo '' 67652400Sbillf LINK_EXPLAINED=yes 67752400Sbillf ;; 67852400Sbillf esac 67952400Sbillf 68052400Sbillf echo " Use 'd' to delete the temporary ${COMPFILE}" 68167949Sdougb echo " Use 'l' to delete the existing ${DESTDIR}${COMPFILE#.} and create the link" 68252400Sbillf echo '' 68352400Sbillf echo " Default is to leave the temporary file to deal with by hand" 68452400Sbillf echo '' 68567859Sdougb echo -n " How should I handle ${COMPFILE}? [Leave it to install later] " 68667859Sdougb read HANDLE_LINK 68777335Sdougb ;; 68877335Sdougb *) # Part of AUTO_INSTALL 68977335Sdougb HANDLE_LINK=l 69077335Sdougb ;; 69177335Sdougb esac 69267859Sdougb 69352400Sbillf case "${HANDLE_LINK}" in 69452400Sbillf [dD]*) 69552400Sbillf rm "${COMPFILE}" 69652400Sbillf echo '' 69752400Sbillf echo " *** Deleting ${COMPFILE}" 69852400Sbillf ;; 69952400Sbillf [lL]*) 70052400Sbillf echo '' 70167949Sdougb rm -f "${DESTDIR}${COMPFILE#.}" 70267949Sdougb if ln "${DESTDIR}/root/${COMPFILE##*/}" "${DESTDIR}${COMPFILE#.}"; then 70367949Sdougb echo " *** Link from ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/} installed successfully" 70452400Sbillf rm "${COMPFILE}" 70552400Sbillf else 70667949Sdougb echo " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}, ${COMPFILE} will remain to install by hand" 70752400Sbillf fi 70852400Sbillf ;; 70952400Sbillf *) 71052400Sbillf echo " *** ${COMPFILE} will remain for your consideration" 71152400Sbillf ;; 71252400Sbillf esac 71352400Sbillf DONT_INSTALL=yes 71452400Sbillf ;; 71552400Sbillf esac 71652400Sbillf 71752400Sbillf case "${DONT_INSTALL}" in 71852400Sbillf '') 71978490Sdougb do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}" 72052400Sbillf ;; 72152400Sbillf *) 72252400Sbillf unset DONT_INSTALL 72352400Sbillf ;; 72452400Sbillf esac 72578490Sdougb else # File matched -x 72667949Sdougb case "${1#.}" in 72767949Sdougb /dev/MAKEDEV) 72867949Sdougb NEED_MAKEDEV=yes 72967949Sdougb ;; 73067949Sdougb esac 73178490Sdougb do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}" 73252400Sbillf fi 73352400Sbillf return $? 73452400Sbillf} 73552400Sbillf 73667949Sdougbecho '' 73767949Sdougbecho "*** Beginning comparison" 73867949Sdougbecho '' 73952400Sbillf 74067949Sdougbcd "${TEMPROOT}" 74167949Sdougb 74267949Sdougbif [ -r "${MM_PRE_COMPARE_SCRIPT}" ]; then 74367949Sdougb . "${MM_PRE_COMPARE_SCRIPT}" 74467949Sdougbfi 74567949Sdougb 74652400Sbillf# Using -size +0 avoids uselessly checking the empty log files created 74752400Sbillf# by ${SOURCEDIR}/Makefile and the device entries in ./dev, but does 74867949Sdougb# check the scripts in ./dev, as we'd like (assuming no devfs of course). 74952400Sbillf# 75052400Sbillffor COMPFILE in `find . -type f -size +0`; do 75167949Sdougb 75267949Sdougb # First, check to see if the file exists in DESTDIR. If not, the 75367949Sdougb # diff_loop function knows how to handle it. 75467949Sdougb # 75567949Sdougb if [ ! -e "${DESTDIR}${COMPFILE#.}" ]; then 75677325Sdougb case "${AUTO_RUN}" in 75777325Sdougb '') 75877325Sdougb diff_loop 75977325Sdougb ;; 76077325Sdougb *) 76177325Sdougb case "${AUTO_INSTALL}" in 76277325Sdougb '') 76377325Sdougb # If this is an auto run, make it official 76477325Sdougb echo " *** ${COMPFILE} will remain for your consideration" 76577325Sdougb ;; 76677325Sdougb *) 76777325Sdougb diff_loop 76877325Sdougb ;; 76977325Sdougb esac 77077325Sdougb ;; 77177325Sdougb esac # Auto run test 77267949Sdougb continue 77367949Sdougb fi 77467949Sdougb 77552400Sbillf case "${STRICT}" in 77652400Sbillf '' | [Nn][Oo]) 77752400Sbillf # Compare CVS $Id's first so if the file hasn't been modified 77852400Sbillf # local changes will be ignored. 77952400Sbillf # If the files have the same $Id, delete the one in temproot so the 78052400Sbillf # user will have less to wade through if files are left to merge by hand. 78152400Sbillf # 78273651Sdougb CVSID1=`grep "[$]${CVS_ID_TAG}:" ${DESTDIR}${COMPFILE#.} 2>/dev/null` 78390564Sdougb CVSID2=`grep "[$]${CVS_ID_TAG}:" ${COMPFILE} 2>/dev/null` || CVSID2=none 78452400Sbillf 78567949Sdougb case "${CVSID2}" in 78673651Sdougb "${CVSID1}") 78767949Sdougb echo " *** Temp ${COMPFILE} and installed have the same CVS Id, deleting" 78867949Sdougb rm "${COMPFILE}" 78967949Sdougb ;; 79067949Sdougb esac 79152400Sbillf ;; 79252400Sbillf esac 79352400Sbillf 79452400Sbillf # If the file is still here either because the $Ids are different, the 79552400Sbillf # file doesn't have an $Id, or we're using STRICT mode; look at the diff. 79652400Sbillf # 79752400Sbillf if [ -f "${COMPFILE}" ]; then 79852400Sbillf 79952400Sbillf # Do an absolute diff first to see if the files are actually different. 80052400Sbillf # If they're not different, delete the one in temproot. 80152400Sbillf # 80267949Sdougb if diff -q "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > /dev/null 2>&1; then 80352400Sbillf echo " *** Temp ${COMPFILE} and installed are the same, deleting" 80452400Sbillf rm "${COMPFILE}" 80552400Sbillf else 80677323Sdougb # Ok, the files are different, so show the user where they differ. 80777323Sdougb # Use user's choice of diff methods; and user's pager if they have one. 80877323Sdougb # Use more if not. 80967859Sdougb # Use unified diffs by default. Context diffs give me a headache. :) 81052400Sbillf # 81152400Sbillf case "${AUTO_RUN}" in 81252400Sbillf '') 81358910Salfred # prompt user to install/delete/merge changes 81458910Salfred diff_loop 81552400Sbillf ;; 81652400Sbillf *) 81752400Sbillf # If this is an auto run, make it official 81852400Sbillf echo " *** ${COMPFILE} will remain for your consideration" 81952400Sbillf ;; 82052400Sbillf esac # Auto run test 82152400Sbillf fi # Yes, the files are different 82252400Sbillf fi # Yes, the file still remains to be checked 82352400Sbillfdone # This is for the do way up there at the beginning of the comparison 82452400Sbillf 82552534Sbillfecho '' 82652400Sbillfecho "*** Comparison complete" 82752400Sbillfecho '' 82852400Sbillf 82952400SbillfTEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null` 83052400Sbillfif [ -n "${TEST_FOR_FILES}" ]; then 83152400Sbillf echo "*** Files that remain for you to merge by hand:" 83252400Sbillf find "${TEMPROOT}" -type f -size +0 83377335Sdougb echo '' 83452400Sbillffi 83552400Sbillf 83652400Sbillfcase "${AUTO_RUN}" in 83752400Sbillf'') 83867859Sdougb echo -n "Do you wish to delete what is left of ${TEMPROOT}? [no] " 83967859Sdougb read DEL_TEMPROOT 84067859Sdougb 84152400Sbillf case "${DEL_TEMPROOT}" in 84252400Sbillf [yY]*) 84352400Sbillf if rm -rf "${TEMPROOT}"; then 84452400Sbillf echo " *** ${TEMPROOT} has been deleted" 84552400Sbillf else 84652400Sbillf echo " *** Unable to delete ${TEMPROOT}" 84752400Sbillf fi 84852400Sbillf ;; 84952400Sbillf *) 85052400Sbillf echo " *** ${TEMPROOT} will remain" 85152400Sbillf ;; 85252400Sbillf esac 85352400Sbillf ;; 85452400Sbillf*) ;; 85552400Sbillfesac 85652400Sbillf 85768153Sdougbcase "${AUTO_INSTALLED_FILES}" in 85868153Sdougb'') ;; 85968153Sdougb*) 86073651Sdougb case "${AUTO_RUN}" in 86173651Sdougb '') 86273651Sdougb ( 86373651Sdougb echo '' 86477323Sdougb echo '*** You chose the automatic install option for files that did not' 86577323Sdougb echo ' exist on your system. The following were installed for you:' 86673651Sdougb echo "${AUTO_INSTALLED_FILES}" 86773651Sdougb ) | ${PAGER} 86873651Sdougb ;; 86973651Sdougb *) 87068153Sdougb echo '' 87177323Sdougb echo '*** You chose the automatic install option for files that did not' 87277323Sdougb echo ' exist on your system. The following were installed for you:' 87368153Sdougb echo "${AUTO_INSTALLED_FILES}" 87473651Sdougb ;; 87573651Sdougb esac 87668153Sdougb ;; 87768153Sdougbesac 87868153Sdougb 87973651Sdougbrun_it_now () { 88073651Sdougb case "${AUTO_RUN}" in 88173651Sdougb '') 88273651Sdougb unset YES_OR_NO 88373651Sdougb echo '' 88477335Sdougb echo -n ' Would you like to run it now? y or n [n] ' 88573651Sdougb read YES_OR_NO 88673651Sdougb 88773651Sdougb case "${YES_OR_NO}" in 88873651Sdougb y) 88977335Sdougb echo " Running ${1}" 89077335Sdougb echo '' 89173651Sdougb eval "${1}" 89273651Sdougb ;; 89377335Sdougb ''|n) 89477335Sdougb echo '' 89577335Sdougb echo " *** Cancelled" 89677335Sdougb echo '' 89777335Sdougb echo " Make sure to run ${1} yourself" 89877335Sdougb ;; 89973651Sdougb *) 90077335Sdougb echo '' 90177335Sdougb echo " *** Sorry, I do not understand your answer (${YES_OR_NO})" 90277335Sdougb echo '' 90377335Sdougb echo " Make sure to run ${1} yourself" 90473651Sdougb esac 90573651Sdougb ;; 90673651Sdougb *) ;; 90773651Sdougb esac 90873651Sdougb} 90973651Sdougb 91052400Sbillfcase "${NEED_MAKEDEV}" in 91152400Sbillf'') ;; 91252400Sbillf*) 91352400Sbillf echo '' 91477335Sdougb echo "*** You installed a new ${DESTDIR}/dev/MAKEDEV script, so make sure that you run" 91577335Sdougb echo " 'cd ${DESTDIR}/dev && /bin/sh MAKEDEV all' to rebuild your devices" 91677335Sdougb run_it_now "cd ${DESTDIR}/dev && /bin/sh MAKEDEV all" 91752400Sbillf ;; 91852400Sbillfesac 91952400Sbillf 92052400Sbillfcase "${NEED_NEWALIASES}" in 92152400Sbillf'') ;; 92252400Sbillf*) 92352400Sbillf echo '' 92477335Sdougb if [ -n "${DESTDIR}" ]; then 92577335Sdougb echo "*** You installed a new aliases file into ${DESTDIR}/etc/mail, but" 92677335Sdougb echo " the newaliases command is limited to the directories configured" 92777335Sdougb echo " in sendmail.cf. Make sure to create your aliases database by" 92877335Sdougb echo " hand when your sendmail configuration is done." 92977335Sdougb else 93077335Sdougb echo "*** You installed a new aliases file, so make sure that you run" 93177335Sdougb echo " '/usr/bin/newaliases' to rebuild your aliases database" 93277335Sdougb run_it_now '/usr/bin/newaliases' 93377335Sdougb fi 93452400Sbillf ;; 93552400Sbillfesac 93652400Sbillf 93752400Sbillfcase "${NEED_CAP_MKDB}" in 93852400Sbillf'') ;; 93952400Sbillf*) 94052400Sbillf echo '' 94152400Sbillf echo "*** You installed a login.conf file, so make sure that you run" 94277335Sdougb echo " '/usr/bin/cap_mkdb ${DESTDIR}/etc/login.conf'" 94377335Sdougb echo " to rebuild your login.conf database" 94477335Sdougb run_it_now "/usr/bin/cap_mkdb ${DESTDIR}/etc/login.conf" 94552400Sbillf ;; 94652400Sbillfesac 94752400Sbillf 94852400Sbillfcase "${NEED_PWD_MKDB}" in 94952400Sbillf'') ;; 95052400Sbillf*) 95152400Sbillf echo '' 95252400Sbillf echo "*** You installed a new master.passwd file, so make sure that you run" 95377335Sdougb if [ -n "${DESTDIR}" ]; then 95477335Sdougb echo " '/usr/sbin/pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd'" 95577335Sdougb echo " to rebuild your password files" 95677335Sdougb run_it_now "/usr/sbin/pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd" 95777335Sdougb else 95877335Sdougb echo " '/usr/sbin/pwd_mkdb -p /etc/master.passwd'" 95977335Sdougb echo " to rebuild your password files" 96077335Sdougb run_it_now '/usr/sbin/pwd_mkdb -p /etc/master.passwd' 96177335Sdougb fi 96252400Sbillf ;; 96352400Sbillfesac 96452400Sbillf 96552400Sbillfecho '' 96652400Sbillf 96767949Sdougbif [ -r "${MM_EXIT_SCRIPT}" ]; then 96867949Sdougb . "${MM_EXIT_SCRIPT}" 96967949Sdougbfi 97067949Sdougb 97191193Sdougbcase "${COMP_CONFS}" in 97291193Sdougb'') ;; 97391193Sdougb*) 97491193Sdougb . ${DESTDIR}/etc/defaults/rc.conf 97591193Sdougb 97691193Sdougb (echo '' 97791193Sdougb echo "*** Comparing conf files: ${rc_conf_files}" 97891193Sdougb 97991193Sdougb for CONF_FILE in ${rc_conf_files}; do 98091193Sdougb if [ -r "${DESTDIR}${CONF_FILE}" ]; then 98191193Sdougb echo '' 98291193Sdougb echo "*** From ${DESTDIR}${CONF_FILE}" 98391193Sdougb echo "*** From ${DESTDIR}/etc/defaults/rc.conf" 98491193Sdougb 98591193Sdougb for RC_CONF_VAR in `grep -i ^[a-z] ${DESTDIR}${CONF_FILE} | 98691193Sdougb cut -d '=' -f 1`; do 98791193Sdougb echo '' 98891223Sdougb grep -w ^${RC_CONF_VAR} ${DESTDIR}${CONF_FILE} 98991223Sdougb grep -w ^${RC_CONF_VAR} ${DESTDIR}/etc/defaults/rc.conf || 99091193Sdougb echo ' * No default variable with this name' 99191193Sdougb done 99291193Sdougb fi 99391193Sdougb done) | ${PAGER} 99491193Sdougb echo '' 99591193Sdougb ;; 99691193Sdougbesac 99791193Sdougb 99891193Sdougbcase "${PRE_WORLD}" in 99991193Sdougb'') ;; 100091193Sdougb*) 100191193Sdougb MAKE_CONF="${SOURCEDIR%etc}share/examples/etc/make.conf" 100291193Sdougb 100391193Sdougb (echo '' 100491193Sdougb echo '*** Comparing make variables' 100591193Sdougb echo '' 100691193Sdougb echo "*** From ${DESTDIR}/etc/make.conf" 100791193Sdougb echo "*** From ${MAKE_CONF}" 100891193Sdougb 100991193Sdougb for MAKE_VAR in `grep -i ^[a-z] /etc/make.conf | cut -d '=' -f 1`; do 101091193Sdougb echo '' 101191223Sdougb grep -w ^${MAKE_VAR} ${DESTDIR}/etc/make.conf 101291223Sdougb grep -w ^#${MAKE_VAR} ${MAKE_CONF} || 101391193Sdougb echo ' * No example variable with this name' 101491193Sdougb done) | ${PAGER} 101591193Sdougb ;; 101691193Sdougbesac 101791193Sdougb 101852400Sbillfexit 0 101967850Sdougb 1020