* 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:
Doug Barton 2001-03-05 10:13:21 +00:00
parent 10cbbff15c
commit 5d7b107e1c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=73651
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.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 30, 2000
.Dd February 5, 2001
.Dt MERGEMASTER 8
.Os FreeBSD
.Sh NAME
@ -137,6 +137,12 @@ Because the named scripts are sourced from within
.Nm ,
all of the script's variables are available for use in
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
The options are as follows:
.Bl -tag -width Fl

View File

@ -5,8 +5,8 @@
# Compare files created by /usr/src/etc/Makefile (or the directory
# the user specifies) with the currently installed copies.
# Copyright 1998-2000 Douglas Barton
# Doug@gorean.org
# Copyright 1998-2001 Douglas Barton
# DougB@FreeBSD.org
# $FreeBSD$
@ -211,6 +211,12 @@ diff_loop () {
#
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
#
if [ -r "$HOME/.mergemasterrc" ]; then
@ -342,6 +348,10 @@ DIFF_FLAG=${DIFF_FLAG:--u}
#
SOURCEDIR=${SOURCEDIR:-/usr/src/etc}
# Define what CVS $Id tag to look for to aid portability.
#
CVS_ID_TAG=FreeBSD
case "${RERUN}" in
'')
# 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
# user will have less to wade through if files are left to merge by hand.
#
# Reduce complexity and improve portability by using ident
#
CVSID1=`ident ${DESTDIR}${COMPFILE#.} 2>&1`
CVSID1="${CVSID1#${DESTDIR}}"
CVSID2=`ident ${COMPFILE} 2>&1`
CVSID1=`grep "[$]${CVS_ID_TAG}:" ${DESTDIR}${COMPFILE#.} 2>/dev/null`
CVSID2=`grep "[$]${CVS_ID_TAG}:" ${COMPFILE} 2>/dev/null`
case "${CVSID2}" in
*'no id keywords'*)
;;
."${CVSID1}")
"${CVSID1}")
echo " *** Temp ${COMPFILE} and installed have the same CVS Id, deleting"
rm "${COMPFILE}"
;;
@ -763,21 +768,56 @@ esac
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 '*** 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}
;;
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
'') ;;
*)
echo ''
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"
run_it_now 'cd /dev && /bin/sh MAKEDEV all'
;;
esac
@ -786,7 +826,8 @@ case "${NEED_NEWALIASES}" in
*)
echo ''
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
@ -795,7 +836,8 @@ case "${NEED_CAP_MKDB}" in
*)
echo ''
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
@ -804,7 +846,8 @@ case "${NEED_PWD_MKDB}" in
*)
echo ''
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