mergemaster.sh revision 101362
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 101362 2002-08-05 08:47:52Z 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 21797960Sdougbpress_to_continue () { 21897960Sdougb local DISCARD 21997960Sdougb echo -n ' *** Press the [Enter] or [Return] key to continue ' 22097960Sdougb read DISCARD 22197960Sdougb} 22297960Sdougb 22352400Sbillf# Set the default path for the temporary root environment 22452400Sbillf# 22552400SbillfTEMPROOT='/var/tmp/temproot' 22652400Sbillf 22773651Sdougb# Read /etc/mergemaster.rc first so the one in $HOME can override 22873651Sdougb# 22973651Sdougbif [ -r /etc/mergemaster.rc ]; then 23073651Sdougb . /etc/mergemaster.rc 23173651Sdougbfi 23273651Sdougb 23352400Sbillf# Read .mergemasterrc before command line so CLI can override 23452400Sbillf# 23567949Sdougbif [ -r "$HOME/.mergemasterrc" ]; then 23652400Sbillf . "$HOME/.mergemasterrc" 23752400Sbillffi 23852400Sbillf 23952400Sbillf# Check the command line options 24052400Sbillf# 24191193Sdougbwhile getopts ":ascrvhipCm:t:du:w:D:" COMMAND_LINE_ARGUMENT ; do 24252400Sbillf case "${COMMAND_LINE_ARGUMENT}" in 24352400Sbillf s) 24452400Sbillf STRICT=yes 24552400Sbillf ;; 24652400Sbillf c) 24752400Sbillf DIFF_FLAG='-c' 24852400Sbillf ;; 24952400Sbillf r) 25052400Sbillf RERUN=yes 25152400Sbillf ;; 25252400Sbillf v) 25352400Sbillf case "${AUTO_RUN}" in 25452400Sbillf '') VERBOSE=yes ;; 25552400Sbillf esac 25652400Sbillf ;; 25752400Sbillf a) 25852400Sbillf AUTO_RUN=yes 25952400Sbillf unset VERBOSE 26052400Sbillf ;; 26152400Sbillf h) 26252400Sbillf display_usage 26352400Sbillf display_help 26452400Sbillf exit 0 26552400Sbillf ;; 26667949Sdougb i) 26767949Sdougb AUTO_INSTALL=yes 26867949Sdougb ;; 26996045Sdougb C) 27096045Sdougb COMP_CONFS=yes 27196045Sdougb ;; 27291193Sdougb p) 27391193Sdougb PRE_WORLD=yes 27496045Sdougb unset COMP_CONFS 27596045Sdougb unset AUTO_RUN 27691193Sdougb ;; 27752400Sbillf m) 27852400Sbillf SOURCEDIR=${OPTARG} 27952400Sbillf ;; 28052400Sbillf t) 28152400Sbillf TEMPROOT=${OPTARG} 28252400Sbillf ;; 28352400Sbillf d) 28452400Sbillf TEMPROOT=${TEMPROOT}.`date +%m%d.%H.%M` 28552400Sbillf ;; 28652400Sbillf u) 28752400Sbillf NEW_UMASK=${OPTARG} 28852400Sbillf ;; 28952400Sbillf w) 29052400Sbillf SCREEN_WIDTH=${OPTARG} 29152400Sbillf ;; 29267949Sdougb D) 29367949Sdougb DESTDIR=${OPTARG} 29467949Sdougb ;; 29552400Sbillf *) 29652400Sbillf display_usage 29752400Sbillf exit 1 29852400Sbillf ;; 29952400Sbillf esac 30052400Sbillfdone 30152400Sbillf 30252400Sbillfecho '' 30352400Sbillf 30452400Sbillf# If the user has a pager defined, make sure we can run it 30552400Sbillf# 30652400Sbillfcase "${DONT_CHECK_PAGER}" in 30752400Sbillf'') 30864467Sbrian while ! type "${PAGER%% *}" >/dev/null && [ -n "${PAGER}" ]; do 30952400Sbillf echo " *** Your PAGER environment variable specifies '${PAGER}', but" 31064467Sbrian echo " due to the limited PATH that I use for security reasons," 31167859Sdougb echo " I cannot execute it. So, what would you like to do?" 31252400Sbillf echo '' 31352400Sbillf echo " Use 'e' to exit mergemaster and fix your PAGER variable" 31464467Sbrian if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then 31564467Sbrian echo " Use 'l' to set PAGER to 'less' for this run" 31652400Sbillf fi 31752400Sbillf echo " Use 'm' to use plain old 'more' as your PAGER for this run" 31852400Sbillf echo '' 31952400Sbillf echo " Default is to use plain old 'more' " 32052400Sbillf echo '' 32167859Sdougb echo -n "What should I do? [Use 'more'] " 32267859Sdougb read FIXPAGER 32367859Sdougb 32452400Sbillf case "${FIXPAGER}" in 32558910Salfred [eE]) 32652400Sbillf exit 0 32752400Sbillf ;; 32858910Salfred [lL]) 32964467Sbrian if [ -x /usr/bin/less ]; then 33064467Sbrian PAGER=/usr/bin/less 33164467Sbrian elif [ -x /usr/local/bin/less ]; then 33258910Salfred PAGER=/usr/local/bin/less 33364467Sbrian else 33464467Sbrian echo '' 33564467Sbrian echo " *** Fatal Error:" 33664467Sbrian echo " You asked to use 'less' as your pager, but I can't" 33764467Sbrian echo " find it in /usr/bin or /usr/local/bin" 33864467Sbrian exit 1 33958910Salfred fi 34052400Sbillf ;; 34160420Sbsd [mM]|'') 34252400Sbillf PAGER=more 34352400Sbillf ;; 34458910Salfred *) 34558910Salfred echo '' 34658910Salfred echo "invalid choice: ${FIXPAGER}" 34752400Sbillf esac 34852400Sbillf echo '' 34958910Salfred done 35052400Sbillf ;; 35152400Sbillfesac 35252400Sbillf 35352400Sbillf# If user has a pager defined, or got assigned one above, use it. 35452400Sbillf# If not, use more. 35552400Sbillf# 35652400SbillfPAGER=${PAGER:-more} 35752400Sbillf 35852400Sbillfif [ -n "${VERBOSE}" -a ! "${PAGER}" = "more" ]; then 35952400Sbillf echo " *** You have ${PAGER} defined as your pager so we will use that" 36052400Sbillf echo '' 36152400Sbillf sleep 3 36252400Sbillffi 36352400Sbillf 36452400Sbillf# Assign the diff flag once so we will not have to keep testing it 36552400Sbillf# 36652400SbillfDIFF_FLAG=${DIFF_FLAG:--u} 36752400Sbillf 36852400Sbillf# Assign the source directory 36952400Sbillf# 37052400SbillfSOURCEDIR=${SOURCEDIR:-/usr/src/etc} 37152400Sbillf 37296045Sdougb# Check the width of the user's terminal 37396045Sdougb# 37496045Sdougbif [ -t 0 ]; then 37596045Sdougb w=$(stty -a | sed -ne 's/.* \([0-9][0-9]*\) columns.*/\1/p') 37696045Sdougb case "${w}" in 37796045Sdougb 0|'') ;; # No-op, since the input is not valid 37896045Sdougb *) 37996045Sdougb case "${SCREEN_WIDTH}" in 38096045Sdougb '') SCREEN_WIDTH="${w}" ;; 38196045Sdougb "${w}") ;; # No-op, since they are the same 38296045Sdougb *) 38396045Sdougb echo -n "*** You entered ${SCREEN_WIDTH} as your screen width, but stty " 38496045Sdougb echo "thinks it is ${w}." 38596045Sdougb echo '' 38696045Sdougb echo -n "What would you like to use? [${w}] " 38796045Sdougb read SCREEN_WIDTH 38897380Sdougb case "${SCREEN_WIDTH}" in 38997380Sdougb '') SCREEN_WIDTH="${w}" ;; 39097380Sdougb esac 39196045Sdougb ;; 39296045Sdougb esac 39396045Sdougb esac 39496045Sdougbfi 39596045Sdougb 39673651Sdougb# Define what CVS $Id tag to look for to aid portability. 39773651Sdougb# 39873651SdougbCVS_ID_TAG=FreeBSD 39973651Sdougb 40099152Sdougbdelete_temproot () { 401101362Sdougb rm -rf "${TEMPROOT}" 2>/dev/null 402101362Sdougb chflags -R 0 "${TEMPROOT}" 2>/dev/null 403101362Sdougb rm -rf "${TEMPROOT}" || exit 1 40499152Sdougb} 40599152Sdougb 40652400Sbillfcase "${RERUN}" in 40752400Sbillf'') 40852400Sbillf # Set up the loop to test for the existence of the 40952400Sbillf # temp root directory. 41052400Sbillf # 41152400Sbillf TEST_TEMP_ROOT=yes 41252400Sbillf while [ "${TEST_TEMP_ROOT}" = "yes" ]; do 41352400Sbillf if [ -d "${TEMPROOT}" ]; then 41452400Sbillf echo "*** The directory specified for the temporary root environment," 41567859Sdougb echo " ${TEMPROOT}, exists. This can be a security risk if untrusted" 41652400Sbillf echo " users have access to the system." 41752400Sbillf echo '' 41852400Sbillf case "${AUTO_RUN}" in 41952400Sbillf '') 42052400Sbillf echo " Use 'd' to delete the old ${TEMPROOT} and continue" 42152400Sbillf echo " Use 't' to select a new temporary root directory" 42252400Sbillf echo " Use 'e' to exit mergemaster" 42352400Sbillf echo '' 42452400Sbillf echo " Default is to use ${TEMPROOT} as is" 42552400Sbillf echo '' 42667859Sdougb echo -n "How should I deal with this? [Use the existing ${TEMPROOT}] " 42767859Sdougb read DELORNOT 42867859Sdougb 42967859Sdougb case "${DELORNOT}" in 43067859Sdougb [dD]) 43167859Sdougb echo '' 43267859Sdougb echo " *** Deleting the old ${TEMPROOT}" 43367859Sdougb echo '' 43499152Sdougb delete_temproot || exit 1 43567859Sdougb unset TEST_TEMP_ROOT 43652400Sbillf ;; 43767859Sdougb [tT]) 43867859Sdougb echo " *** Enter new directory name for temporary root environment" 43967859Sdougb read TEMPROOT 44067859Sdougb ;; 44167859Sdougb [eE]) 44267859Sdougb exit 0 44367859Sdougb ;; 44467859Sdougb '') 44567859Sdougb echo '' 44667859Sdougb echo " *** Leaving ${TEMPROOT} intact" 44767859Sdougb echo '' 44867859Sdougb unset TEST_TEMP_ROOT 44967859Sdougb ;; 45067859Sdougb *) 45167859Sdougb echo '' 45267859Sdougb echo "invalid choice: ${DELORNOT}" 45367859Sdougb echo '' 45467859Sdougb ;; 45567859Sdougb esac 45667859Sdougb ;; 45752400Sbillf *) 45877323Sdougb # If this is an auto-run, try a hopefully safe alternative then 45977323Sdougb # re-test anyway. 46052400Sbillf TEMPROOT=/var/tmp/temproot.`date +%m%d.%H.%M.%S` 46152400Sbillf ;; 46252400Sbillf esac 46352400Sbillf else 46452400Sbillf unset TEST_TEMP_ROOT 46552400Sbillf fi 46652400Sbillf done 46752400Sbillf 46852400Sbillf echo "*** Creating the temporary root environment in ${TEMPROOT}" 46952400Sbillf 47052400Sbillf if mkdir -p "${TEMPROOT}"; then 47152400Sbillf echo " *** ${TEMPROOT} ready for use" 47252400Sbillf fi 47352400Sbillf 47452400Sbillf if [ ! -d "${TEMPROOT}" ]; then 47552400Sbillf echo '' 47652400Sbillf echo " *** FATAL ERROR: Cannot create ${TEMPROOT}" 47752400Sbillf echo '' 47852400Sbillf exit 1 47952400Sbillf fi 48052400Sbillf 48152400Sbillf echo " *** Creating and populating directory structure in ${TEMPROOT}" 48252400Sbillf echo '' 48352400Sbillf 48452400Sbillf case "${VERBOSE}" in 48552400Sbillf '') ;; 48652400Sbillf *) 48797960Sdougb press_to_continue 48852400Sbillf ;; 48952400Sbillf esac 49052400Sbillf 49191193Sdougb case "${PRE_WORLD}" in 49291193Sdougb '') 49391193Sdougb { cd ${SOURCEDIR} && 49491193Sdougb case "${DESTDIR}" in 49591193Sdougb '') ;; 49691193Sdougb *) 49768507Sdougb make DESTDIR=${DESTDIR} distrib-dirs 49891193Sdougb ;; 49991193Sdougb esac 50091193Sdougb make DESTDIR=${TEMPROOT} distrib-dirs && 50191193Sdougb make MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj obj && 50291193Sdougb make MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj DESTDIR=${TEMPROOT} \ 50391193Sdougb -DNO_MAKEDEV_RUN distribution;} || 50491193Sdougb { echo ''; 50591193Sdougb echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to"; 50691193Sdougb echo " the temproot environment"; 50791193Sdougb echo ''; 50891193Sdougb exit 1;} 50991193Sdougb ;; 51091193Sdougb *) 51191193Sdougb # Only set up files that are crucial to {build|install}world 51291193Sdougb { mkdir -p ${TEMPROOT}/etc && 51391193Sdougb cp -p ${SOURCEDIR}/master.passwd ${TEMPROOT}/etc && 51491193Sdougb cp -p ${SOURCEDIR}/group ${TEMPROOT}/etc;} || 51591193Sdougb { echo ''; 51691193Sdougb echo ' *** FATAL ERROR: Cannot copy files to the temproot environment'; 51791193Sdougb echo ''; 51891193Sdougb exit 1;} 51991193Sdougb ;; 52091193Sdougb esac 52152400Sbillf 52277323Sdougb # Doing the inventory and removing files that we don't want to compare only 52377323Sdougb # makes sense if we are not doing a rerun, since we have no way of knowing 52477323Sdougb # what happened to the files during previous incarnations. 52567949Sdougb case "${VERBOSE}" in 52667949Sdougb '') ;; 52767949Sdougb *) 52867949Sdougb echo '' 52967949Sdougb echo ' *** The following files exist only in the installed version of' 53067949Sdougb echo " ${DESTDIR}/etc. In the vast majority of cases these files" 53167949Sdougb echo ' are necessary parts of the system and should not be deleted.' 53267949Sdougb echo ' However because these files are not updated by this process you' 53367949Sdougb echo ' might want to verify their status before rebooting your system.' 53467949Sdougb echo '' 53597960Sdougb press_to_continue 536101348Sdougb diff -qr ${DESTDIR}/etc ${TEMPROOT}/etc | grep "^Only in ${DESTDIR}/etc" | ${PAGER} 53767949Sdougb echo '' 53897960Sdougb press_to_continue 53967949Sdougb ;; 54067949Sdougb esac 54167949Sdougb 54252534Sbillf # Avoid comparing the motd if the user specifies it in .mergemasterrc 54352534Sbillf case "${IGNORE_MOTD}" in 54452534Sbillf '') ;; 54596045Sdougb *) rm -f ${TEMPROOT}/etc/motd 54652534Sbillf ;; 54752534Sbillf esac 54852534Sbillf 54965115Sben # Avoid trying to update MAKEDEV if /dev is on a devfs 55068507Sdougb if /sbin/sysctl vfs.devfs.generation > /dev/null 2>&1 ; then 55191193Sdougb rm -f ${TEMPROOT}/dev/MAKEDEV ${TEMPROOT}/dev/MAKEDEV.local 55265115Sben fi 55365115Sben 55452400Sbillf ;; # End of the "RERUN" test 55552400Sbillfesac 55652400Sbillf 55777478Sdougb# We really don't want to have to deal with these files, since 55877478Sdougb# master.passwd is the real file that should be compared, then 55977478Sdougb# the user should run pwd_mkdb if necessary. 56077478Sdougb# 56191193Sdougbrm -f ${TEMPROOT}/etc/spwd.db ${TEMPROOT}/etc/passwd ${TEMPROOT}/etc/pwd.db 56277478Sdougb 56394196Sdougb# We only need to compare things like freebsd.cf once 56496045Sdougbfind ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null 56594196Sdougb 56652400Sbillf# Get ready to start comparing files 56752400Sbillf 56898084Sdougb# Check umask if not specified on the command line, 56998084Sdougb# and we are not doing an autorun 57052400Sbillf# 57198084Sdougbif [ -z "${NEW_UMASK}" -a -z "${AUTO_RUN}" ]; then 57298084Sdougb USER_UMASK=`umask` 57352400Sbillf case "${USER_UMASK}" in 57477335Sdougb 0022|022) ;; 57552400Sbillf *) 57652400Sbillf echo '' 57798084Sdougb echo " *** Your umask is currently set to ${USER_UMASK}. By default, this script" 57898084Sdougb echo " installs all files with the same user, group and modes that" 57998084Sdougb echo " they are created with by ${SOURCEDIR}/Makefile, compared to" 58098084Sdougb echo " a umask of 022. This umask allows world read permission when" 58198084Sdougb echo " the file's default permissions have it." 58252400Sbillf echo '' 58398084Sdougb echo " No world permissions can sometimes cause problems. A umask of" 58498084Sdougb echo " 022 will restore the default behavior, but is not mandatory." 58598084Sdougb echo " /etc/master.passwd is a special case. Its file permissions" 58698084Sdougb echo " will be 600 (rw-------) if installed." 58797960Sdougb echo '' 58898084Sdougb echo -n "What umask should I use? [${USER_UMASK}] " 58998084Sdougb read NEW_UMASK 59098084Sdougb 59198084Sdougb NEW_UMASK="${NEW_UMASK:-$USER_UMASK}" 59252400Sbillf ;; 59352400Sbillf esac 59452400Sbillf echo '' 59598084Sdougbfi 59652400Sbillf 59798084SdougbCONFIRMED_UMASK=${NEW_UMASK:-0022} 59898084Sdougb 59967949Sdougb# Warn users who still have ${DESTDIR}/etc/sysconfig 60052400Sbillf# 60167949Sdougbif [ -e "${DESTDIR}/etc/sysconfig" ]; then 60252400Sbillf echo '' 60367949Sdougb echo " *** There is a sysconfig file on this system in ${DESTDIR}/etc/." 60467949Sdougb echo '' 60567949Sdougb echo ' Starting with FreeBSD version 2.2.2 those settings moved from' 60667949Sdougb echo ' /etc/sysconfig to /etc/rc.conf. If you are upgrading an older' 60767949Sdougb echo ' system make sure that you transfer your settings by hand from' 60867949Sdougb echo ' sysconfig to rc.conf and install the rc.conf file. If you' 60967949Sdougb echo ' have already made this transition, you should consider' 61067949Sdougb echo ' renaming or deleting the sysconfig file.' 61167949Sdougb echo '' 61252400Sbillf case "${AUTO_RUN}" in 61352400Sbillf '') 61467859Sdougb echo -n "Continue with the merge process? [yes] " 61567859Sdougb read CONT_OR_NOT 61667859Sdougb 61752400Sbillf case "${CONT_OR_NOT}" in 61852400Sbillf [nN]*) 61952400Sbillf exit 0 62052400Sbillf ;; 62152400Sbillf *) 62252400Sbillf echo " *** Continuing" 62352400Sbillf echo '' 62452400Sbillf ;; 62552400Sbillf esac 62652400Sbillf ;; 62752400Sbillf *) ;; 62852400Sbillf esac 62952400Sbillffi 63052400Sbillf 63198084Sdougb# Use the umask/mode information to install the files 63252400Sbillf# Create directories as needed 63352400Sbillf# 63478490Sdougbdo_install_and_rm () { 63578490Sdougb install -m "${1}" "${2}" "${3}" && 63691193Sdougb rm -f "${2}" 63778490Sdougb} 63878490Sdougb 63998084Sdougb# 4095 = "obase=10;ibase=8;07777" | bc 64098084Sdougbfind_mode () { 64198084Sdougb local OCTAL 64298084Sdougb OCTAL=$(( ~$(echo "obase=10; ibase=8; ${CONFIRMED_UMASK}" | bc) & 4095 & 64398084Sdougb $(echo "obase=10; ibase=8; $(stat -f "%OMp%OLp" ${1})" | bc) )) 64498084Sdougb printf "%04o\n" ${OCTAL} 64598084Sdougb} 64698084Sdougb 64752400Sbillfmm_install () { 64852400Sbillf local INSTALL_DIR 64952400Sbillf INSTALL_DIR=${1#.} 65052400Sbillf INSTALL_DIR=${INSTALL_DIR%/*} 65167949Sdougb 65252400Sbillf case "${INSTALL_DIR}" in 65352400Sbillf '') 65452400Sbillf INSTALL_DIR=/ 65552400Sbillf ;; 65652400Sbillf esac 65752400Sbillf 65867949Sdougb if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then 65998084Sdougb DIR_MODE=`find_mode "${TEMPROOT}/${INSTALL_DIR}"` 66067949Sdougb install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}" 66152400Sbillf fi 66252400Sbillf 66398084Sdougb FILE_MODE=`find_mode "${1}"` 66452400Sbillf 66552400Sbillf if [ ! -x "${1}" ]; then 66652400Sbillf case "${1#.}" in 66764625Sgshapiro /etc/mail/aliases) 66852400Sbillf NEED_NEWALIASES=yes 66952400Sbillf ;; 67052400Sbillf /etc/login.conf) 67152400Sbillf NEED_CAP_MKDB=yes 67252400Sbillf ;; 67352400Sbillf /etc/master.passwd) 67478490Sdougb do_install_and_rm 600 "${1}" "${DESTDIR}${INSTALL_DIR}" 67552400Sbillf NEED_PWD_MKDB=yes 67652400Sbillf DONT_INSTALL=yes 67752400Sbillf ;; 67852400Sbillf /.cshrc | /.profile) 67977335Sdougb case "${AUTO_INSTALL}" in 68077335Sdougb '') 68152400Sbillf case "${LINK_EXPLAINED}" in 68252400Sbillf '') 68367859Sdougb echo " *** Historically BSD derived systems have had a" 68467859Sdougb echo " hard link from /.cshrc and /.profile to" 68567859Sdougb echo " their namesakes in /root. Please indicate" 68667859Sdougb echo " your preference below for bringing your" 68767859Sdougb echo " installed files up to date." 68852400Sbillf echo '' 68952400Sbillf LINK_EXPLAINED=yes 69052400Sbillf ;; 69152400Sbillf esac 69252400Sbillf 69352400Sbillf echo " Use 'd' to delete the temporary ${COMPFILE}" 69467949Sdougb echo " Use 'l' to delete the existing ${DESTDIR}${COMPFILE#.} and create the link" 69552400Sbillf echo '' 69652400Sbillf echo " Default is to leave the temporary file to deal with by hand" 69752400Sbillf echo '' 69867859Sdougb echo -n " How should I handle ${COMPFILE}? [Leave it to install later] " 69967859Sdougb read HANDLE_LINK 70077335Sdougb ;; 70177335Sdougb *) # Part of AUTO_INSTALL 70277335Sdougb HANDLE_LINK=l 70377335Sdougb ;; 70477335Sdougb esac 70567859Sdougb 70652400Sbillf case "${HANDLE_LINK}" in 70752400Sbillf [dD]*) 70852400Sbillf rm "${COMPFILE}" 70952400Sbillf echo '' 71052400Sbillf echo " *** Deleting ${COMPFILE}" 71152400Sbillf ;; 71252400Sbillf [lL]*) 71352400Sbillf echo '' 71467949Sdougb rm -f "${DESTDIR}${COMPFILE#.}" 71567949Sdougb if ln "${DESTDIR}/root/${COMPFILE##*/}" "${DESTDIR}${COMPFILE#.}"; then 71667949Sdougb echo " *** Link from ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/} installed successfully" 71752400Sbillf rm "${COMPFILE}" 71852400Sbillf else 71967949Sdougb echo " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}, ${COMPFILE} will remain to install by hand" 72052400Sbillf fi 72152400Sbillf ;; 72252400Sbillf *) 72352400Sbillf echo " *** ${COMPFILE} will remain for your consideration" 72452400Sbillf ;; 72552400Sbillf esac 72652400Sbillf DONT_INSTALL=yes 72752400Sbillf ;; 72852400Sbillf esac 72952400Sbillf 73052400Sbillf case "${DONT_INSTALL}" in 73152400Sbillf '') 73278490Sdougb do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}" 73352400Sbillf ;; 73452400Sbillf *) 73552400Sbillf unset DONT_INSTALL 73652400Sbillf ;; 73752400Sbillf esac 73878490Sdougb else # File matched -x 73967949Sdougb case "${1#.}" in 74067949Sdougb /dev/MAKEDEV) 74167949Sdougb NEED_MAKEDEV=yes 74267949Sdougb ;; 74367949Sdougb esac 74478490Sdougb do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}" 74552400Sbillf fi 74652400Sbillf return $? 74752400Sbillf} 74852400Sbillf 74967949Sdougbecho '' 75067949Sdougbecho "*** Beginning comparison" 75167949Sdougbecho '' 75252400Sbillf 75367949Sdougbcd "${TEMPROOT}" 75467949Sdougb 75567949Sdougbif [ -r "${MM_PRE_COMPARE_SCRIPT}" ]; then 75667949Sdougb . "${MM_PRE_COMPARE_SCRIPT}" 75767949Sdougbfi 75867949Sdougb 75952400Sbillf# Using -size +0 avoids uselessly checking the empty log files created 76052400Sbillf# by ${SOURCEDIR}/Makefile and the device entries in ./dev, but does 76167949Sdougb# check the scripts in ./dev, as we'd like (assuming no devfs of course). 76252400Sbillf# 76352400Sbillffor COMPFILE in `find . -type f -size +0`; do 76467949Sdougb 76567949Sdougb # First, check to see if the file exists in DESTDIR. If not, the 76667949Sdougb # diff_loop function knows how to handle it. 76767949Sdougb # 76867949Sdougb if [ ! -e "${DESTDIR}${COMPFILE#.}" ]; then 76977325Sdougb case "${AUTO_RUN}" in 77077325Sdougb '') 77177325Sdougb diff_loop 77277325Sdougb ;; 77377325Sdougb *) 77477325Sdougb case "${AUTO_INSTALL}" in 77577325Sdougb '') 77677325Sdougb # If this is an auto run, make it official 77777325Sdougb echo " *** ${COMPFILE} will remain for your consideration" 77877325Sdougb ;; 77977325Sdougb *) 78077325Sdougb diff_loop 78177325Sdougb ;; 78277325Sdougb esac 78377325Sdougb ;; 78477325Sdougb esac # Auto run test 78567949Sdougb continue 78667949Sdougb fi 78767949Sdougb 78852400Sbillf case "${STRICT}" in 78952400Sbillf '' | [Nn][Oo]) 79052400Sbillf # Compare CVS $Id's first so if the file hasn't been modified 79152400Sbillf # local changes will be ignored. 79252400Sbillf # If the files have the same $Id, delete the one in temproot so the 79352400Sbillf # user will have less to wade through if files are left to merge by hand. 79452400Sbillf # 79573651Sdougb CVSID1=`grep "[$]${CVS_ID_TAG}:" ${DESTDIR}${COMPFILE#.} 2>/dev/null` 79690564Sdougb CVSID2=`grep "[$]${CVS_ID_TAG}:" ${COMPFILE} 2>/dev/null` || CVSID2=none 79752400Sbillf 79867949Sdougb case "${CVSID2}" in 79973651Sdougb "${CVSID1}") 80067949Sdougb echo " *** Temp ${COMPFILE} and installed have the same CVS Id, deleting" 80167949Sdougb rm "${COMPFILE}" 80267949Sdougb ;; 80367949Sdougb esac 80452400Sbillf ;; 80552400Sbillf esac 80652400Sbillf 80752400Sbillf # If the file is still here either because the $Ids are different, the 80852400Sbillf # file doesn't have an $Id, or we're using STRICT mode; look at the diff. 80952400Sbillf # 81052400Sbillf if [ -f "${COMPFILE}" ]; then 81152400Sbillf 81252400Sbillf # Do an absolute diff first to see if the files are actually different. 81352400Sbillf # If they're not different, delete the one in temproot. 81452400Sbillf # 81567949Sdougb if diff -q "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > /dev/null 2>&1; then 81652400Sbillf echo " *** Temp ${COMPFILE} and installed are the same, deleting" 81752400Sbillf rm "${COMPFILE}" 81852400Sbillf else 81977323Sdougb # Ok, the files are different, so show the user where they differ. 82077323Sdougb # Use user's choice of diff methods; and user's pager if they have one. 82177323Sdougb # Use more if not. 82267859Sdougb # Use unified diffs by default. Context diffs give me a headache. :) 82352400Sbillf # 82452400Sbillf case "${AUTO_RUN}" in 82552400Sbillf '') 82658910Salfred # prompt user to install/delete/merge changes 82758910Salfred diff_loop 82852400Sbillf ;; 82952400Sbillf *) 83052400Sbillf # If this is an auto run, make it official 83152400Sbillf echo " *** ${COMPFILE} will remain for your consideration" 83252400Sbillf ;; 83352400Sbillf esac # Auto run test 83452400Sbillf fi # Yes, the files are different 83552400Sbillf fi # Yes, the file still remains to be checked 83652400Sbillfdone # This is for the do way up there at the beginning of the comparison 83752400Sbillf 83852534Sbillfecho '' 83952400Sbillfecho "*** Comparison complete" 84052400Sbillfecho '' 84152400Sbillf 84252400SbillfTEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null` 84352400Sbillfif [ -n "${TEST_FOR_FILES}" ]; then 84452400Sbillf echo "*** Files that remain for you to merge by hand:" 84552400Sbillf find "${TEMPROOT}" -type f -size +0 84677335Sdougb echo '' 84752400Sbillffi 84852400Sbillf 84952400Sbillfcase "${AUTO_RUN}" in 85052400Sbillf'') 85167859Sdougb echo -n "Do you wish to delete what is left of ${TEMPROOT}? [no] " 85267859Sdougb read DEL_TEMPROOT 85367859Sdougb 85452400Sbillf case "${DEL_TEMPROOT}" in 85552400Sbillf [yY]*) 85699152Sdougb if delete_temproot; then 85752400Sbillf echo " *** ${TEMPROOT} has been deleted" 85852400Sbillf else 85952400Sbillf echo " *** Unable to delete ${TEMPROOT}" 86052400Sbillf fi 86152400Sbillf ;; 86252400Sbillf *) 86352400Sbillf echo " *** ${TEMPROOT} will remain" 86452400Sbillf ;; 86552400Sbillf esac 86652400Sbillf ;; 86752400Sbillf*) ;; 86852400Sbillfesac 86952400Sbillf 87068153Sdougbcase "${AUTO_INSTALLED_FILES}" in 87168153Sdougb'') ;; 87268153Sdougb*) 87373651Sdougb case "${AUTO_RUN}" in 87473651Sdougb '') 87573651Sdougb ( 87673651Sdougb echo '' 87777323Sdougb echo '*** You chose the automatic install option for files that did not' 87877323Sdougb echo ' exist on your system. The following were installed for you:' 87973651Sdougb echo "${AUTO_INSTALLED_FILES}" 88073651Sdougb ) | ${PAGER} 88173651Sdougb ;; 88273651Sdougb *) 88368153Sdougb echo '' 88477323Sdougb echo '*** You chose the automatic install option for files that did not' 88577323Sdougb echo ' exist on your system. The following were installed for you:' 88668153Sdougb echo "${AUTO_INSTALLED_FILES}" 88773651Sdougb ;; 88873651Sdougb esac 88968153Sdougb ;; 89068153Sdougbesac 89168153Sdougb 89273651Sdougbrun_it_now () { 89373651Sdougb case "${AUTO_RUN}" in 89473651Sdougb '') 89573651Sdougb unset YES_OR_NO 89673651Sdougb echo '' 89777335Sdougb echo -n ' Would you like to run it now? y or n [n] ' 89873651Sdougb read YES_OR_NO 89973651Sdougb 90073651Sdougb case "${YES_OR_NO}" in 90173651Sdougb y) 90277335Sdougb echo " Running ${1}" 90377335Sdougb echo '' 90473651Sdougb eval "${1}" 90573651Sdougb ;; 90677335Sdougb ''|n) 90777335Sdougb echo '' 90877335Sdougb echo " *** Cancelled" 90977335Sdougb echo '' 91077335Sdougb echo " Make sure to run ${1} yourself" 91177335Sdougb ;; 91273651Sdougb *) 91377335Sdougb echo '' 91477335Sdougb echo " *** Sorry, I do not understand your answer (${YES_OR_NO})" 91577335Sdougb echo '' 91677335Sdougb echo " Make sure to run ${1} yourself" 91773651Sdougb esac 91873651Sdougb ;; 91973651Sdougb *) ;; 92073651Sdougb esac 92173651Sdougb} 92273651Sdougb 92352400Sbillfcase "${NEED_MAKEDEV}" in 92452400Sbillf'') ;; 92552400Sbillf*) 92652400Sbillf echo '' 92777335Sdougb echo "*** You installed a new ${DESTDIR}/dev/MAKEDEV script, so make sure that you run" 92877335Sdougb echo " 'cd ${DESTDIR}/dev && /bin/sh MAKEDEV all' to rebuild your devices" 92977335Sdougb run_it_now "cd ${DESTDIR}/dev && /bin/sh MAKEDEV all" 93052400Sbillf ;; 93152400Sbillfesac 93252400Sbillf 93352400Sbillfcase "${NEED_NEWALIASES}" in 93452400Sbillf'') ;; 93552400Sbillf*) 93652400Sbillf echo '' 93777335Sdougb if [ -n "${DESTDIR}" ]; then 93877335Sdougb echo "*** You installed a new aliases file into ${DESTDIR}/etc/mail, but" 93977335Sdougb echo " the newaliases command is limited to the directories configured" 94077335Sdougb echo " in sendmail.cf. Make sure to create your aliases database by" 94177335Sdougb echo " hand when your sendmail configuration is done." 94277335Sdougb else 94377335Sdougb echo "*** You installed a new aliases file, so make sure that you run" 94477335Sdougb echo " '/usr/bin/newaliases' to rebuild your aliases database" 94577335Sdougb run_it_now '/usr/bin/newaliases' 94677335Sdougb fi 94752400Sbillf ;; 94852400Sbillfesac 94952400Sbillf 95052400Sbillfcase "${NEED_CAP_MKDB}" in 95152400Sbillf'') ;; 95252400Sbillf*) 95352400Sbillf echo '' 95452400Sbillf echo "*** You installed a login.conf file, so make sure that you run" 95577335Sdougb echo " '/usr/bin/cap_mkdb ${DESTDIR}/etc/login.conf'" 95677335Sdougb echo " to rebuild your login.conf database" 95777335Sdougb run_it_now "/usr/bin/cap_mkdb ${DESTDIR}/etc/login.conf" 95852400Sbillf ;; 95952400Sbillfesac 96052400Sbillf 96152400Sbillfcase "${NEED_PWD_MKDB}" in 96252400Sbillf'') ;; 96352400Sbillf*) 96452400Sbillf echo '' 96552400Sbillf echo "*** You installed a new master.passwd file, so make sure that you run" 96677335Sdougb if [ -n "${DESTDIR}" ]; then 96777335Sdougb echo " '/usr/sbin/pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd'" 96877335Sdougb echo " to rebuild your password files" 96977335Sdougb run_it_now "/usr/sbin/pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd" 97077335Sdougb else 97177335Sdougb echo " '/usr/sbin/pwd_mkdb -p /etc/master.passwd'" 97277335Sdougb echo " to rebuild your password files" 97377335Sdougb run_it_now '/usr/sbin/pwd_mkdb -p /etc/master.passwd' 97477335Sdougb fi 97552400Sbillf ;; 97652400Sbillfesac 97752400Sbillf 97852400Sbillfecho '' 97952400Sbillf 98067949Sdougbif [ -r "${MM_EXIT_SCRIPT}" ]; then 98167949Sdougb . "${MM_EXIT_SCRIPT}" 98267949Sdougbfi 98367949Sdougb 98491193Sdougbcase "${COMP_CONFS}" in 98591193Sdougb'') ;; 98691193Sdougb*) 98791193Sdougb . ${DESTDIR}/etc/defaults/rc.conf 98891193Sdougb 98991193Sdougb (echo '' 99091193Sdougb echo "*** Comparing conf files: ${rc_conf_files}" 99191193Sdougb 99291193Sdougb for CONF_FILE in ${rc_conf_files}; do 99391193Sdougb if [ -r "${DESTDIR}${CONF_FILE}" ]; then 99491193Sdougb echo '' 99591193Sdougb echo "*** From ${DESTDIR}${CONF_FILE}" 99691193Sdougb echo "*** From ${DESTDIR}/etc/defaults/rc.conf" 99791193Sdougb 99891193Sdougb for RC_CONF_VAR in `grep -i ^[a-z] ${DESTDIR}${CONF_FILE} | 99991193Sdougb cut -d '=' -f 1`; do 100091193Sdougb echo '' 100191223Sdougb grep -w ^${RC_CONF_VAR} ${DESTDIR}${CONF_FILE} 100291223Sdougb grep -w ^${RC_CONF_VAR} ${DESTDIR}/etc/defaults/rc.conf || 100391193Sdougb echo ' * No default variable with this name' 100491193Sdougb done 100591193Sdougb fi 100691193Sdougb done) | ${PAGER} 100791193Sdougb echo '' 100891193Sdougb ;; 100991193Sdougbesac 101091193Sdougb 101191193Sdougbcase "${PRE_WORLD}" in 101291193Sdougb'') ;; 101391193Sdougb*) 101491193Sdougb MAKE_CONF="${SOURCEDIR%etc}share/examples/etc/make.conf" 101591193Sdougb 101691193Sdougb (echo '' 101791193Sdougb echo '*** Comparing make variables' 101891193Sdougb echo '' 101991193Sdougb echo "*** From ${DESTDIR}/etc/make.conf" 102091193Sdougb echo "*** From ${MAKE_CONF}" 102191193Sdougb 1022101348Sdougb for MAKE_VAR in `grep -i ^[a-z] ${DESTDIR}/etc/make.conf | cut -d '=' -f 1`; do 102391193Sdougb echo '' 102491223Sdougb grep -w ^${MAKE_VAR} ${DESTDIR}/etc/make.conf 102591223Sdougb grep -w ^#${MAKE_VAR} ${MAKE_CONF} || 102691193Sdougb echo ' * No example variable with this name' 102791193Sdougb done) | ${PAGER} 102891193Sdougb ;; 102991193Sdougbesac 103091193Sdougb 103152400Sbillfexit 0 103267850Sdougb 1033