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.
|
|
|
|
|
2002-02-12 09:54:56 +00:00
|
|
|
# Copyright 1998-2002 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}"
|
2002-02-24 10:22:14 +00:00
|
|
|
echo 'Usage: mergemaster [-scrvahipC] [-m /path]'
|
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 ' [-t /path] [-d] [-u N] [-w N] [-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'
|
|
|
|
echo ' -C Compare local rc.conf variables to the defaults'
|
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"
|
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
|
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 ''
|
|
|
|
echo ' ====================================================================== '
|
|
|
|
echo ''
|
2000-10-29 07:47:51 +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
|
|
|
echo ''
|
2000-10-29 07:47:51 +00:00
|
|
|
echo " *** Displaying differences between ${COMPFILE} and installed version:"
|
|
|
|
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
|
|
|
diff "${DIFF_FLAG}" "${DESTDIR}${COMPFILE#.}" "${COMPFILE}"
|
2000-10-29 07:47:51 +00:00
|
|
|
) | ${PAGER}
|
|
|
|
echo ''
|
|
|
|
fi
|
|
|
|
else
|
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 ''
|
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"
|
|
|
|
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
|
|
|
|
#
|
2002-02-24 10:22:14 +00:00
|
|
|
while getopts ":ascrvhipCm:t:du:w:D:" COMMAND_LINE_ARGUMENT ; do
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${COMMAND_LINE_ARGUMENT}" in
|
|
|
|
s)
|
|
|
|
STRICT=yes
|
|
|
|
;;
|
|
|
|
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
|
|
|
|
;;
|
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
|
|
|
|
|
|
|
|
echo ''
|
|
|
|
|
|
|
|
# If the user has a pager defined, make sure we can run it
|
|
|
|
#
|
|
|
|
case "${DONT_CHECK_PAGER}" in
|
|
|
|
'')
|
2000-08-09 20:36:15 +00:00
|
|
|
while ! type "${PAGER%% *}" >/dev/null && [ -n "${PAGER}" ]; 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
|
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
|
|
|
|
#
|
|
|
|
SOURCEDIR=${SOURCEDIR:-/usr/src/etc}
|
|
|
|
|
2002-05-04 22:45:12 +00:00
|
|
|
# Check the width of the user's terminal
|
|
|
|
#
|
|
|
|
if [ -t 0 ]; then
|
|
|
|
w=$(stty -a | sed -ne 's/.* \([0-9][0-9]*\) columns.*/\1/p')
|
|
|
|
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
|
|
|
|
rm -rf "${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 ''
|
2002-06-30 18:47:57 +00:00
|
|
|
delete_temproot || exit 1
|
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
|
|
|
|
'') ;;
|
|
|
|
*)
|
2000-11-09 00:19:21 +00:00
|
|
|
make DESTDIR=${DESTDIR} distrib-dirs
|
2002-02-24 10:22:14 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
make DESTDIR=${TEMPROOT} distrib-dirs &&
|
|
|
|
make MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj obj &&
|
|
|
|
make MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj DESTDIR=${TEMPROOT} \
|
|
|
|
-DNO_MAKEDEV_RUN distribution;} ||
|
|
|
|
{ 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 &&
|
|
|
|
cp -p ${SOURCEDIR}/master.passwd ${TEMPROOT}/etc &&
|
|
|
|
cp -p ${SOURCEDIR}/group ${TEMPROOT}/etc;} ||
|
|
|
|
{ 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
|
|
|
# Avoid comparing the motd if the user specifies it in .mergemasterrc
|
|
|
|
case "${IGNORE_MOTD}" in
|
|
|
|
'') ;;
|
2002-05-04 22:45:12 +00:00
|
|
|
*) rm -f ${TEMPROOT}/etc/motd
|
1999-10-26 19:06:31 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2000-08-26 12:15:24 +00:00
|
|
|
# Avoid trying to update MAKEDEV if /dev is on a devfs
|
2000-11-09 00:19:21 +00:00
|
|
|
if /sbin/sysctl vfs.devfs.generation > /dev/null 2>&1 ; then
|
2002-02-24 10:22:14 +00:00
|
|
|
rm -f ${TEMPROOT}/dev/MAKEDEV ${TEMPROOT}/dev/MAKEDEV.local
|
2000-08-26 12:15:24 +00:00
|
|
|
fi
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
;; # End of the "RERUN" test
|
|
|
|
esac
|
|
|
|
|
2001-05-30 08:50:10 +00:00
|
|
|
# We really don't want to have to deal with these files, since
|
|
|
|
# master.passwd is the real file that should be compared, then
|
|
|
|
# the user should run pwd_mkdb if necessary.
|
|
|
|
#
|
2002-02-24 10:22:14 +00:00
|
|
|
rm -f ${TEMPROOT}/etc/spwd.db ${TEMPROOT}/etc/passwd ${TEMPROOT}/etc/pwd.db
|
2001-05-30 08:50:10 +00:00
|
|
|
|
2002-04-08 10:30:44 +00:00
|
|
|
# We only need to compare things like freebsd.cf once
|
2002-05-04 22:45:12 +00:00
|
|
|
find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null
|
2002-04-08 10:30:44 +00:00
|
|
|
|
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"
|
|
|
|
echo " they are created with by ${SOURCEDIR}/Makefile, compared to"
|
|
|
|
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
|
|
|
|
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
|
|
|
# Warn users who still have ${DESTDIR}/etc/sysconfig
|
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
|
|
|
if [ -e "${DESTDIR}/etc/sysconfig" ]; then
|
|
|
|
echo ''
|
|
|
|
echo " *** There is a sysconfig file on this system in ${DESTDIR}/etc/."
|
|
|
|
echo ''
|
|
|
|
echo ' Starting with FreeBSD version 2.2.2 those settings moved from'
|
|
|
|
echo ' /etc/sysconfig to /etc/rc.conf. If you are upgrading an older'
|
|
|
|
echo ' system make sure that you transfer your settings by hand from'
|
|
|
|
echo ' sysconfig to rc.conf and install the rc.conf file. If you'
|
|
|
|
echo ' have already made this transition, you should consider'
|
|
|
|
echo ' renaming or deleting the sysconfig file.'
|
1999-10-20 07:22:52 +00:00
|
|
|
echo ''
|
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
2000-10-29 09:40:22 +00:00
|
|
|
echo -n "Continue with the merge process? [yes] "
|
|
|
|
read CONT_OR_NOT
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${CONT_OR_NOT}" in
|
|
|
|
[nN]*)
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo " *** Continuing"
|
|
|
|
echo ''
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
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
|
|
|
|
#
|
2001-06-20 07:15:38 +00:00
|
|
|
do_install_and_rm () {
|
|
|
|
install -m "${1}" "${2}" "${3}" &&
|
2002-02-24 10:22:14 +00:00
|
|
|
rm -f "${2}"
|
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 &
|
|
|
|
$(echo "obase=10; ibase=8; $(stat -f "%OMp%OLp" ${1})" | bc) ))
|
|
|
|
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}"`
|
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
|
|
|
install -d -o root -g wheel -m "${DIR_MODE}" "${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
|
|
|
|
;;
|
|
|
|
/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)
|
2001-05-28 13:17:20 +00:00
|
|
|
case "${AUTO_INSTALL}" in
|
|
|
|
'')
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${LINK_EXPLAINED}" in
|
|
|
|
'')
|
2000-10-29 09:40:22 +00:00
|
|
|
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."
|
1999-10-20 07:22:52 +00:00
|
|
|
echo ''
|
|
|
|
LINK_EXPLAINED=yes
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo " Use 'd' to delete the temporary ${COMPFILE}"
|
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 " Use 'l' to delete the existing ${DESTDIR}${COMPFILE#.} and create the link"
|
1999-10-20 07:22:52 +00:00
|
|
|
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 handle ${COMPFILE}? [Leave it to install later] "
|
|
|
|
read HANDLE_LINK
|
2001-05-28 13:17:20 +00:00
|
|
|
;;
|
|
|
|
*) # Part of AUTO_INSTALL
|
|
|
|
HANDLE_LINK=l
|
|
|
|
;;
|
|
|
|
esac
|
2000-10-29 09:40:22 +00:00
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${HANDLE_LINK}" in
|
|
|
|
[dD]*)
|
|
|
|
rm "${COMPFILE}"
|
|
|
|
echo ''
|
|
|
|
echo " *** Deleting ${COMPFILE}"
|
|
|
|
;;
|
|
|
|
[lL]*)
|
|
|
|
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
|
|
|
rm -f "${DESTDIR}${COMPFILE#.}"
|
|
|
|
if ln "${DESTDIR}/root/${COMPFILE##*/}" "${DESTDIR}${COMPFILE#.}"; then
|
|
|
|
echo " *** Link from ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/} installed successfully"
|
1999-10-20 07:22:52 +00:00
|
|
|
rm "${COMPFILE}"
|
|
|
|
else
|
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 " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}, ${COMPFILE} will remain to install by hand"
|
1999-10-20 07:22:52 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo " *** ${COMPFILE} will remain for your consideration"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
DONT_INSTALL=yes
|
|
|
|
;;
|
|
|
|
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
|
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 "${1#.}" in
|
|
|
|
/dev/MAKEDEV)
|
|
|
|
NEED_MAKEDEV=yes
|
|
|
|
;;
|
|
|
|
esac
|
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
|
|
|
fi
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
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 ''
|
|
|
|
|
|
|
|
cd "${TEMPROOT}"
|
|
|
|
|
|
|
|
if [ -r "${MM_PRE_COMPARE_SCRIPT}" ]; then
|
|
|
|
. "${MM_PRE_COMPARE_SCRIPT}"
|
|
|
|
fi
|
1999-10-20 07:22:52 +00:00
|
|
|
|
|
|
|
# Using -size +0 avoids uselessly checking the empty log files created
|
|
|
|
# by ${SOURCEDIR}/Makefile and the device entries in ./dev, but does
|
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
|
|
|
# check the scripts in ./dev, as we'd like (assuming no devfs of course).
|
1999-10-20 07:22:52 +00:00
|
|
|
#
|
|
|
|
for COMPFILE in `find . -type f -size +0`; 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.
|
|
|
|
#
|
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 diff -q "${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
|
|
|
#
|
|
|
|
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
|
|
|
|
done # This is for the do way up there at the beginning of the comparison
|
|
|
|
|
1999-10-26 19:06:31 +00:00
|
|
|
echo ''
|
1999-10-20 07:22:52 +00:00
|
|
|
echo "*** Comparison complete"
|
|
|
|
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:"
|
|
|
|
find "${TEMPROOT}" -type f -size +0
|
2001-05-28 13:17:20 +00:00
|
|
|
echo ''
|
1999-10-20 07:22:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
case "${AUTO_RUN}" in
|
|
|
|
'')
|
2000-10-29 09:40:22 +00:00
|
|
|
echo -n "Do you wish to delete what is left of ${TEMPROOT}? [no] "
|
|
|
|
read DEL_TEMPROOT
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
case "${DEL_TEMPROOT}" in
|
|
|
|
[yY]*)
|
2002-06-30 18:47:57 +00:00
|
|
|
if delete_temproot; then
|
1999-10-20 07:22:52 +00:00
|
|
|
echo " *** ${TEMPROOT} has been deleted"
|
|
|
|
else
|
|
|
|
echo " *** Unable to delete ${TEMPROOT}"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo " *** ${TEMPROOT} will remain"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
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
|
|
|
|
|
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_MAKEDEV}" in
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
echo ''
|
2001-05-28 13:17:20 +00:00
|
|
|
echo "*** You installed a new ${DESTDIR}/dev/MAKEDEV script, so make sure that you run"
|
|
|
|
echo " 'cd ${DESTDIR}/dev && /bin/sh MAKEDEV all' to rebuild your devices"
|
|
|
|
run_it_now "cd ${DESTDIR}/dev && /bin/sh MAKEDEV all"
|
1999-10-20 07:22:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
'') ;;
|
|
|
|
*)
|
|
|
|
MAKE_CONF="${SOURCEDIR%etc}share/examples/etc/make.conf"
|
|
|
|
|
|
|
|
(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
|
|
|
|
|
1999-10-20 07:22:52 +00:00
|
|
|
exit 0
|
2000-10-29 07:47:51 +00:00
|
|
|
|