Deleted Added
full compact
mergemaster.sh (97380) mergemaster.sh (97960)
1#!/bin/sh
2
3# mergemaster
4
5# Compare files created by /usr/src/etc/Makefile (or the directory
6# the user specifies) with the currently installed copies.
7
8# Copyright 1998-2002 Douglas Barton
9# DougB@FreeBSD.org
10
1#!/bin/sh
2
3# mergemaster
4
5# Compare files created by /usr/src/etc/Makefile (or the directory
6# the user specifies) with the currently installed copies.
7
8# Copyright 1998-2002 Douglas Barton
9# DougB@FreeBSD.org
10
11# $FreeBSD: head/usr.sbin/mergemaster/mergemaster.sh 97380 2002-05-28 07:25:44Z dougb $
11# $FreeBSD: head/usr.sbin/mergemaster/mergemaster.sh 97960 2002-06-06 20:38:22Z dougb $
12
13PATH=/bin:/usr/bin:/usr/sbin
14
15display_usage () {
16 VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`
17 echo "mergemaster version ${VERSION_NUMBER}"
18 echo 'Usage: mergemaster [-scrvahipC] [-m /path]'
19 echo ' [-t /path] [-d] [-u N] [-w N] [-D /path]'

--- 189 unchanged lines hidden (view full) ---

209 case "${VERBOSE}" in
210 '') ;;
211 *)
212 sleep 3
213 ;;
214 esac
215}
216
12
13PATH=/bin:/usr/bin:/usr/sbin
14
15display_usage () {
16 VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`
17 echo "mergemaster version ${VERSION_NUMBER}"
18 echo 'Usage: mergemaster [-scrvahipC] [-m /path]'
19 echo ' [-t /path] [-d] [-u N] [-w N] [-D /path]'

--- 189 unchanged lines hidden (view full) ---

209 case "${VERBOSE}" in
210 '') ;;
211 *)
212 sleep 3
213 ;;
214 esac
215}
216
217press_to_continue () {
218 local DISCARD
219 echo -n ' *** Press the [Enter] or [Return] key to continue '
220 read DISCARD
221}
222
217# Set the default path for the temporary root environment
218#
219TEMPROOT='/var/tmp/temproot'
220
221# Read /etc/mergemaster.rc first so the one in $HOME can override
222#
223if [ -r /etc/mergemaster.rc ]; then
224 . /etc/mergemaster.rc

--- 242 unchanged lines hidden (view full) ---

467 fi
468
469 echo " *** Creating and populating directory structure in ${TEMPROOT}"
470 echo ''
471
472 case "${VERBOSE}" in
473 '') ;;
474 *)
223# Set the default path for the temporary root environment
224#
225TEMPROOT='/var/tmp/temproot'
226
227# Read /etc/mergemaster.rc first so the one in $HOME can override
228#
229if [ -r /etc/mergemaster.rc ]; then
230 . /etc/mergemaster.rc

--- 242 unchanged lines hidden (view full) ---

473 fi
474
475 echo " *** Creating and populating directory structure in ${TEMPROOT}"
476 echo ''
477
478 case "${VERBOSE}" in
479 '') ;;
480 *)
475 echo " *** Press [Enter] or [Return] key to continue"
476 read ANY_KEY
477 unset ANY_KEY
481 press_to_continue
478 ;;
479 esac
480
481 case "${PRE_WORLD}" in
482 '')
483 { cd ${SOURCEDIR} &&
484 case "${DESTDIR}" in
485 '') ;;

--- 31 unchanged lines hidden (view full) ---

517 *)
518 echo ''
519 echo ' *** The following files exist only in the installed version of'
520 echo " ${DESTDIR}/etc. In the vast majority of cases these files"
521 echo ' are necessary parts of the system and should not be deleted.'
522 echo ' However because these files are not updated by this process you'
523 echo ' might want to verify their status before rebooting your system.'
524 echo ''
482 ;;
483 esac
484
485 case "${PRE_WORLD}" in
486 '')
487 { cd ${SOURCEDIR} &&
488 case "${DESTDIR}" in
489 '') ;;

--- 31 unchanged lines hidden (view full) ---

521 *)
522 echo ''
523 echo ' *** The following files exist only in the installed version of'
524 echo " ${DESTDIR}/etc. In the vast majority of cases these files"
525 echo ' are necessary parts of the system and should not be deleted.'
526 echo ' However because these files are not updated by this process you'
527 echo ' might want to verify their status before rebooting your system.'
528 echo ''
525 echo ' *** Press [Enter] or [Return] key to continue'
526 read ANY_KEY
527 unset ANY_KEY
529 press_to_continue
528 diff -qr ${DESTDIR}/etc ${TEMPROOT}/etc | grep "^Only in /etc" | ${PAGER}
529 echo ''
530 diff -qr ${DESTDIR}/etc ${TEMPROOT}/etc | grep "^Only in /etc" | ${PAGER}
531 echo ''
530 echo ' *** Press [Enter] or [Return] key to continue'
531 read ANY_KEY
532 unset ANY_KEY
532 press_to_continue
533 ;;
534 esac
535
536 # Avoid comparing the motd if the user specifies it in .mergemasterrc
537 case "${IGNORE_MOTD}" in
538 '') ;;
539 *) rm -f ${TEMPROOT}/etc/motd
540 ;;

--- 13 unchanged lines hidden (view full) ---

554#
555rm -f ${TEMPROOT}/etc/spwd.db ${TEMPROOT}/etc/passwd ${TEMPROOT}/etc/pwd.db
556
557# We only need to compare things like freebsd.cf once
558find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null
559
560# Get ready to start comparing files
561
533 ;;
534 esac
535
536 # Avoid comparing the motd if the user specifies it in .mergemasterrc
537 case "${IGNORE_MOTD}" in
538 '') ;;
539 *) rm -f ${TEMPROOT}/etc/motd
540 ;;

--- 13 unchanged lines hidden (view full) ---

554#
555rm -f ${TEMPROOT}/etc/spwd.db ${TEMPROOT}/etc/passwd ${TEMPROOT}/etc/pwd.db
556
557# We only need to compare things like freebsd.cf once
558find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null
559
560# Get ready to start comparing files
561
562# Check umask if not specified on the command line,
563# and we are not doing an autorun
562# Check umask if we are not doing an autorun
564#
563#
565if [ -z "${NEW_UMASK}" -a -z "${AUTO_RUN}" ]; then
566 USER_UMASK=`umask`
564case "${AUTO_RUN}" in
565'')
566 case "${NEW_UMASK}" in
567 '')
568 USER_UMASK=`umask`
569 ;;
570 *)
571 USER_UMASK="${NEW_UMASK}"
572 ;;
573 esac
574
567 case "${USER_UMASK}" in
568 0022|022) ;;
569 *)
570 echo ''
575 case "${USER_UMASK}" in
576 0022|022) ;;
577 *)
578 echo ''
571 echo " *** Your umask is currently set to ${USER_UMASK}. By default, this script"
572 echo " installs all files with the same user, group and modes that"
573 echo " they are created with by ${SOURCEDIR}/Makefile, compared to"
574 echo " a umask of 022. This umask allows world read permission when"
575 echo " the file's default permissions have it."
576 echo " No world permissions can sometimes cause problems. A umask of"
577 echo " 022 will restore the default behavior, but is not mandatory."
578 echo " /etc/master.passwd is a special case. Its file permissions"
579 echo " will be 600 (rw-------) if installed."
579 echo " *** Your umask is currently set to ${USER_UMASK}. This script installs"
580 echo ' all files with the same user, group, and modes that they'
581 echo " are created with by ${SOURCEDIR}/Makefile."
580 echo ''
582 echo ''
581 echo -n "What umask should I use? [${USER_UMASK}] "
582 read NEW_UMASK
583
584 NEW_UMASK="${NEW_UMASK:-$USER_UMASK}"
583 echo ' If you would like different permissions for the files or'
584 echo ' directories, you will have to set them after installation.'
585 echo ''
586 press_to_continue
585 ;;
586 esac
587 echo ''
587 ;;
588 esac
589 echo ''
588fi
590 ;;
591esac
589
592
590CONFIRMED_UMASK=${NEW_UMASK:-0022}
591
592# Warn users who still have ${DESTDIR}/etc/sysconfig
593#
594if [ -e "${DESTDIR}/etc/sysconfig" ]; then
595 echo ''
596 echo " *** There is a sysconfig file on this system in ${DESTDIR}/etc/."
597 echo ''
598 echo ' Starting with FreeBSD version 2.2.2 those settings moved from'
599 echo ' /etc/sysconfig to /etc/rc.conf. If you are upgrading an older'

--- 16 unchanged lines hidden (view full) ---

616 echo ''
617 ;;
618 esac
619 ;;
620 *) ;;
621 esac
622fi
623
593# Warn users who still have ${DESTDIR}/etc/sysconfig
594#
595if [ -e "${DESTDIR}/etc/sysconfig" ]; then
596 echo ''
597 echo " *** There is a sysconfig file on this system in ${DESTDIR}/etc/."
598 echo ''
599 echo ' Starting with FreeBSD version 2.2.2 those settings moved from'
600 echo ' /etc/sysconfig to /etc/rc.conf. If you are upgrading an older'

--- 16 unchanged lines hidden (view full) ---

617 echo ''
618 ;;
619 esac
620 ;;
621 *) ;;
622 esac
623fi
624
624# Use the umask/mode information to install the files
625# Use the mode information to install the files
625# Create directories as needed
626#
627do_install_and_rm () {
628 install -m "${1}" "${2}" "${3}" &&
629 rm -f "${2}"
630}
631
632mm_install () {
633 local INSTALL_DIR
634 INSTALL_DIR=${1#.}
635 INSTALL_DIR=${INSTALL_DIR%/*}
636
637 case "${INSTALL_DIR}" in
638 '')
639 INSTALL_DIR=/
640 ;;
641 esac
642
643 if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then
626# Create directories as needed
627#
628do_install_and_rm () {
629 install -m "${1}" "${2}" "${3}" &&
630 rm -f "${2}"
631}
632
633mm_install () {
634 local INSTALL_DIR
635 INSTALL_DIR=${1#.}
636 INSTALL_DIR=${INSTALL_DIR%/*}
637
638 case "${INSTALL_DIR}" in
639 '')
640 INSTALL_DIR=/
641 ;;
642 esac
643
644 if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then
644 DIR_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ \
645 oct("$ARGV[1]"))' "${TEMPROOT}/${INSTALL_DIR}" "${CONFIRMED_UMASK}"`
645 DIR_MODE=`stat -f "%OMp%OLp" "${TEMPROOT}/${INSTALL_DIR}"`
646 install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}"
647 fi
648
646 install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}"
647 fi
648
649 FILE_MODE=`perl -e 'printf "%04o\n", (((stat("$ARGV[0]"))[2] & 07777) &~ \
650 oct("$ARGV[1]"))' "${1}" "${CONFIRMED_UMASK}"`
649 FILE_MODE=`stat -f "%OMp%OLp" "${1}"`
651
652 if [ ! -x "${1}" ]; then
653 case "${1#.}" in
654 /etc/mail/aliases)
655 NEED_NEWALIASES=yes
656 ;;
657 /etc/login.conf)
658 NEED_CAP_MKDB=yes

--- 361 unchanged lines hidden ---
650
651 if [ ! -x "${1}" ]; then
652 case "${1#.}" in
653 /etc/mail/aliases)
654 NEED_NEWALIASES=yes
655 ;;
656 /etc/login.conf)
657 NEED_CAP_MKDB=yes

--- 361 unchanged lines hidden ---