1999-10-20 07:22:52 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# mergemaster
|
|
|
|
|
|
|
|
# Compare files created by /usr/src/etc/Makefile (or the directory
|
|
|
|
# the user specifies) with the currently installed copies.
|
|
|
|
|
2010-01-08 00:05:10 +00:00
|
|
|
# Copyright 1998-2010 Douglas Barton
|
2001-03-05 10:13:21 +00:00
|
|
|
# DougB@FreeBSD.org
|
1999-10-20 07:22:52 +00:00
|
|
|
|
1999-10-25 21:51:04 +00:00
|
|
|
# $FreeBSD$
|
1999-10-20 07:22:52 +00:00
|
|
|
|
2000-11-09 00:19:21 +00:00
|
|
|
PATH=/bin:/usr/bin:/usr/sbin
|
1999-10-20 07:22:52 +00:00
|
|
|
|
|
|
|
display_usage () {
|
1999-10-26 19:05:04 +00:00
|
|
|
VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`
|
1999-10-20 07:22:52 +00:00
|
|
|
echo "mergemaster version ${VERSION_NUMBER}"
|
2010-03-14 05:22:46 +00:00
|
|
|
echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]]'
|
2009-03-13 08:48:33 +00:00
|
|
|
echo ' [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]'
|
1999-10-20 07:22:52 +00:00
|
|
|
echo "Options:"
|
|
|
|
echo " -s Strict comparison (diff every pair of files)"
|
|
|
|
echo " -c Use context diff instead of unified diff"
|
|
|
|
echo " -r Re-run on a previously cleaned directory (skip temproot creation)"
|
|
|
|
echo " -v Be more verbose about the process, include additional checks"
|
|
|
|
echo " -a Leave all files that differ to merge by hand"
|
|
|
|
echo " -h Display more complete help"
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
echo ' -i Automatically install files that do not exist in destination directory'
|
2002-02-24 10:22:14 +00:00
|
|
|
echo ' -p Pre-buildworld mode, only compares crucial files'
|
2009-03-23 14:42:41 +00:00
|
|
|
echo ' -F Install files that differ only by revision control Id ($FreeBSD)'
|
2002-02-24 10:22:14 +00:00
|
|
|
echo ' -C Compare local rc.conf variables to the defaults'
|
2003-05-02 06:26:23 +00:00
|
|
|
echo ' -P Preserve files that are overwritten'
|
2009-03-13 08:48:33 +00:00
|
|
|
echo " -U Attempt to auto upgrade files that have not been user modified"
|
|
|
|
echo ''
|
1999-10-20 07:22:52 +00:00
|
|
|
echo " -m /path/directory Specify location of source to do the make in"
|
|
|
|
echo " -t /path/directory Specify temp root directory"
|
|
|
|
echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)"
|
|
|
|
echo " -u N Specify a numeric umask"
|
|
|
|
echo " -w N Specify a screen width in columns to sdiff"
|
2006-02-04 18:24:06 +00:00
|
|
|
echo " -A architecture Alternative architecture name to pass to make"
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
echo ' -D /path/directory Specify the destination directory to install files to'
|
1999-10-20 07:22:52 +00:00
|
|
|
echo ''
|
|
|
|
}
|
|
|
|
|
|
|
|
display_help () {
|
|
|
|
echo "* To specify a directory other than /var/tmp/temproot for the"
|
|
|
|
echo " temporary root environment, use -t /path/to/temp/root"
|
|
|
|
echo "* The -w option takes a number as an argument for the column width"
|
2000-10-29 09:40:22 +00:00
|
|
|
echo " of the screen. The default is 80."
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
echo '* The -a option causes mergemaster to run without prompting.'
|
1999-10-20 07:22:52 +00:00
|
|
|
}
|
|
|
|
|
2000-04-02 02:47:15 +00:00
|
|
|
# Loop allowing the user to use sdiff to merge files and display the merged
|
|
|
|
# file.
|
|
|
|
merge_loop () {
|
2000-10-29 07:47:51 +00:00
|
|
|
case "${VERBOSE}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
echo " *** Type h at the sdiff prompt (%) to get usage help"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo ''
|
|
|
|
MERGE_AGAIN=yes
|
|
|
|
while [ "${MERGE_AGAIN}" = "yes" ]; do
|
|
|
|
# Prime file.merged so we don't blat the owner/group id's
|
|
|
|
cp -p "${COMPFILE}" "${COMPFILE}.merged"
|
|
|
|
sdiff -o "${COMPFILE}.merged" --text --suppress-common-lines \
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
--width=${SCREEN_WIDTH:-80} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}"
|
2000-10-29 07:47:51 +00:00
|
|
|
INSTALL_MERGED=V
|
|
|
|
while [ "${INSTALL_MERGED}" = "v" -o "${INSTALL_MERGED}" = "V" ]; do
|
|
|
|
echo ''
|
|
|
|
echo " Use 'i' to install merged file"
|
|
|
|
echo " Use 'r' to re-do the merge"
|
|
|
|
echo " Use 'v' to view the merged file"
|
|
|
|
echo " Default is to leave the temporary file to deal with by hand"
|
|
|
|
echo ''
|
2000-10-29 09:40:22 +00:00
|
|
|
echo -n " *** How should I deal with the merged file? [Leave it for later] "
|
|
|
|
read INSTALL_MERGED
|
2000-10-29 07:47:51 +00:00
|
|
|
|
|
|
|
case "${INSTALL_MERGED}" in
|
|
|
|
[iI])
|
|
|
|
mv "${COMPFILE}.merged" "${COMPFILE}"
|
|
|
|
echo ''
|
|
|
|
if mm_install "${COMPFILE}"; then
|
|
|
|
echo " *** Merged version of ${COMPFILE} installed successfully"
|
2000-10-29 09:40:22 +00:00
|
|
|
else
|
2000-10-29 07:47:51 +00:00
|
|
|
echo " *** Problem installing ${COMPFILE}, it will remain to merge by hand later"
|
2000-10-29 09:40:22 +00:00
|
|
|
fi
|
2000-10-29 07:47:51 +00:00
|
|
|
unset MERGE_AGAIN
|
|
|
|
;;
|
|
|
|
[rR])
|
|
|
|
rm "${COMPFILE}.merged"
|
2000-10-29 09:40:22 +00:00
|
|
|
;;
|
2000-10-29 07:47:51 +00:00
|
|
|
[vV])
|
|
|
|
${PAGER} "${COMPFILE}.merged"
|
|
|
|
;;
|
|
|
|
'')
|
|
|
|
echo " *** ${COMPFILE} will remain for your consideration"
|
|
|
|
unset MERGE_AGAIN
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "invalid choice: ${INSTALL_MERGED}"
|
|
|
|
INSTALL_MERGED=V
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
done
|
2000-04-02 02:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Loop showing user differences between files, allow merge, skip or install
|
|
|
|
# options
|
|
|
|
diff_loop () {
|
|
|
|
|
2000-10-29 07:47:51 +00:00
|
|
|
HANDLE_COMPFILE=v
|
|
|
|
|
2001-05-28 09:07:27 +00:00
|
|
|
while [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" -o \
|
|
|
|
"${HANDLE_COMPFILE}" = "NOT V" ]; do
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
if [ -f "${DESTDIR}${COMPFILE#.}" -a -f "${COMPFILE}" ]; then
|
2009-05-16 22:22:31 +00:00
|
|
|
if [ -n "${AUTO_UPGRADE}" -a -n "${CHANGED}" ]; then
|
|
|
|
case "${CHANGED}" in
|
|
|
|
*:${DESTDIR}${COMPFILE#.}:*) ;; # File has been modified
|
|
|
|
*)
|
2006-04-29 18:21:43 +00:00
|
|
|
echo ''
|
|
|
|
echo " *** ${COMPFILE} has not been user modified."
|
|
|
|
echo ''
|
|
|
|
|
|
|
|
if mm_install "${COMPFILE}"; then
|
|
|
|
echo " *** ${COMPFILE} upgraded successfully"
|
|
|
|
echo ''
|
|
|
|
# Make the list print one file per line
|
|
|
|
AUTO_UPGRADED_FILES="${AUTO_UPGRADED_FILES} ${DESTDIR}${COMPFILE#.}
|
|
|
|
"
|
|
|
|
else
|
2009-05-16 22:22:31 +00:00
|
|
|
echo " *** Problem upgrading ${COMPFILE}, it will remain to merge by hand"
|
2006-04-29 18:21:43 +00:00
|
|
|
fi
|
|
|
|
return
|
2009-05-16 22:22:31 +00:00
|
|
|
;;
|
|
|
|
esac
|
2006-04-29 18:21:43 +00:00
|
|
|
fi
|
2000-10-29 07:47:51 +00:00
|
|
|
if [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" ]; then
|
2002-02-12 09:54:56 +00:00
|
|
|
echo ''
|
2003-01-28 18:44:40 +00:00
|
|
|
echo ' ====================================================================== '
|
|
|
|
echo ''
|
|
|
|
(
|
|
|
|
echo " *** Displaying differences between ${COMPFILE} and installed version:"
|
|
|
|
echo ''
|
2003-02-05 11:09:21 +00:00
|
|
|
diff ${DIFF_FLAG} ${DIFF_OPTIONS} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}"
|
2003-01-28 18:44:40 +00:00
|
|
|
) | ${PAGER}
|
|
|
|
echo ''
|
2000-10-29 07:47:51 +00:00
|
|
|
fi
|
|
|
|
else
|
2003-01-28 18:44:40 +00:00
|
|
|
echo ''
|
2000-10-29 07:47:51 +00:00
|
|
|
echo " *** There is no installed version of ${COMPFILE}"
|
2002-02-24 10:22:14 +00:00
|
|
|
echo ''
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
case "${AUTO_INSTALL}" in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo ''
|
|
|
|
if mm_install "${COMPFILE}"; then
|
|
|
|
echo " *** ${COMPFILE} installed successfully"
|
2000-11-09 00:19:21 +00:00
|
|
|
echo ''
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
# Make the list print one file per line
|
|
|
|
AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES} ${DESTDIR}${COMPFILE#.}
|
|
|
|
"
|
|
|
|
else
|
|
|
|
echo " *** Problem installing ${COMPFILE}, it will remain to merge by hand"
|
|
|
|
fi
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
NO_INSTALLED=yes
|
|
|
|
;;
|
|
|
|
esac
|
2000-10-29 07:47:51 +00:00
|
|
|
fi
|
2000-10-29 09:40:22 +00:00
|
|
|
|
2000-10-29 07:47:51 +00:00
|
|
|
echo " Use 'd' to delete the temporary ${COMPFILE}"
|
|
|
|
echo " Use 'i' to install the temporary ${COMPFILE}"
|
|
|
|
case "${NO_INSTALLED}" in
|
|
|
|
'')
|
2001-05-28 09:46:18 +00:00
|
|
|
echo " Use 'm' to merge the temporary and installed versions"
|
2003-01-28 18:44:40 +00:00
|
|
|
echo " Use 'v' to view the diff results again"
|
2000-10-29 07:47:51 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo ''
|
|
|
|
echo " Default is to leave the temporary file to deal with by hand"
|
|
|
|
echo ''
|
2000-10-29 09:40:22 +00:00
|
|
|
echo -n "How should I deal with this? [Leave it for later] "
|
|
|
|
read HANDLE_COMPFILE
|
|
|
|
|
2000-10-29 07:47:51 +00:00
|
|
|
case "${HANDLE_COMPFILE}" in
|
|
|
|
[dD])
|
|
|
|
rm "${COMPFILE}"
|
|
|
|
echo ''
|
|
|
|
echo " *** Deleting ${COMPFILE}"
|
|
|
|
;;
|
|
|
|
[iI])
|
|
|
|
echo ''
|
|
|
|
if mm_install "${COMPFILE}"; then
|
|
|
|
echo " *** ${COMPFILE} installed successfully"
|
|
|
|
else
|
|
|
|
echo " *** Problem installing ${COMPFILE}, it will remain to merge by hand"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
[mM])
|
|
|
|
case "${NO_INSTALLED}" in
|
|
|
|
'')
|
|
|
|
# interact with user to merge files
|
|
|
|
merge_loop
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo " *** There is no installed version of ${COMPFILE}"
|
|
|
|
echo ''
|
|
|
|
HANDLE_COMPFILE="NOT V"
|
|
|
|
;;
|
|
|
|
esac # End of "No installed version of file but user selected merge" test
|
|
|
|
;;
|
|
|
|
[vV])
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'')
|
|
|
|
echo ''
|
|
|
|
echo " *** ${COMPFILE} will remain for your consideration"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# invalid choice, show menu again.
|
|
|
|
echo "invalid choice: ${HANDLE_COMPFILE}"
|
|
|
|
echo ''
|
|
|
|
HANDLE_COMPFILE="NOT V"
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac # End of "How to handle files that are different"
|
2000-10-29 09:40:22 +00:00
|
|
|
done
|
2000-10-29 07:47:51 +00:00
|
|
|
unset NO_INSTALLED
|
|
|
|
echo ''
|
|
|
|
case "${VERBOSE}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
sleep 3
|
|
|
|
;;
|
|
|
|
esac
|
2000-04-02 02:47:15 +00:00
|
|
|
}
|
|
|
|
|
2002-06-06 20:38:22 +00:00
|
|
|
press_to_continue () {
|
|
|
|
local DISCARD
|
|
|
|
echo -n ' *** Press the [Enter] or [Return] key to continue '
|
|
|
|
read DISCARD
|
|
|
|
}
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
# Set the default path for the temporary root environment
|
|
|
|
#
|
|
|
|
TEMPROOT='/var/tmp/temproot'
|
|
|
|
|
2001-03-05 10:13:21 +00:00
|
|
|
# Read /etc/mergemaster.rc first so the one in $HOME can override
|
|
|
|
#
|
|
|
|
if [ -r /etc/mergemaster.rc ]; then
|
|
|
|
. /etc/mergemaster.rc
|
|
|
|
fi
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
# Read .mergemasterrc before command line so CLI can override
|
|
|
|
#
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
if [ -r "$HOME/.mergemasterrc" ]; then
|
1999-10-20 07:22:52 +00:00
|
|
|
. "$HOME/.mergemasterrc"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check the command line options
|
|
|
|
#
|
2009-03-18 21:51:11 +00:00
|
|
|
while getopts ":ascrvhipCPm:t:du:w:D:A:FU" COMMAND_LINE_ARGUMENT ; do
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${COMMAND_LINE_ARGUMENT}" in
|
2006-02-04 18:24:06 +00:00
|
|
|
A)
|
2009-01-01 11:41:13 +00:00
|
|
|
ARCHSTRING='TARGET_ARCH='${OPTARG}
|
2006-02-04 18:24:06 +00:00
|
|
|
;;
|
2009-03-18 21:51:11 +00:00
|
|
|
F)
|
|
|
|
FREEBSD_ID=yes
|
|
|
|
;;
|
2006-04-29 18:21:43 +00:00
|
|
|
U)
|
|
|
|
AUTO_UPGRADE=yes
|
|
|
|
;;
|
1999-10-20 07:22:52 +00:00
|
|
|
s)
|
|
|
|
STRICT=yes
|
2003-02-05 11:09:21 +00:00
|
|
|
unset DIFF_OPTIONS
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
c)
|
|
|
|
DIFF_FLAG='-c'
|
|
|
|
;;
|
|
|
|
r)
|
|
|
|
RERUN=yes
|
|
|
|
;;
|
|
|
|
v)
|
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'') VERBOSE=yes ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
a)
|
|
|
|
AUTO_RUN=yes
|
|
|
|
unset VERBOSE
|
|
|
|
;;
|
|
|
|
h)
|
|
|
|
display_usage
|
|
|
|
display_help
|
|
|
|
exit 0
|
|
|
|
;;
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
i)
|
|
|
|
AUTO_INSTALL=yes
|
|
|
|
;;
|
2002-02-24 10:22:14 +00:00
|
|
|
C)
|
|
|
|
COMP_CONFS=yes
|
|
|
|
;;
|
2003-05-02 06:26:23 +00:00
|
|
|
P)
|
|
|
|
PRESERVE_FILES=yes
|
|
|
|
;;
|
2002-05-04 22:45:12 +00:00
|
|
|
p)
|
|
|
|
PRE_WORLD=yes
|
|
|
|
unset COMP_CONFS
|
|
|
|
unset AUTO_RUN
|
|
|
|
;;
|
1999-10-20 07:22:52 +00:00
|
|
|
m)
|
|
|
|
SOURCEDIR=${OPTARG}
|
|
|
|
;;
|
|
|
|
t)
|
|
|
|
TEMPROOT=${OPTARG}
|
|
|
|
;;
|
|
|
|
d)
|
|
|
|
TEMPROOT=${TEMPROOT}.`date +%m%d.%H.%M`
|
|
|
|
;;
|
|
|
|
u)
|
|
|
|
NEW_UMASK=${OPTARG}
|
|
|
|
;;
|
|
|
|
w)
|
|
|
|
SCREEN_WIDTH=${OPTARG}
|
|
|
|
;;
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
D)
|
|
|
|
DESTDIR=${OPTARG}
|
|
|
|
;;
|
1999-10-20 07:22:52 +00:00
|
|
|
*)
|
|
|
|
display_usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2010-03-14 05:22:46 +00:00
|
|
|
if [ -n "$AUTO_RUN" ]; then
|
|
|
|
if [ -n "$FREEBSD_ID" -o -n "$AUTO_UPGRADE" -o -n "$AUTO_INSTALL" ]; then
|
|
|
|
echo ''
|
|
|
|
echo "*** You have included the -a option along with one or more options"
|
|
|
|
echo ' that indicate that you wish mergemaster to actually make updates'
|
|
|
|
echo ' (-F, -U, or -i), however these options are not compatible.'
|
|
|
|
echo ' Please read mergemaster(8) for more information.'
|
|
|
|
echo ''
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-01-22 17:17:47 +00:00
|
|
|
# Assign the location of the mtree database
|
|
|
|
#
|
|
|
|
MTREEDB=${MTREEDB:-${DESTDIR}/var/db}
|
|
|
|
MTREEFILE="${MTREEDB}/mergemaster.mtree"
|
|
|
|
|
2003-05-02 06:26:23 +00:00
|
|
|
# Don't force the user to set this in the mergemaster rc file
|
|
|
|
if [ -n "${PRESERVE_FILES}" -a -z "${PRESERVE_FILES_DIR}" ]; then
|
|
|
|
PRESERVE_FILES_DIR=/var/tmp/mergemaster/preserved-files-`date +%y%m%d-%H%M%S`
|
2009-12-12 02:19:41 +00:00
|
|
|
mkdir -p ${PRESERVE_FILES_DIR}
|
2003-05-02 06:26:23 +00:00
|
|
|
fi
|
|
|
|
|
2009-01-01 11:41:13 +00:00
|
|
|
# Check for the mtree database in DESTDIR
|
|
|
|
case "${AUTO_UPGRADE}" in
|
|
|
|
'') ;; # If the option is not set no need to run the test or warn the user
|
|
|
|
*)
|
2009-12-11 23:03:35 +00:00
|
|
|
if [ ! -s "${MTREEFILE}" ]; then
|
2009-01-01 11:41:13 +00:00
|
|
|
echo ''
|
2009-12-11 23:03:35 +00:00
|
|
|
echo "*** Unable to find mtree database (${MTREEFILE})."
|
|
|
|
echo " Skipping auto-upgrade on this run."
|
2009-06-09 20:20:08 +00:00
|
|
|
echo " It will be created for the next run when this one is complete."
|
2009-01-01 11:41:13 +00:00
|
|
|
echo ''
|
2009-12-30 23:14:03 +00:00
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
|
|
|
press_to_continue
|
|
|
|
;;
|
|
|
|
esac
|
2009-01-01 11:41:13 +00:00
|
|
|
unset AUTO_UPGRADE
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-01-02 00:37:59 +00:00
|
|
|
if [ -e "${DESTDIR}/etc/fstab" ]; then
|
|
|
|
if grep -q nodev ${DESTDIR}/etc/fstab; then
|
|
|
|
echo ''
|
|
|
|
echo "*** You have the deprecated 'nodev' option in ${DESTDIR}/etc/fstab."
|
|
|
|
echo " This can prevent the filesystem from being mounted on reboot."
|
|
|
|
echo " Please update your fstab before continuing."
|
|
|
|
echo " See fstab(5) for more information."
|
|
|
|
echo ''
|
|
|
|
exit 1
|
|
|
|
fi
|
2006-04-29 18:21:43 +00:00
|
|
|
fi
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
echo ''
|
|
|
|
|
|
|
|
# If the user has a pager defined, make sure we can run it
|
|
|
|
#
|
|
|
|
case "${DONT_CHECK_PAGER}" in
|
|
|
|
'')
|
2009-01-02 07:25:30 +00:00
|
|
|
check_pager () {
|
|
|
|
while ! type "${PAGER%% *}" >/dev/null; do
|
1999-10-20 07:22:52 +00:00
|
|
|
echo " *** Your PAGER environment variable specifies '${PAGER}', but"
|
2000-08-09 20:36:15 +00:00
|
|
|
echo " due to the limited PATH that I use for security reasons,"
|
2000-10-29 09:40:22 +00:00
|
|
|
echo " I cannot execute it. So, what would you like to do?"
|
1999-10-20 07:22:52 +00:00
|
|
|
echo ''
|
|
|
|
echo " Use 'e' to exit mergemaster and fix your PAGER variable"
|
2000-08-09 20:36:15 +00:00
|
|
|
if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then
|
|
|
|
echo " Use 'l' to set PAGER to 'less' for this run"
|
1999-10-20 07:22:52 +00:00
|
|
|
fi
|
|
|
|
echo " Use 'm' to use plain old 'more' as your PAGER for this run"
|
|
|
|
echo ''
|
|
|
|
echo " Default is to use plain old 'more' "
|
|
|
|
echo ''
|
2000-10-29 09:40:22 +00:00
|
|
|
echo -n "What should I do? [Use 'more'] "
|
|
|
|
read FIXPAGER
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${FIXPAGER}" in
|
2000-04-02 02:47:15 +00:00
|
|
|
[eE])
|
1999-10-20 07:22:52 +00:00
|
|
|
exit 0
|
|
|
|
;;
|
2000-04-02 02:47:15 +00:00
|
|
|
[lL])
|
2000-08-09 20:36:15 +00:00
|
|
|
if [ -x /usr/bin/less ]; then
|
|
|
|
PAGER=/usr/bin/less
|
|
|
|
elif [ -x /usr/local/bin/less ]; then
|
2000-04-02 02:47:15 +00:00
|
|
|
PAGER=/usr/local/bin/less
|
2000-08-09 20:36:15 +00:00
|
|
|
else
|
|
|
|
echo ''
|
|
|
|
echo " *** Fatal Error:"
|
|
|
|
echo " You asked to use 'less' as your pager, but I can't"
|
|
|
|
echo " find it in /usr/bin or /usr/local/bin"
|
|
|
|
exit 1
|
2000-04-02 02:47:15 +00:00
|
|
|
fi
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
2000-05-12 03:09:57 +00:00
|
|
|
[mM]|'')
|
1999-10-20 07:22:52 +00:00
|
|
|
PAGER=more
|
|
|
|
;;
|
2000-04-02 02:47:15 +00:00
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo "invalid choice: ${FIXPAGER}"
|
1999-10-20 07:22:52 +00:00
|
|
|
esac
|
|
|
|
echo ''
|
2000-04-02 02:47:15 +00:00
|
|
|
done
|
2009-01-02 07:25:30 +00:00
|
|
|
}
|
|
|
|
if [ -n "${PAGER}" ]; then
|
|
|
|
check_pager
|
|
|
|
fi
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# If user has a pager defined, or got assigned one above, use it.
|
|
|
|
# If not, use more.
|
|
|
|
#
|
|
|
|
PAGER=${PAGER:-more}
|
|
|
|
|
|
|
|
if [ -n "${VERBOSE}" -a ! "${PAGER}" = "more" ]; then
|
|
|
|
echo " *** You have ${PAGER} defined as your pager so we will use that"
|
|
|
|
echo ''
|
|
|
|
sleep 3
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Assign the diff flag once so we will not have to keep testing it
|
|
|
|
#
|
|
|
|
DIFF_FLAG=${DIFF_FLAG:--u}
|
|
|
|
|
|
|
|
# Assign the source directory
|
|
|
|
#
|
2009-01-01 11:41:13 +00:00
|
|
|
SOURCEDIR=${SOURCEDIR:-/usr/src}
|
|
|
|
if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \
|
|
|
|
-f ${SOURCEDIR}/../Makefile.inc1 ]; then
|
|
|
|
echo " *** The source directory you specified (${SOURCEDIR})"
|
|
|
|
echo " will be reset to ${SOURCEDIR}/.."
|
|
|
|
echo ''
|
|
|
|
sleep 3
|
|
|
|
SOURCEDIR=${SOURCEDIR}/..
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Setup make to use system files from SOURCEDIR
|
2009-01-02 07:25:30 +00:00
|
|
|
MM_MAKE="make ${ARCHSTRING} -m ${SOURCEDIR}/share/mk"
|
1999-10-20 07:22:52 +00:00
|
|
|
|
2006-04-29 18:21:43 +00:00
|
|
|
# Check DESTDIR against the mergemaster mtree database to see what
|
|
|
|
# files the user changed from the reference files.
|
|
|
|
#
|
2009-12-11 23:03:35 +00:00
|
|
|
if [ -n "${AUTO_UPGRADE}" -a -s "${MTREEFILE}" ]; then
|
2009-05-16 22:22:31 +00:00
|
|
|
CHANGED=:
|
2009-12-11 23:03:35 +00:00
|
|
|
for file in `mtree -eqL -f ${MTREEFILE} -p ${DESTDIR}/ \
|
2006-04-29 18:21:43 +00:00
|
|
|
2>/dev/null | awk '($2 == "changed") {print $1}'`; do
|
|
|
|
if [ -f "${DESTDIR}/$file" ]; then
|
2009-05-16 22:22:31 +00:00
|
|
|
CHANGED="${CHANGED}${DESTDIR}/${file}:"
|
2006-04-29 18:21:43 +00:00
|
|
|
fi
|
|
|
|
done
|
2009-05-16 22:22:31 +00:00
|
|
|
[ "$CHANGED" = ':' ] && unset CHANGED
|
2006-04-29 18:21:43 +00:00
|
|
|
fi
|
|
|
|
|
2002-05-04 22:45:12 +00:00
|
|
|
# Check the width of the user's terminal
|
|
|
|
#
|
|
|
|
if [ -t 0 ]; then
|
2003-02-05 11:09:21 +00:00
|
|
|
w=`tput columns`
|
2002-05-04 22:45:12 +00:00
|
|
|
case "${w}" in
|
|
|
|
0|'') ;; # No-op, since the input is not valid
|
|
|
|
*)
|
|
|
|
case "${SCREEN_WIDTH}" in
|
|
|
|
'') SCREEN_WIDTH="${w}" ;;
|
|
|
|
"${w}") ;; # No-op, since they are the same
|
|
|
|
*)
|
|
|
|
echo -n "*** You entered ${SCREEN_WIDTH} as your screen width, but stty "
|
|
|
|
echo "thinks it is ${w}."
|
|
|
|
echo ''
|
|
|
|
echo -n "What would you like to use? [${w}] "
|
|
|
|
read SCREEN_WIDTH
|
2002-05-28 07:25:44 +00:00
|
|
|
case "${SCREEN_WIDTH}" in
|
|
|
|
'') SCREEN_WIDTH="${w}" ;;
|
|
|
|
esac
|
2002-05-04 22:45:12 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2001-03-05 10:13:21 +00:00
|
|
|
# Define what CVS $Id tag to look for to aid portability.
|
|
|
|
#
|
|
|
|
CVS_ID_TAG=FreeBSD
|
|
|
|
|
2002-06-30 18:47:57 +00:00
|
|
|
delete_temproot () {
|
2002-08-05 08:47:52 +00:00
|
|
|
rm -rf "${TEMPROOT}" 2>/dev/null
|
|
|
|
chflags -R 0 "${TEMPROOT}" 2>/dev/null
|
2010-01-08 00:05:10 +00:00
|
|
|
rm -rf "${TEMPROOT}" || { echo "*** Unable to delete ${TEMPROOT}"; exit 1; }
|
2002-06-30 18:47:57 +00:00
|
|
|
}
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${RERUN}" in
|
|
|
|
'')
|
|
|
|
# Set up the loop to test for the existence of the
|
|
|
|
# temp root directory.
|
|
|
|
#
|
|
|
|
TEST_TEMP_ROOT=yes
|
|
|
|
while [ "${TEST_TEMP_ROOT}" = "yes" ]; do
|
|
|
|
if [ -d "${TEMPROOT}" ]; then
|
|
|
|
echo "*** The directory specified for the temporary root environment,"
|
2000-10-29 09:40:22 +00:00
|
|
|
echo " ${TEMPROOT}, exists. This can be a security risk if untrusted"
|
1999-10-20 07:22:52 +00:00
|
|
|
echo " users have access to the system."
|
|
|
|
echo ''
|
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
|
|
|
echo " Use 'd' to delete the old ${TEMPROOT} and continue"
|
|
|
|
echo " Use 't' to select a new temporary root directory"
|
|
|
|
echo " Use 'e' to exit mergemaster"
|
|
|
|
echo ''
|
|
|
|
echo " Default is to use ${TEMPROOT} as is"
|
|
|
|
echo ''
|
2000-10-29 09:40:22 +00:00
|
|
|
echo -n "How should I deal with this? [Use the existing ${TEMPROOT}] "
|
|
|
|
read DELORNOT
|
|
|
|
|
|
|
|
case "${DELORNOT}" in
|
|
|
|
[dD])
|
|
|
|
echo ''
|
|
|
|
echo " *** Deleting the old ${TEMPROOT}"
|
|
|
|
echo ''
|
2010-01-08 00:05:10 +00:00
|
|
|
delete_temproot
|
2000-10-29 09:40:22 +00:00
|
|
|
unset TEST_TEMP_ROOT
|
|
|
|
;;
|
|
|
|
[tT])
|
|
|
|
echo " *** Enter new directory name for temporary root environment"
|
|
|
|
read TEMPROOT
|
|
|
|
;;
|
|
|
|
[eE])
|
|
|
|
exit 0
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
2000-10-29 09:40:22 +00:00
|
|
|
'')
|
|
|
|
echo ''
|
|
|
|
echo " *** Leaving ${TEMPROOT} intact"
|
|
|
|
echo ''
|
|
|
|
unset TEST_TEMP_ROOT
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo "invalid choice: ${DELORNOT}"
|
|
|
|
echo ''
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
1999-10-20 07:22:52 +00:00
|
|
|
*)
|
2001-05-28 09:07:27 +00:00
|
|
|
# If this is an auto-run, try a hopefully safe alternative then
|
|
|
|
# re-test anyway.
|
1999-10-20 07:22:52 +00:00
|
|
|
TEMPROOT=/var/tmp/temproot.`date +%m%d.%H.%M.%S`
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
unset TEST_TEMP_ROOT
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "*** Creating the temporary root environment in ${TEMPROOT}"
|
|
|
|
|
|
|
|
if mkdir -p "${TEMPROOT}"; then
|
|
|
|
echo " *** ${TEMPROOT} ready for use"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "${TEMPROOT}" ]; then
|
|
|
|
echo ''
|
|
|
|
echo " *** FATAL ERROR: Cannot create ${TEMPROOT}"
|
|
|
|
echo ''
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo " *** Creating and populating directory structure in ${TEMPROOT}"
|
|
|
|
echo ''
|
|
|
|
|
|
|
|
case "${VERBOSE}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
2002-06-06 20:38:22 +00:00
|
|
|
press_to_continue
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2002-02-24 10:22:14 +00:00
|
|
|
case "${PRE_WORLD}" in
|
|
|
|
'')
|
|
|
|
{ cd ${SOURCEDIR} &&
|
|
|
|
case "${DESTDIR}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
2010-05-14 19:12:06 +00:00
|
|
|
${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs >/dev/null
|
2002-02-24 10:22:14 +00:00
|
|
|
;;
|
|
|
|
esac
|
2009-01-04 20:59:23 +00:00
|
|
|
od=${TEMPROOT}/usr/obj
|
2010-05-14 19:12:06 +00:00
|
|
|
${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs >/dev/null &&
|
|
|
|
MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc >/dev/null &&
|
|
|
|
MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc >/dev/null &&
|
|
|
|
MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution >/dev/null;} ||
|
2002-02-24 10:22:14 +00:00
|
|
|
{ echo '';
|
|
|
|
echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to";
|
|
|
|
echo " the temproot environment";
|
|
|
|
echo '';
|
|
|
|
exit 1;}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# Only set up files that are crucial to {build|install}world
|
|
|
|
{ mkdir -p ${TEMPROOT}/etc &&
|
2009-01-01 11:41:13 +00:00
|
|
|
cp -p ${SOURCEDIR}/etc/master.passwd ${TEMPROOT}/etc &&
|
|
|
|
cp -p ${SOURCEDIR}/etc/group ${TEMPROOT}/etc;} ||
|
2002-02-24 10:22:14 +00:00
|
|
|
{ echo '';
|
|
|
|
echo ' *** FATAL ERROR: Cannot copy files to the temproot environment';
|
|
|
|
echo '';
|
|
|
|
exit 1;}
|
|
|
|
;;
|
|
|
|
esac
|
1999-10-20 07:22:52 +00:00
|
|
|
|
2001-05-28 09:07:27 +00:00
|
|
|
# Doing the inventory and removing files that we don't want to compare only
|
|
|
|
# makes sense if we are not doing a rerun, since we have no way of knowing
|
|
|
|
# what happened to the files during previous incarnations.
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
case "${VERBOSE}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo ' *** The following files exist only in the installed version of'
|
|
|
|
echo " ${DESTDIR}/etc. In the vast majority of cases these files"
|
|
|
|
echo ' are necessary parts of the system and should not be deleted.'
|
|
|
|
echo ' However because these files are not updated by this process you'
|
|
|
|
echo ' might want to verify their status before rebooting your system.'
|
|
|
|
echo ''
|
2002-06-06 20:38:22 +00:00
|
|
|
press_to_continue
|
2002-08-05 01:03:12 +00:00
|
|
|
diff -qr ${DESTDIR}/etc ${TEMPROOT}/etc | grep "^Only in ${DESTDIR}/etc" | ${PAGER}
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
echo ''
|
2002-06-06 20:38:22 +00:00
|
|
|
press_to_continue
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1999-10-26 19:06:31 +00:00
|
|
|
case "${IGNORE_MOTD}" in
|
2010-01-15 04:09:22 +00:00
|
|
|
'') ;;
|
2010-01-15 03:56:48 +00:00
|
|
|
*)
|
2009-01-01 11:41:13 +00:00
|
|
|
echo ''
|
|
|
|
echo "*** You have the IGNORE_MOTD option set in your mergemaster rc file."
|
|
|
|
echo " This option is deprecated in favor of the IGNORE_FILES option."
|
|
|
|
echo " Please update your rc file accordingly."
|
|
|
|
echo ''
|
2010-01-15 03:56:48 +00:00
|
|
|
exit 1
|
1999-10-26 19:06:31 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-01-01 11:41:13 +00:00
|
|
|
# Avoid comparing the following user specified files
|
|
|
|
for file in ${IGNORE_FILES}; do
|
2009-01-02 00:02:14 +00:00
|
|
|
test -e ${TEMPROOT}/${file} && unlink ${TEMPROOT}/${file}
|
2009-01-01 11:41:13 +00:00
|
|
|
done
|
1999-10-20 07:22:52 +00:00
|
|
|
|
2009-12-30 23:14:03 +00:00
|
|
|
# We really don't want to have to deal with files like login.conf.db, pwd.db,
|
|
|
|
# or spwd.db. Instead, we want to compare the text versions, and run *_mkdb.
|
|
|
|
# Prompt the user to do so below, as needed.
|
|
|
|
#
|
|
|
|
rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd
|
2001-05-30 08:50:10 +00:00
|
|
|
|
2009-12-30 23:14:03 +00:00
|
|
|
# We only need to compare things like freebsd.cf once
|
|
|
|
find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null
|
2002-04-08 10:30:44 +00:00
|
|
|
|
2009-12-30 23:14:03 +00:00
|
|
|
# Delete stuff we do not need to keep the mtree database small,
|
|
|
|
# and to make the actual comparison faster.
|
|
|
|
find ${TEMPROOT}/usr -type l -delete 2>/dev/null
|
|
|
|
find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null
|
|
|
|
find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null
|
2006-04-29 18:21:43 +00:00
|
|
|
|
2009-12-30 23:14:03 +00:00
|
|
|
# Build the mtree database in a temporary location.
|
|
|
|
case "${PRE_WORLD}" in
|
2009-12-31 04:07:13 +00:00
|
|
|
'') MTREENEW=`mktemp -t mergemaster.mtree`
|
|
|
|
mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null
|
2009-12-30 23:14:03 +00:00
|
|
|
;;
|
|
|
|
*) # We don't want to mess with the mtree database on a pre-world run or
|
|
|
|
# when re-scanning a previously-built tree.
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;; # End of the "RERUN" test
|
2006-04-29 18:21:43 +00:00
|
|
|
esac
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
# Get ready to start comparing files
|
|
|
|
|
2002-06-10 07:16:42 +00:00
|
|
|
# Check umask if not specified on the command line,
|
|
|
|
# and we are not doing an autorun
|
1999-10-20 07:22:52 +00:00
|
|
|
#
|
2002-06-10 07:16:42 +00:00
|
|
|
if [ -z "${NEW_UMASK}" -a -z "${AUTO_RUN}" ]; then
|
|
|
|
USER_UMASK=`umask`
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${USER_UMASK}" in
|
2001-05-28 13:17:20 +00:00
|
|
|
0022|022) ;;
|
1999-10-20 07:22:52 +00:00
|
|
|
*)
|
|
|
|
echo ''
|
2002-06-10 07:16:42 +00:00
|
|
|
echo " *** Your umask is currently set to ${USER_UMASK}. By default, this script"
|
|
|
|
echo " installs all files with the same user, group and modes that"
|
2009-01-01 11:41:13 +00:00
|
|
|
echo " they are created with by ${SOURCEDIR}/etc/Makefile, compared to"
|
2002-06-10 07:16:42 +00:00
|
|
|
echo " a umask of 022. This umask allows world read permission when"
|
|
|
|
echo " the file's default permissions have it."
|
1999-10-20 07:22:52 +00:00
|
|
|
echo ''
|
2002-06-10 07:16:42 +00:00
|
|
|
echo " No world permissions can sometimes cause problems. A umask of"
|
|
|
|
echo " 022 will restore the default behavior, but is not mandatory."
|
|
|
|
echo " /etc/master.passwd is a special case. Its file permissions"
|
|
|
|
echo " will be 600 (rw-------) if installed."
|
2002-06-06 20:38:22 +00:00
|
|
|
echo ''
|
2002-06-10 07:16:42 +00:00
|
|
|
echo -n "What umask should I use? [${USER_UMASK}] "
|
|
|
|
read NEW_UMASK
|
|
|
|
|
|
|
|
NEW_UMASK="${NEW_UMASK:-$USER_UMASK}"
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo ''
|
2002-06-10 07:16:42 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
CONFIRMED_UMASK=${NEW_UMASK:-0022}
|
1999-10-20 07:22:52 +00:00
|
|
|
|
|
|
|
#
|
2003-05-02 06:26:23 +00:00
|
|
|
# Warn users who still have old rc files
|
|
|
|
#
|
2008-05-26 10:40:09 +00:00
|
|
|
for file in atm devfs diskless1 diskless2 network network6 pccard \
|
2003-05-02 11:07:58 +00:00
|
|
|
serial syscons sysctl alpha amd64 i386 ia64 sparc64; do
|
2003-05-02 06:26:23 +00:00
|
|
|
if [ -f "${DESTDIR}/etc/rc.${file}" ]; then
|
|
|
|
OLD_RC_PRESENT=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
case "${OLD_RC_PRESENT}" in
|
|
|
|
1)
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
echo ''
|
2003-05-02 06:26:23 +00:00
|
|
|
echo " *** There are elements of the old rc system in ${DESTDIR}/etc/."
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
echo ''
|
2003-05-02 06:26:23 +00:00
|
|
|
echo ' While these scripts will not hurt anything, they are not'
|
|
|
|
echo ' functional on an up to date system, and can be removed.'
|
1999-10-20 07:22:52 +00:00
|
|
|
echo ''
|
2003-05-02 06:26:23 +00:00
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
2003-05-02 06:26:23 +00:00
|
|
|
echo -n 'Move these files to /var/tmp/mergemaster/old_rc? [yes] '
|
|
|
|
read MOVE_OLD_RC
|
2000-10-29 09:40:22 +00:00
|
|
|
|
2003-05-02 06:26:23 +00:00
|
|
|
case "${MOVE_OLD_RC}" in
|
|
|
|
[nN]*) ;;
|
1999-10-20 07:22:52 +00:00
|
|
|
*)
|
2003-05-02 06:26:23 +00:00
|
|
|
mkdir -p /var/tmp/mergemaster/old_rc
|
2008-05-26 10:40:09 +00:00
|
|
|
for file in atm devfs diskless1 diskless2 network network6 pccard \
|
2003-05-02 11:07:58 +00:00
|
|
|
serial syscons sysctl alpha amd64 i386 ia64 sparc64; do
|
2003-05-02 06:26:23 +00:00
|
|
|
if [ -f "${DESTDIR}/etc/rc.${file}" ]; then
|
|
|
|
mv ${DESTDIR}/etc/rc.${file} /var/tmp/mergemaster/old_rc/
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo ' The files have been moved'
|
|
|
|
press_to_continue
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
2003-05-02 06:26:23 +00:00
|
|
|
esac
|
1999-10-20 07:22:52 +00:00
|
|
|
|
2002-06-10 07:16:42 +00:00
|
|
|
# Use the umask/mode information to install the files
|
1999-10-20 07:22:52 +00:00
|
|
|
# Create directories as needed
|
|
|
|
#
|
2009-01-01 11:41:13 +00:00
|
|
|
install_error () {
|
|
|
|
echo "*** FATAL ERROR: Unable to install ${1} to ${2}"
|
|
|
|
echo ''
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2001-06-20 07:15:38 +00:00
|
|
|
do_install_and_rm () {
|
2003-05-02 06:26:23 +00:00
|
|
|
case "${PRESERVE_FILES}" in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
if [ -f "${3}/${2##*/}" ]; then
|
2003-05-03 06:35:19 +00:00
|
|
|
mkdir -p ${PRESERVE_FILES_DIR}/${2%/*}
|
|
|
|
cp ${3}/${2##*/} ${PRESERVE_FILES_DIR}/${2%/*}
|
2003-05-02 06:26:23 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-01-01 11:41:13 +00:00
|
|
|
if [ ! -d "${3}/${2##*/}" ]; then
|
|
|
|
if install -m ${1} ${2} ${3}; then
|
|
|
|
unlink ${2}
|
|
|
|
else
|
|
|
|
install_error ${2} ${3}
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
install_error ${2} ${3}
|
|
|
|
fi
|
2001-06-20 07:15:38 +00:00
|
|
|
}
|
|
|
|
|
2002-06-10 07:16:42 +00:00
|
|
|
# 4095 = "obase=10;ibase=8;07777" | bc
|
|
|
|
find_mode () {
|
|
|
|
local OCTAL
|
|
|
|
OCTAL=$(( ~$(echo "obase=10; ibase=8; ${CONFIRMED_UMASK}" | bc) & 4095 &
|
2004-01-01 23:41:37 +00:00
|
|
|
$(echo "obase=10; ibase=8; $(stat -f "%OMp%OLp" ${1})" | bc) ))
|
2002-06-10 07:16:42 +00:00
|
|
|
printf "%04o\n" ${OCTAL}
|
|
|
|
}
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
mm_install () {
|
|
|
|
local INSTALL_DIR
|
|
|
|
INSTALL_DIR=${1#.}
|
|
|
|
INSTALL_DIR=${INSTALL_DIR%/*}
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${INSTALL_DIR}" in
|
|
|
|
'')
|
|
|
|
INSTALL_DIR=/
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
if [ -n "${DESTDIR}${INSTALL_DIR}" -a ! -d "${DESTDIR}${INSTALL_DIR}" ]; then
|
2002-06-10 07:16:42 +00:00
|
|
|
DIR_MODE=`find_mode "${TEMPROOT}/${INSTALL_DIR}"`
|
2009-12-12 02:19:41 +00:00
|
|
|
install -d -o root -g wheel -m "${DIR_MODE}" "${DESTDIR}${INSTALL_DIR}" ||
|
|
|
|
install_error $1 ${DESTDIR}${INSTALL_DIR}
|
1999-10-20 07:22:52 +00:00
|
|
|
fi
|
|
|
|
|
2002-06-10 07:16:42 +00:00
|
|
|
FILE_MODE=`find_mode "${1}"`
|
1999-10-20 07:22:52 +00:00
|
|
|
|
|
|
|
if [ ! -x "${1}" ]; then
|
|
|
|
case "${1#.}" in
|
2000-08-13 19:32:19 +00:00
|
|
|
/etc/mail/aliases)
|
1999-10-20 07:22:52 +00:00
|
|
|
NEED_NEWALIASES=yes
|
|
|
|
;;
|
|
|
|
/etc/login.conf)
|
|
|
|
NEED_CAP_MKDB=yes
|
|
|
|
;;
|
2010-05-04 11:25:04 +00:00
|
|
|
/etc/services)
|
|
|
|
NEED_SERVICES_MKDB=yes
|
|
|
|
;;
|
1999-10-20 07:22:52 +00:00
|
|
|
/etc/master.passwd)
|
2001-06-20 07:15:38 +00:00
|
|
|
do_install_and_rm 600 "${1}" "${DESTDIR}${INSTALL_DIR}"
|
1999-10-20 07:22:52 +00:00
|
|
|
NEED_PWD_MKDB=yes
|
|
|
|
DONT_INSTALL=yes
|
|
|
|
;;
|
|
|
|
/.cshrc | /.profile)
|
2009-12-19 05:20:26 +00:00
|
|
|
local st_nlink
|
|
|
|
|
|
|
|
# install will unlink the file before it installs the new one,
|
|
|
|
# so we have to restore/create the link afterwards.
|
|
|
|
#
|
|
|
|
st_nlink=0 # In case the file does not yet exist
|
|
|
|
eval $(stat -s ${DESTDIR}${COMPFILE#.} 2>/dev/null)
|
|
|
|
|
|
|
|
do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}"
|
|
|
|
|
|
|
|
if [ -n "${AUTO_INSTALL}" -a $st_nlink -gt 1 ]; then
|
|
|
|
HANDLE_LINK=l
|
|
|
|
else
|
2009-12-19 01:32:34 +00:00
|
|
|
case "${LINK_EXPLAINED}" in
|
|
|
|
'')
|
|
|
|
echo " *** Historically BSD derived systems have had a"
|
|
|
|
echo " hard link from /.cshrc and /.profile to"
|
|
|
|
echo " their namesakes in /root. Please indicate"
|
|
|
|
echo " your preference below for bringing your"
|
|
|
|
echo " installed files up to date."
|
|
|
|
echo ''
|
|
|
|
LINK_EXPLAINED=yes
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo " Use 'd' to delete the temporary ${COMPFILE}"
|
2009-12-19 05:20:26 +00:00
|
|
|
echo " Use 'l' to delete the existing ${DESTDIR}/root/${COMPFILE##*/} and create the link"
|
2009-12-19 01:32:34 +00:00
|
|
|
echo ''
|
|
|
|
echo " Default is to leave the temporary file to deal with by hand"
|
1999-10-20 07:22:52 +00:00
|
|
|
echo ''
|
2009-12-19 01:32:34 +00:00
|
|
|
echo -n " How should I handle ${COMPFILE}? [Leave it to install later] "
|
|
|
|
read HANDLE_LINK
|
2009-12-19 05:20:26 +00:00
|
|
|
fi
|
1999-10-20 07:22:52 +00:00
|
|
|
|
|
|
|
case "${HANDLE_LINK}" in
|
|
|
|
[dD]*)
|
|
|
|
rm "${COMPFILE}"
|
|
|
|
echo ''
|
|
|
|
echo " *** Deleting ${COMPFILE}"
|
|
|
|
;;
|
|
|
|
[lL]*)
|
|
|
|
echo ''
|
2009-12-19 05:20:26 +00:00
|
|
|
unlink ${DESTDIR}/root/${COMPFILE##*/}
|
|
|
|
if ln ${DESTDIR}${COMPFILE#.} ${DESTDIR}/root/${COMPFILE##*/}; then
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
echo " *** Link from ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/} installed successfully"
|
1999-10-20 07:22:52 +00:00
|
|
|
else
|
2009-12-19 05:20:26 +00:00
|
|
|
echo " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}"
|
|
|
|
echo " *** ${COMPFILE} will remain for your consideration"
|
1999-10-20 07:22:52 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo " *** ${COMPFILE} will remain for your consideration"
|
|
|
|
;;
|
|
|
|
esac
|
2009-12-19 05:20:26 +00:00
|
|
|
return
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "${DONT_INSTALL}" in
|
|
|
|
'')
|
2001-06-20 07:15:38 +00:00
|
|
|
do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}"
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
unset DONT_INSTALL
|
|
|
|
;;
|
|
|
|
esac
|
2001-06-20 07:15:38 +00:00
|
|
|
else # File matched -x
|
|
|
|
do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}"
|
1999-10-20 07:22:52 +00:00
|
|
|
fi
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2007-12-21 19:34:26 +00:00
|
|
|
if [ ! -d "${TEMPROOT}" ]; then
|
|
|
|
echo "*** FATAL ERROR: The temproot directory (${TEMPROOT})"
|
|
|
|
echo ' has disappeared!'
|
|
|
|
echo ''
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
echo ''
|
|
|
|
echo "*** Beginning comparison"
|
|
|
|
echo ''
|
|
|
|
|
2004-01-04 22:02:04 +00:00
|
|
|
# Pre-world does not populate /etc/rc.d.
|
2004-01-01 23:41:37 +00:00
|
|
|
# It is very possible that a previous run would have deleted files in
|
|
|
|
# ${TEMPROOT}/etc/rc.d, thus creating a lot of false positives.
|
2004-01-04 22:02:04 +00:00
|
|
|
if [ -z "${PRE_WORLD}" -a -z "${RERUN}" ]; then
|
2004-01-01 23:41:37 +00:00
|
|
|
echo " *** Checking ${DESTDIR}/etc/rc.d for stale files"
|
|
|
|
echo ''
|
|
|
|
cd "${DESTDIR}/etc/rc.d" &&
|
|
|
|
for file in *; do
|
|
|
|
if [ ! -e "${TEMPROOT}/etc/rc.d/${file}" ]; then
|
|
|
|
STALE_RC_FILES="${STALE_RC_FILES} ${file}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
case "${STALE_RC_FILES}" in
|
2004-03-07 10:10:19 +00:00
|
|
|
''|' *')
|
2004-01-01 23:41:37 +00:00
|
|
|
echo ' *** No stale files found'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo " *** The following files exist in ${DESTDIR}/etc/rc.d but not in"
|
|
|
|
echo " ${TEMPROOT}/etc/rc.d/:"
|
|
|
|
echo ''
|
|
|
|
echo "${STALE_RC_FILES}"
|
|
|
|
echo ''
|
|
|
|
echo ' The presence of stale files in this directory can cause the'
|
|
|
|
echo ' dreaded unpredictable results, and therefore it is highly'
|
|
|
|
echo ' recommended that you delete them.'
|
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
|
|
|
echo ''
|
2005-12-21 08:59:22 +00:00
|
|
|
echo -n ' *** Delete them now? [n] '
|
2004-01-01 23:41:37 +00:00
|
|
|
read DELETE_STALE_RC_FILES
|
|
|
|
case "${DELETE_STALE_RC_FILES}" in
|
2005-12-21 08:59:22 +00:00
|
|
|
[yY])
|
2004-01-01 23:41:37 +00:00
|
|
|
echo ' *** Deleting ... '
|
|
|
|
rm ${STALE_RC_FILES}
|
|
|
|
echo ' done.'
|
|
|
|
;;
|
2005-12-21 08:59:22 +00:00
|
|
|
*)
|
|
|
|
echo ' *** Files will not be deleted'
|
|
|
|
;;
|
2004-01-01 23:41:37 +00:00
|
|
|
esac
|
|
|
|
sleep 2
|
|
|
|
;;
|
2009-12-30 23:14:03 +00:00
|
|
|
*)
|
|
|
|
if [ -n "${DELETE_STALE_RC_FILES}" ]; then
|
|
|
|
echo ' *** Deleting ... '
|
|
|
|
rm ${STALE_RC_FILES}
|
|
|
|
echo ' done.'
|
|
|
|
fi
|
2004-01-01 23:41:37 +00:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo ''
|
2004-01-04 22:02:04 +00:00
|
|
|
fi
|
2004-01-01 23:41:37 +00:00
|
|
|
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
cd "${TEMPROOT}"
|
|
|
|
|
|
|
|
if [ -r "${MM_PRE_COMPARE_SCRIPT}" ]; then
|
|
|
|
. "${MM_PRE_COMPARE_SCRIPT}"
|
|
|
|
fi
|
1999-10-20 07:22:52 +00:00
|
|
|
|
2009-12-12 02:19:41 +00:00
|
|
|
# Things that were files/directories/links in one version can sometimes
|
|
|
|
# change to something else in a newer version. So we need to explicitly
|
|
|
|
# test for this, and warn the user if what we find does not match.
|
|
|
|
#
|
2009-12-19 01:30:45 +00:00
|
|
|
for COMPFILE in `find . | sort` ; do
|
2009-12-12 02:19:41 +00:00
|
|
|
if [ -e "${DESTDIR}${COMPFILE#.}" ]; then
|
|
|
|
INSTALLED_TYPE=`stat -f '%HT' ${DESTDIR}${COMPFILE#.}`
|
|
|
|
else
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
TEMPROOT_TYPE=`stat -f '%HT' $COMPFILE`
|
|
|
|
|
|
|
|
if [ ! "$TEMPROOT_TYPE" = "$INSTALLED_TYPE" ]; then
|
|
|
|
[ "$COMPFILE" = '.' ] && continue
|
|
|
|
TEMPROOT_TYPE=`echo $TEMPROOT_TYPE | tr [:upper:] [:lower:]`
|
|
|
|
INSTALLED_TYPE=`echo $INSTALLED_TYPE | tr [:upper:] [:lower:]`
|
|
|
|
|
|
|
|
echo "*** The installed file ${DESTDIR}${COMPFILE#.} has the type \"$INSTALLED_TYPE\""
|
|
|
|
echo " but the new version has the type \"$TEMPROOT_TYPE\""
|
|
|
|
echo ''
|
|
|
|
echo " How would you like to handle this?"
|
|
|
|
echo ''
|
|
|
|
echo " Use 'r' to remove ${DESTDIR}${COMPFILE#.}"
|
|
|
|
case "$TEMPROOT_TYPE" in
|
|
|
|
'symbolic link')
|
|
|
|
TARGET=`readlink $COMPFILE`
|
|
|
|
echo " and create a link to $TARGET in its place" ;;
|
|
|
|
*) echo " You will be able to install it as a \"$TEMPROOT_TYPE\"" ;;
|
|
|
|
esac
|
|
|
|
echo ''
|
|
|
|
echo " Use 'i' to ignore this"
|
|
|
|
echo ''
|
|
|
|
echo -n " How to proceed? [i] "
|
|
|
|
read ANSWER
|
|
|
|
case "$ANSWER" in
|
|
|
|
[rR]) case "${PRESERVE_FILES}" in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
mv ${DESTDIR}${COMPFILE#.} ${PRESERVE_FILES_DIR}/ || exit 1 ;;
|
|
|
|
*) rm -rf ${DESTDIR}${COMPFILE#.} ;;
|
|
|
|
esac
|
|
|
|
case "$TEMPROOT_TYPE" in
|
|
|
|
'symbolic link') ln -sf $TARGET ${DESTDIR}${COMPFILE#.} ;;
|
|
|
|
esac ;;
|
|
|
|
*) echo ''
|
|
|
|
echo "*** See the man page about adding ${COMPFILE#.} to the list of IGNORE_FILES"
|
|
|
|
press_to_continue ;;
|
|
|
|
esac
|
|
|
|
echo ''
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2009-12-19 01:30:45 +00:00
|
|
|
for COMPFILE in `find . -type f | sort`; do
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
|
|
|
|
# First, check to see if the file exists in DESTDIR. If not, the
|
|
|
|
# diff_loop function knows how to handle it.
|
|
|
|
#
|
|
|
|
if [ ! -e "${DESTDIR}${COMPFILE#.}" ]; then
|
2001-05-28 09:35:30 +00:00
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
|
|
|
diff_loop
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
case "${AUTO_INSTALL}" in
|
|
|
|
'')
|
|
|
|
# If this is an auto run, make it official
|
|
|
|
echo " *** ${COMPFILE} will remain for your consideration"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
diff_loop
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac # Auto run test
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${STRICT}" in
|
|
|
|
'' | [Nn][Oo])
|
|
|
|
# Compare CVS $Id's first so if the file hasn't been modified
|
|
|
|
# local changes will be ignored.
|
|
|
|
# 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.
|
|
|
|
#
|
2001-03-05 10:13:21 +00:00
|
|
|
CVSID1=`grep "[$]${CVS_ID_TAG}:" ${DESTDIR}${COMPFILE#.} 2>/dev/null`
|
2002-02-12 09:54:56 +00:00
|
|
|
CVSID2=`grep "[$]${CVS_ID_TAG}:" ${COMPFILE} 2>/dev/null` || CVSID2=none
|
1999-10-20 07:22:52 +00:00
|
|
|
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
case "${CVSID2}" in
|
2001-03-05 10:13:21 +00:00
|
|
|
"${CVSID1}")
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
echo " *** Temp ${COMPFILE} and installed have the same CVS Id, deleting"
|
|
|
|
rm "${COMPFILE}"
|
|
|
|
;;
|
|
|
|
esac
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# If the file is still here either because the $Ids are different, the
|
|
|
|
# file doesn't have an $Id, or we're using STRICT mode; look at the diff.
|
|
|
|
#
|
|
|
|
if [ -f "${COMPFILE}" ]; then
|
|
|
|
|
|
|
|
# Do an absolute diff first to see if the files are actually different.
|
|
|
|
# If they're not different, delete the one in temproot.
|
|
|
|
#
|
2003-02-05 11:09:21 +00:00
|
|
|
if diff -q ${DIFF_OPTIONS} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \
|
|
|
|
/dev/null 2>&1; then
|
1999-10-20 07:22:52 +00:00
|
|
|
echo " *** Temp ${COMPFILE} and installed are the same, deleting"
|
|
|
|
rm "${COMPFILE}"
|
|
|
|
else
|
2001-05-28 09:07:27 +00:00
|
|
|
# Ok, the files are different, so show the user where they differ.
|
|
|
|
# Use user's choice of diff methods; and user's pager if they have one.
|
|
|
|
# Use more if not.
|
2000-10-29 09:40:22 +00:00
|
|
|
# Use unified diffs by default. Context diffs give me a headache. :)
|
1999-10-20 07:22:52 +00:00
|
|
|
#
|
2009-03-18 21:51:11 +00:00
|
|
|
# If the user chose the -F option, test for that before proceeding
|
|
|
|
#
|
|
|
|
if [ -n "$FREEBSD_ID" ]; then
|
2009-12-30 23:14:03 +00:00
|
|
|
if diff -q -I'[$]FreeBSD.*[$]' "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \
|
2009-03-18 21:51:11 +00:00
|
|
|
/dev/null 2>&1; then
|
|
|
|
if mm_install "${COMPFILE}"; then
|
|
|
|
echo "*** Updated revision control Id for ${DESTDIR}${COMPFILE#.}"
|
|
|
|
else
|
|
|
|
echo "*** Problem installing ${COMPFILE}, it will remain to merge by hand later"
|
|
|
|
fi
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
fi
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
2000-04-02 02:47:15 +00:00
|
|
|
# prompt user to install/delete/merge changes
|
|
|
|
diff_loop
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# If this is an auto run, make it official
|
|
|
|
echo " *** ${COMPFILE} will remain for your consideration"
|
|
|
|
;;
|
|
|
|
esac # Auto run test
|
|
|
|
fi # Yes, the files are different
|
|
|
|
fi # Yes, the file still remains to be checked
|
2009-03-13 08:48:33 +00:00
|
|
|
done # This is for the for way up there at the beginning of the comparison
|
1999-10-20 07:22:52 +00:00
|
|
|
|
1999-10-26 19:06:31 +00:00
|
|
|
echo ''
|
1999-10-20 07:22:52 +00:00
|
|
|
echo "*** Comparison complete"
|
2006-04-29 18:21:43 +00:00
|
|
|
|
2009-05-16 22:22:31 +00:00
|
|
|
if [ -s "${MTREENEW}" ]; then
|
2006-04-29 18:21:43 +00:00
|
|
|
echo "*** Saving mtree database for future upgrades"
|
2009-12-11 23:03:35 +00:00
|
|
|
test -e "${MTREEFILE}" && unlink ${MTREEFILE}
|
|
|
|
mv ${MTREENEW} ${MTREEFILE}
|
2006-04-29 18:21:43 +00:00
|
|
|
fi
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
echo ''
|
|
|
|
|
|
|
|
TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null`
|
|
|
|
if [ -n "${TEST_FOR_FILES}" ]; then
|
|
|
|
echo "*** Files that remain for you to merge by hand:"
|
2009-12-19 01:30:45 +00:00
|
|
|
find "${TEMPROOT}" -type f -size +0 | sort
|
2001-05-28 13:17:20 +00:00
|
|
|
echo ''
|
2000-10-29 09:40:22 +00:00
|
|
|
|
2010-01-08 00:05:10 +00:00
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
|
|
|
echo -n "Do you wish to delete what is left of ${TEMPROOT}? [no] "
|
|
|
|
read DEL_TEMPROOT
|
|
|
|
case "${DEL_TEMPROOT}" in
|
|
|
|
[yY]*)
|
|
|
|
delete_temproot
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo " *** ${TEMPROOT} will remain"
|
|
|
|
;;
|
|
|
|
esac
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
2010-01-08 00:05:10 +00:00
|
|
|
*) ;;
|
1999-10-20 07:22:52 +00:00
|
|
|
esac
|
2010-01-08 00:05:10 +00:00
|
|
|
else
|
|
|
|
echo "*** ${TEMPROOT} is empty, deleting"
|
|
|
|
delete_temproot
|
|
|
|
fi
|
1999-10-20 07:22:52 +00:00
|
|
|
|
2000-11-01 07:21:56 +00:00
|
|
|
case "${AUTO_INSTALLED_FILES}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
2001-03-05 10:13:21 +00:00
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
|
|
|
(
|
|
|
|
echo ''
|
2001-05-28 09:07:27 +00:00
|
|
|
echo '*** You chose the automatic install option for files that did not'
|
|
|
|
echo ' exist on your system. The following were installed for you:'
|
2001-03-05 10:13:21 +00:00
|
|
|
echo "${AUTO_INSTALLED_FILES}"
|
|
|
|
) | ${PAGER}
|
|
|
|
;;
|
|
|
|
*)
|
2000-11-01 07:21:56 +00:00
|
|
|
echo ''
|
2001-05-28 09:07:27 +00:00
|
|
|
echo '*** You chose the automatic install option for files that did not'
|
|
|
|
echo ' exist on your system. The following were installed for you:'
|
2000-11-01 07:21:56 +00:00
|
|
|
echo "${AUTO_INSTALLED_FILES}"
|
2001-03-05 10:13:21 +00:00
|
|
|
;;
|
|
|
|
esac
|
2000-11-01 07:21:56 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2006-04-29 18:21:43 +00:00
|
|
|
case "${AUTO_UPGRADED_FILES}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
|
|
|
(
|
|
|
|
echo ''
|
|
|
|
echo '*** You chose the automatic upgrade option for files that you did'
|
|
|
|
echo ' not alter on your system. The following were upgraded for you:'
|
|
|
|
echo "${AUTO_UPGRADED_FILES}"
|
|
|
|
) | ${PAGER}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo '*** You chose the automatic upgrade option for files that you did'
|
|
|
|
echo ' not alter on your system. The following were upgraded for you:'
|
|
|
|
echo "${AUTO_UPGRADED_FILES}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2001-03-05 10:13:21 +00:00
|
|
|
run_it_now () {
|
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
|
|
|
unset YES_OR_NO
|
|
|
|
echo ''
|
2001-05-28 13:17:20 +00:00
|
|
|
echo -n ' Would you like to run it now? y or n [n] '
|
2001-03-05 10:13:21 +00:00
|
|
|
read YES_OR_NO
|
|
|
|
|
|
|
|
case "${YES_OR_NO}" in
|
|
|
|
y)
|
2001-05-28 13:17:20 +00:00
|
|
|
echo " Running ${1}"
|
|
|
|
echo ''
|
2001-03-05 10:13:21 +00:00
|
|
|
eval "${1}"
|
|
|
|
;;
|
2001-05-28 13:17:20 +00:00
|
|
|
''|n)
|
|
|
|
echo ''
|
|
|
|
echo " *** Cancelled"
|
|
|
|
echo ''
|
|
|
|
echo " Make sure to run ${1} yourself"
|
2001-03-05 10:13:21 +00:00
|
|
|
;;
|
2001-05-28 13:17:20 +00:00
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo " *** Sorry, I do not understand your answer (${YES_OR_NO})"
|
|
|
|
echo ''
|
|
|
|
echo " Make sure to run ${1} yourself"
|
2001-03-05 10:13:21 +00:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${NEED_NEWALIASES}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
echo ''
|
2001-05-28 13:17:20 +00:00
|
|
|
if [ -n "${DESTDIR}" ]; then
|
|
|
|
echo "*** You installed a new aliases file into ${DESTDIR}/etc/mail, but"
|
|
|
|
echo " the newaliases command is limited to the directories configured"
|
|
|
|
echo " in sendmail.cf. Make sure to create your aliases database by"
|
|
|
|
echo " hand when your sendmail configuration is done."
|
|
|
|
else
|
|
|
|
echo "*** You installed a new aliases file, so make sure that you run"
|
|
|
|
echo " '/usr/bin/newaliases' to rebuild your aliases database"
|
|
|
|
run_it_now '/usr/bin/newaliases'
|
|
|
|
fi
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "${NEED_CAP_MKDB}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo "*** You installed a login.conf file, so make sure that you run"
|
2001-05-28 13:17:20 +00:00
|
|
|
echo " '/usr/bin/cap_mkdb ${DESTDIR}/etc/login.conf'"
|
|
|
|
echo " to rebuild your login.conf database"
|
|
|
|
run_it_now "/usr/bin/cap_mkdb ${DESTDIR}/etc/login.conf"
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2010-05-04 11:25:04 +00:00
|
|
|
case "${NEED_SERVICES_MKDB}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo "*** You installed a services file, so make sure that you run"
|
|
|
|
echo " '/usr/sbin/services_mkdb -q -o ${DESTDIR}/var/db/services.db ${DESTDIR}/etc/services'"
|
|
|
|
echo " to rebuild your services database"
|
|
|
|
run_it_now "/usr/sbin/services_mkdb -q -o ${DESTDIR}/var/db/services.db ${DESTDIR}/etc/services"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${NEED_PWD_MKDB}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo "*** You installed a new master.passwd file, so make sure that you run"
|
2001-05-28 13:17:20 +00:00
|
|
|
if [ -n "${DESTDIR}" ]; then
|
|
|
|
echo " '/usr/sbin/pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd'"
|
|
|
|
echo " to rebuild your password files"
|
|
|
|
run_it_now "/usr/sbin/pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd"
|
|
|
|
else
|
|
|
|
echo " '/usr/sbin/pwd_mkdb -p /etc/master.passwd'"
|
|
|
|
echo " to rebuild your password files"
|
|
|
|
run_it_now '/usr/sbin/pwd_mkdb -p /etc/master.passwd'
|
|
|
|
fi
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo ''
|
|
|
|
|
Add several new features, reorder some code, and continue with the
process of making the script more cross platform friendly.
* Add -i option to automatically install files that do not exist
on the system already.
* Add the ability to specify DESTDIR.
* Allow the user to specify scripts to run right before the
comparison starts, and when mm is done. This will
allow the user to specify customized local behavior, and
implement features such as automatically deleting files.
* Document the above changes in the man page.
* Switch to using 'ident' for the CVS Id comparison, which
should help with portability, and makes it faster.
* Reorder, and in one case fix some code by doing things in
ways that make more sense.
* Check to see if the file exists on the system before doing
the comparisons. This saves CPU cycles, and streamlines
the auto-install process.
I used bits and pieces of suggestions and patches from various
people, ultimately too numerous to name. Which is not to say
that they were not both appreciated, and helpful in achieving
the ultimate result.
2000-10-30 10:33:51 +00:00
|
|
|
if [ -r "${MM_EXIT_SCRIPT}" ]; then
|
|
|
|
. "${MM_EXIT_SCRIPT}"
|
|
|
|
fi
|
|
|
|
|
2002-02-24 10:22:14 +00:00
|
|
|
case "${COMP_CONFS}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
. ${DESTDIR}/etc/defaults/rc.conf
|
|
|
|
|
|
|
|
(echo ''
|
|
|
|
echo "*** Comparing conf files: ${rc_conf_files}"
|
|
|
|
|
|
|
|
for CONF_FILE in ${rc_conf_files}; do
|
|
|
|
if [ -r "${DESTDIR}${CONF_FILE}" ]; then
|
|
|
|
echo ''
|
|
|
|
echo "*** From ${DESTDIR}${CONF_FILE}"
|
|
|
|
echo "*** From ${DESTDIR}/etc/defaults/rc.conf"
|
|
|
|
|
|
|
|
for RC_CONF_VAR in `grep -i ^[a-z] ${DESTDIR}${CONF_FILE} |
|
|
|
|
cut -d '=' -f 1`; do
|
|
|
|
echo ''
|
2002-02-25 04:52:56 +00:00
|
|
|
grep -w ^${RC_CONF_VAR} ${DESTDIR}${CONF_FILE}
|
|
|
|
grep -w ^${RC_CONF_VAR} ${DESTDIR}/etc/defaults/rc.conf ||
|
2002-02-24 10:22:14 +00:00
|
|
|
echo ' * No default variable with this name'
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
done) | ${PAGER}
|
|
|
|
echo ''
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "${PRE_WORLD}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
2009-01-01 11:41:13 +00:00
|
|
|
MAKE_CONF="${SOURCEDIR}/share/examples/etc/make.conf"
|
2002-02-24 10:22:14 +00:00
|
|
|
|
|
|
|
(echo ''
|
|
|
|
echo '*** Comparing make variables'
|
|
|
|
echo ''
|
|
|
|
echo "*** From ${DESTDIR}/etc/make.conf"
|
|
|
|
echo "*** From ${MAKE_CONF}"
|
|
|
|
|
2002-08-05 01:03:12 +00:00
|
|
|
for MAKE_VAR in `grep -i ^[a-z] ${DESTDIR}/etc/make.conf | cut -d '=' -f 1`; do
|
2002-02-24 10:22:14 +00:00
|
|
|
echo ''
|
2002-02-25 04:52:56 +00:00
|
|
|
grep -w ^${MAKE_VAR} ${DESTDIR}/etc/make.conf
|
|
|
|
grep -w ^#${MAKE_VAR} ${MAKE_CONF} ||
|
2002-02-24 10:22:14 +00:00
|
|
|
echo ' * No example variable with this name'
|
|
|
|
done) | ${PAGER}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-12-12 02:19:41 +00:00
|
|
|
if [ -n "${PRESERVE_FILES}" ]; then
|
|
|
|
find -d $PRESERVE_FILES_DIR -type d -empty -delete 2>/dev/null
|
|
|
|
rmdir $PRESERVE_FILES_DIR 2>/dev/null
|
|
|
|
fi
|
2000-10-29 07:47:51 +00:00
|
|
|
|
2009-12-12 02:19:41 +00:00
|
|
|
exit 0
|