* Add two requested features, source'ing of /etc/mergemaster.rc, and

asking the user to actually run the recommended commands related
  to installation of files such as aliases or login.conf.

* Return to using grep for CVS $Id comparison. Using ident caused too
  many problems for people with local CVS/RCS tags in their stuff.
  Attempt to make portability a little easier to maintain in spite of
  this change by defining the name of the tag to search for. This
  is a slightly different change that solves the problem in the PR.

PR:		bin/24564
Submitted by:	Tony Finch <dot@dotat.at>
This commit is contained in:
dougb 2001-03-05 10:13:21 +00:00
parent e784677087
commit 1b0d083ef2
2 changed files with 66 additions and 17 deletions

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 1998-2000 Douglas Barton .\" Copyright (c) 1998-2001 Douglas Barton
.\" All rights reserved. .\" All rights reserved.
.\" .\"
.\" Redistribution and use in source and binary forms, with or without .\" Redistribution and use in source and binary forms, with or without
@ -24,7 +24,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd October 30, 2000 .Dd February 5, 2001
.Dt MERGEMASTER 8 .Dt MERGEMASTER 8
.Os FreeBSD .Os FreeBSD
.Sh NAME .Sh NAME
@ -137,6 +137,12 @@ Because the named scripts are sourced from within
.Nm , .Nm ,
all of the script's variables are available for use in all of the script's variables are available for use in
your custom script. your custom script.
You can also use
.Pa /etc/mergemaster.rc
which will be read before
.Pa .mergemasterrc .
Options specified on the command line are updated last,
and therefore can override both files.
.Pp .Pp
The options are as follows: The options are as follows:
.Bl -tag -width Fl .Bl -tag -width Fl

View File

@ -5,8 +5,8 @@
# Compare files created by /usr/src/etc/Makefile (or the directory # Compare files created by /usr/src/etc/Makefile (or the directory
# the user specifies) with the currently installed copies. # the user specifies) with the currently installed copies.
# Copyright 1998-2000 Douglas Barton # Copyright 1998-2001 Douglas Barton
# Doug@gorean.org # DougB@FreeBSD.org
# $FreeBSD$ # $FreeBSD$
@ -211,6 +211,12 @@ diff_loop () {
# #
TEMPROOT='/var/tmp/temproot' TEMPROOT='/var/tmp/temproot'
# Read /etc/mergemaster.rc first so the one in $HOME can override
#
if [ -r /etc/mergemaster.rc ]; then
. /etc/mergemaster.rc
fi
# Read .mergemasterrc before command line so CLI can override # Read .mergemasterrc before command line so CLI can override
# #
if [ -r "$HOME/.mergemasterrc" ]; then if [ -r "$HOME/.mergemasterrc" ]; then
@ -342,6 +348,10 @@ DIFF_FLAG=${DIFF_FLAG:--u}
# #
SOURCEDIR=${SOURCEDIR:-/usr/src/etc} SOURCEDIR=${SOURCEDIR:-/usr/src/etc}
# Define what CVS $Id tag to look for to aid portability.
#
CVS_ID_TAG=FreeBSD
case "${RERUN}" in case "${RERUN}" in
'') '')
# Set up the loop to test for the existence of the # Set up the loop to test for the existence of the
@ -681,16 +691,11 @@ for COMPFILE in `find . -type f -size +0`; do
# If the files have the same $Id, delete the one in temproot so the # If the files have the same $Id, delete the one in temproot so the
# user will have less to wade through if files are left to merge by hand. # user will have less to wade through if files are left to merge by hand.
# #
# Reduce complexity and improve portability by using ident CVSID1=`grep "[$]${CVS_ID_TAG}:" ${DESTDIR}${COMPFILE#.} 2>/dev/null`
# CVSID2=`grep "[$]${CVS_ID_TAG}:" ${COMPFILE} 2>/dev/null`
CVSID1=`ident ${DESTDIR}${COMPFILE#.} 2>&1`
CVSID1="${CVSID1#${DESTDIR}}"
CVSID2=`ident ${COMPFILE} 2>&1`
case "${CVSID2}" in case "${CVSID2}" in
*'no id keywords'*) "${CVSID1}")
;;
."${CVSID1}")
echo " *** Temp ${COMPFILE} and installed have the same CVS Id, deleting" echo " *** Temp ${COMPFILE} and installed have the same CVS Id, deleting"
rm "${COMPFILE}" rm "${COMPFILE}"
;; ;;
@ -763,21 +768,56 @@ esac
case "${AUTO_INSTALLED_FILES}" in case "${AUTO_INSTALLED_FILES}" in
'') ;; '') ;;
*) *)
( case "${AUTO_RUN}" in
'')
(
echo ''
echo '*** You chose the automatic install option for files that did not exist'
echo ' on your system. The following files were installed for you:'
echo "${AUTO_INSTALLED_FILES}"
) | ${PAGER}
;;
*)
echo '' echo ''
echo '*** You chose the automatic install option for files that did not exist' echo '*** You chose the automatic install option for files that did not exist'
echo ' on your system. The following files were installed for you:' echo ' on your system. The following files were installed for you:'
echo "${AUTO_INSTALLED_FILES}" echo "${AUTO_INSTALLED_FILES}"
) | ${PAGER} ;;
esac
;; ;;
esac esac
run_it_now () {
case "${AUTO_RUN}" in
'')
unset YES_OR_NO
echo ''
echo -n ' Would you like to run it now? [y or n] '
read YES_OR_NO
echo ''
case "${YES_OR_NO}" in
y)
echo " Running ${1}"
eval "${1}"
;;
*)
echo " Make sure to run ${1} yourself"
;;
esac
;;
*) ;;
esac
}
case "${NEED_MAKEDEV}" in case "${NEED_MAKEDEV}" in
'') ;; '') ;;
*) *)
echo '' echo ''
echo "*** You installed a new /dev/MAKEDEV script, so make sure that you run" echo "*** You installed a new /dev/MAKEDEV script, so make sure that you run"
echo " 'cd /dev && /bin/sh MAKEDEV all' to rebuild your devices" echo " 'cd /dev && /bin/sh MAKEDEV all' to rebuild your devices"
run_it_now 'cd /dev && /bin/sh MAKEDEV all'
;; ;;
esac esac
@ -786,7 +826,8 @@ case "${NEED_NEWALIASES}" in
*) *)
echo '' echo ''
echo "*** You installed a new aliases file, so make sure that you run" echo "*** You installed a new aliases file, so make sure that you run"
echo " 'newaliases' to rebuild your aliases database" echo " '/usr/bin/newaliases' to rebuild your aliases database"
run_it_now '/usr/bin/newaliases'
;; ;;
esac esac
@ -795,7 +836,8 @@ case "${NEED_CAP_MKDB}" in
*) *)
echo '' echo ''
echo "*** You installed a login.conf file, so make sure that you run" echo "*** You installed a login.conf file, so make sure that you run"
echo " 'cap_mkdb /etc/login.conf' to rebuild your login.conf database" echo " '/usr/bin/cap_mkdb /etc/login.conf' to rebuild your login.conf database"
run_it_now '/usr/bin/cap_mkdb /etc/login.conf'
;; ;;
esac esac
@ -804,7 +846,8 @@ case "${NEED_PWD_MKDB}" in
*) *)
echo '' echo ''
echo "*** You installed a new master.passwd file, so make sure that you run" echo "*** You installed a new master.passwd file, so make sure that you run"
echo " 'pwd_mkdb -p /etc/master.passwd' to rebuild your password files" echo " '/usr/sbin/pwd_mkdb -p /etc/master.passwd' to rebuild your password files"
run_it_now '/usr/sbin/pwd_mkdb -p /etc/master.passwd'
;; ;;
esac esac