mergemaster.sh revision 111901
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 8110377Sdougb# Copyright 1998-2003 Douglas Barton 973651Sdougb# DougB@FreeBSD.org 1052400Sbillf 1152495Sbillf# $FreeBSD: head/usr.sbin/mergemaster/mergemaster.sh 111901 2003-03-05 08:20:55Z 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 '' 115109993Sdillon echo ' ====================================================================== ' 116109993Sdillon echo '' 117109993Sdillon ( 118109993Sdillon echo " *** Displaying differences between ${COMPFILE} and installed version:" 119109993Sdillon echo '' 120110377Sdougb diff ${DIFF_FLAG} ${DIFF_OPTIONS} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" 121109993Sdillon ) | ${PAGER} 122109993Sdillon echo '' 12367850Sdougb fi 12467850Sdougb else 125109993Sdillon echo '' 12667850Sdougb echo " *** There is no installed version of ${COMPFILE}" 12791193Sdougb echo '' 12867949Sdougb case "${AUTO_INSTALL}" in 12967949Sdougb [Yy][Ee][Ss]) 13067949Sdougb echo '' 13167949Sdougb if mm_install "${COMPFILE}"; then 13267949Sdougb echo " *** ${COMPFILE} installed successfully" 13368507Sdougb echo '' 13467949Sdougb # Make the list print one file per line 13567949Sdougb AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES} ${DESTDIR}${COMPFILE#.} 13667949Sdougb" 13767949Sdougb else 13867949Sdougb echo " *** Problem installing ${COMPFILE}, it will remain to merge by hand" 13967949Sdougb fi 14067949Sdougb return 14167949Sdougb ;; 14267949Sdougb *) 14367949Sdougb NO_INSTALLED=yes 14467949Sdougb ;; 14567949Sdougb esac 14667850Sdougb fi 14767859Sdougb 14867850Sdougb echo " Use 'd' to delete the temporary ${COMPFILE}" 14967850Sdougb echo " Use 'i' to install the temporary ${COMPFILE}" 15067850Sdougb case "${NO_INSTALLED}" in 15167850Sdougb '') 15277326Sdougb echo " Use 'm' to merge the temporary and installed versions" 153109993Sdillon echo " Use 'v' to view the diff results again" 15467850Sdougb ;; 15567850Sdougb esac 15667850Sdougb echo '' 15767850Sdougb echo " Default is to leave the temporary file to deal with by hand" 15867850Sdougb echo '' 15967859Sdougb echo -n "How should I deal with this? [Leave it for later] " 16067859Sdougb read HANDLE_COMPFILE 16167859Sdougb 16267850Sdougb case "${HANDLE_COMPFILE}" in 16367850Sdougb [dD]) 16467850Sdougb rm "${COMPFILE}" 16567850Sdougb echo '' 16667850Sdougb echo " *** Deleting ${COMPFILE}" 16767850Sdougb ;; 16867850Sdougb [iI]) 16967850Sdougb echo '' 17067850Sdougb if mm_install "${COMPFILE}"; then 17167850Sdougb echo " *** ${COMPFILE} installed successfully" 17267850Sdougb else 17367850Sdougb echo " *** Problem installing ${COMPFILE}, it will remain to merge by hand" 17467850Sdougb fi 17567850Sdougb ;; 17667850Sdougb [mM]) 17767850Sdougb case "${NO_INSTALLED}" in 17867850Sdougb '') 17967850Sdougb # interact with user to merge files 18067850Sdougb merge_loop 18167850Sdougb ;; 18267850Sdougb *) 18367850Sdougb echo '' 18467850Sdougb echo " *** There is no installed version of ${COMPFILE}" 18567850Sdougb echo '' 18667850Sdougb HANDLE_COMPFILE="NOT V" 18767850Sdougb ;; 18867850Sdougb esac # End of "No installed version of file but user selected merge" test 18967850Sdougb ;; 19067850Sdougb [vV]) 19167850Sdougb continue 19267850Sdougb ;; 19367850Sdougb '') 19467850Sdougb echo '' 19567850Sdougb echo " *** ${COMPFILE} will remain for your consideration" 19667850Sdougb ;; 19767850Sdougb *) 19867850Sdougb # invalid choice, show menu again. 19967850Sdougb echo "invalid choice: ${HANDLE_COMPFILE}" 20067850Sdougb echo '' 20167850Sdougb HANDLE_COMPFILE="NOT V" 20267850Sdougb continue 20367850Sdougb ;; 20467850Sdougb esac # End of "How to handle files that are different" 20567859Sdougb done 20667850Sdougb unset NO_INSTALLED 20767850Sdougb echo '' 20867850Sdougb case "${VERBOSE}" in 20967850Sdougb '') ;; 21067850Sdougb *) 21167850Sdougb sleep 3 21267850Sdougb ;; 21367850Sdougb esac 21458910Salfred} 21558910Salfred 21697960Sdougbpress_to_continue () { 21797960Sdougb local DISCARD 21897960Sdougb echo -n ' *** Press the [Enter] or [Return] key to continue ' 21997960Sdougb read DISCARD 22097960Sdougb} 22197960Sdougb 22252400Sbillf# Set the default path for the temporary root environment 22352400Sbillf# 22452400SbillfTEMPROOT='/var/tmp/temproot' 22552400Sbillf 22673651Sdougb# Read /etc/mergemaster.rc first so the one in $HOME can override 22773651Sdougb# 22873651Sdougbif [ -r /etc/mergemaster.rc ]; then 22973651Sdougb . /etc/mergemaster.rc 23073651Sdougbfi 23173651Sdougb 23252400Sbillf# Read .mergemasterrc before command line so CLI can override 23352400Sbillf# 23467949Sdougbif [ -r "$HOME/.mergemasterrc" ]; then 23552400Sbillf . "$HOME/.mergemasterrc" 23652400Sbillffi 23752400Sbillf 23852400Sbillf# Check the command line options 23952400Sbillf# 24091193Sdougbwhile getopts ":ascrvhipCm:t:du:w:D:" COMMAND_LINE_ARGUMENT ; do 24152400Sbillf case "${COMMAND_LINE_ARGUMENT}" in 24252400Sbillf s) 24352400Sbillf STRICT=yes 244110377Sdougb unset DIFF_OPTIONS 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 375110377Sdougb w=`tput columns` 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} \ 503105705Sphk 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 557111901Sdougb# We really don't want to have to deal with files like login.conf.db, pwd.db, 558111901Sdougb# or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. 559111901Sdougb# Prompt the user to do so below, as needed. 56077478Sdougb# 561111901Sdougbrm -f ${TEMPROOT}/etc/*.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 # 815110377Sdougb if diff -q ${DIFF_OPTIONS} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \ 816110377Sdougb /dev/null 2>&1; then 81752400Sbillf echo " *** Temp ${COMPFILE} and installed are the same, deleting" 81852400Sbillf rm "${COMPFILE}" 81952400Sbillf else 82077323Sdougb # Ok, the files are different, so show the user where they differ. 82177323Sdougb # Use user's choice of diff methods; and user's pager if they have one. 82277323Sdougb # Use more if not. 82367859Sdougb # Use unified diffs by default. Context diffs give me a headache. :) 82452400Sbillf # 82552400Sbillf case "${AUTO_RUN}" in 82652400Sbillf '') 82758910Salfred # prompt user to install/delete/merge changes 82858910Salfred diff_loop 82952400Sbillf ;; 83052400Sbillf *) 83152400Sbillf # If this is an auto run, make it official 83252400Sbillf echo " *** ${COMPFILE} will remain for your consideration" 83352400Sbillf ;; 83452400Sbillf esac # Auto run test 83552400Sbillf fi # Yes, the files are different 83652400Sbillf fi # Yes, the file still remains to be checked 83752400Sbillfdone # This is for the do way up there at the beginning of the comparison 83852400Sbillf 83952534Sbillfecho '' 84052400Sbillfecho "*** Comparison complete" 84152400Sbillfecho '' 84252400Sbillf 84352400SbillfTEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null` 84452400Sbillfif [ -n "${TEST_FOR_FILES}" ]; then 84552400Sbillf echo "*** Files that remain for you to merge by hand:" 84652400Sbillf find "${TEMPROOT}" -type f -size +0 84777335Sdougb echo '' 84852400Sbillffi 84952400Sbillf 85052400Sbillfcase "${AUTO_RUN}" in 85152400Sbillf'') 85267859Sdougb echo -n "Do you wish to delete what is left of ${TEMPROOT}? [no] " 85367859Sdougb read DEL_TEMPROOT 85467859Sdougb 85552400Sbillf case "${DEL_TEMPROOT}" in 85652400Sbillf [yY]*) 85799152Sdougb if delete_temproot; then 85852400Sbillf echo " *** ${TEMPROOT} has been deleted" 85952400Sbillf else 86052400Sbillf echo " *** Unable to delete ${TEMPROOT}" 86152400Sbillf fi 86252400Sbillf ;; 86352400Sbillf *) 86452400Sbillf echo " *** ${TEMPROOT} will remain" 86552400Sbillf ;; 86652400Sbillf esac 86752400Sbillf ;; 86852400Sbillf*) ;; 86952400Sbillfesac 87052400Sbillf 87168153Sdougbcase "${AUTO_INSTALLED_FILES}" in 87268153Sdougb'') ;; 87368153Sdougb*) 87473651Sdougb case "${AUTO_RUN}" in 87573651Sdougb '') 87673651Sdougb ( 87773651Sdougb echo '' 87877323Sdougb echo '*** You chose the automatic install option for files that did not' 87977323Sdougb echo ' exist on your system. The following were installed for you:' 88073651Sdougb echo "${AUTO_INSTALLED_FILES}" 88173651Sdougb ) | ${PAGER} 88273651Sdougb ;; 88373651Sdougb *) 88468153Sdougb echo '' 88577323Sdougb echo '*** You chose the automatic install option for files that did not' 88677323Sdougb echo ' exist on your system. The following were installed for you:' 88768153Sdougb echo "${AUTO_INSTALLED_FILES}" 88873651Sdougb ;; 88973651Sdougb esac 89068153Sdougb ;; 89168153Sdougbesac 89268153Sdougb 89373651Sdougbrun_it_now () { 89473651Sdougb case "${AUTO_RUN}" in 89573651Sdougb '') 89673651Sdougb unset YES_OR_NO 89773651Sdougb echo '' 89877335Sdougb echo -n ' Would you like to run it now? y or n [n] ' 89973651Sdougb read YES_OR_NO 90073651Sdougb 90173651Sdougb case "${YES_OR_NO}" in 90273651Sdougb y) 90377335Sdougb echo " Running ${1}" 90477335Sdougb echo '' 90573651Sdougb eval "${1}" 90673651Sdougb ;; 90777335Sdougb ''|n) 90877335Sdougb echo '' 90977335Sdougb echo " *** Cancelled" 91077335Sdougb echo '' 91177335Sdougb echo " Make sure to run ${1} yourself" 91277335Sdougb ;; 91373651Sdougb *) 91477335Sdougb echo '' 91577335Sdougb echo " *** Sorry, I do not understand your answer (${YES_OR_NO})" 91677335Sdougb echo '' 91777335Sdougb echo " Make sure to run ${1} yourself" 91873651Sdougb esac 91973651Sdougb ;; 92073651Sdougb *) ;; 92173651Sdougb esac 92273651Sdougb} 92373651Sdougb 92452400Sbillfcase "${NEED_MAKEDEV}" in 92552400Sbillf'') ;; 92652400Sbillf*) 92752400Sbillf echo '' 92877335Sdougb echo "*** You installed a new ${DESTDIR}/dev/MAKEDEV script, so make sure that you run" 92977335Sdougb echo " 'cd ${DESTDIR}/dev && /bin/sh MAKEDEV all' to rebuild your devices" 93077335Sdougb run_it_now "cd ${DESTDIR}/dev && /bin/sh MAKEDEV all" 93152400Sbillf ;; 93252400Sbillfesac 93352400Sbillf 93452400Sbillfcase "${NEED_NEWALIASES}" in 93552400Sbillf'') ;; 93652400Sbillf*) 93752400Sbillf echo '' 93877335Sdougb if [ -n "${DESTDIR}" ]; then 93977335Sdougb echo "*** You installed a new aliases file into ${DESTDIR}/etc/mail, but" 94077335Sdougb echo " the newaliases command is limited to the directories configured" 94177335Sdougb echo " in sendmail.cf. Make sure to create your aliases database by" 94277335Sdougb echo " hand when your sendmail configuration is done." 94377335Sdougb else 94477335Sdougb echo "*** You installed a new aliases file, so make sure that you run" 94577335Sdougb echo " '/usr/bin/newaliases' to rebuild your aliases database" 94677335Sdougb run_it_now '/usr/bin/newaliases' 94777335Sdougb fi 94852400Sbillf ;; 94952400Sbillfesac 95052400Sbillf 95152400Sbillfcase "${NEED_CAP_MKDB}" in 95252400Sbillf'') ;; 95352400Sbillf*) 95452400Sbillf echo '' 95552400Sbillf echo "*** You installed a login.conf file, so make sure that you run" 95677335Sdougb echo " '/usr/bin/cap_mkdb ${DESTDIR}/etc/login.conf'" 95777335Sdougb echo " to rebuild your login.conf database" 95877335Sdougb run_it_now "/usr/bin/cap_mkdb ${DESTDIR}/etc/login.conf" 95952400Sbillf ;; 96052400Sbillfesac 96152400Sbillf 96252400Sbillfcase "${NEED_PWD_MKDB}" in 96352400Sbillf'') ;; 96452400Sbillf*) 96552400Sbillf echo '' 96652400Sbillf echo "*** You installed a new master.passwd file, so make sure that you run" 96777335Sdougb if [ -n "${DESTDIR}" ]; then 96877335Sdougb echo " '/usr/sbin/pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd'" 96977335Sdougb echo " to rebuild your password files" 97077335Sdougb run_it_now "/usr/sbin/pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd" 97177335Sdougb else 97277335Sdougb echo " '/usr/sbin/pwd_mkdb -p /etc/master.passwd'" 97377335Sdougb echo " to rebuild your password files" 97477335Sdougb run_it_now '/usr/sbin/pwd_mkdb -p /etc/master.passwd' 97577335Sdougb fi 97652400Sbillf ;; 97752400Sbillfesac 97852400Sbillf 97952400Sbillfecho '' 98052400Sbillf 98167949Sdougbif [ -r "${MM_EXIT_SCRIPT}" ]; then 98267949Sdougb . "${MM_EXIT_SCRIPT}" 98367949Sdougbfi 98467949Sdougb 98591193Sdougbcase "${COMP_CONFS}" in 98691193Sdougb'') ;; 98791193Sdougb*) 98891193Sdougb . ${DESTDIR}/etc/defaults/rc.conf 98991193Sdougb 99091193Sdougb (echo '' 99191193Sdougb echo "*** Comparing conf files: ${rc_conf_files}" 99291193Sdougb 99391193Sdougb for CONF_FILE in ${rc_conf_files}; do 99491193Sdougb if [ -r "${DESTDIR}${CONF_FILE}" ]; then 99591193Sdougb echo '' 99691193Sdougb echo "*** From ${DESTDIR}${CONF_FILE}" 99791193Sdougb echo "*** From ${DESTDIR}/etc/defaults/rc.conf" 99891193Sdougb 99991193Sdougb for RC_CONF_VAR in `grep -i ^[a-z] ${DESTDIR}${CONF_FILE} | 100091193Sdougb cut -d '=' -f 1`; do 100191193Sdougb echo '' 100291223Sdougb grep -w ^${RC_CONF_VAR} ${DESTDIR}${CONF_FILE} 100391223Sdougb grep -w ^${RC_CONF_VAR} ${DESTDIR}/etc/defaults/rc.conf || 100491193Sdougb echo ' * No default variable with this name' 100591193Sdougb done 100691193Sdougb fi 100791193Sdougb done) | ${PAGER} 100891193Sdougb echo '' 100991193Sdougb ;; 101091193Sdougbesac 101191193Sdougb 101291193Sdougbcase "${PRE_WORLD}" in 101391193Sdougb'') ;; 101491193Sdougb*) 101591193Sdougb MAKE_CONF="${SOURCEDIR%etc}share/examples/etc/make.conf" 101691193Sdougb 101791193Sdougb (echo '' 101891193Sdougb echo '*** Comparing make variables' 101991193Sdougb echo '' 102091193Sdougb echo "*** From ${DESTDIR}/etc/make.conf" 102191193Sdougb echo "*** From ${MAKE_CONF}" 102291193Sdougb 1023101348Sdougb for MAKE_VAR in `grep -i ^[a-z] ${DESTDIR}/etc/make.conf | cut -d '=' -f 1`; do 102491193Sdougb echo '' 102591223Sdougb grep -w ^${MAKE_VAR} ${DESTDIR}/etc/make.conf 102691223Sdougb grep -w ^#${MAKE_VAR} ${MAKE_CONF} || 102791193Sdougb echo ' * No example variable with this name' 102891193Sdougb done) | ${PAGER} 102991193Sdougb ;; 103091193Sdougbesac 103191193Sdougb 103252400Sbillfexit 0 103367850Sdougb 1034