Date: Wed, 17 Oct 2001 00:38:33 -0400 (EDT) From: <doug@safeport.com> To: freebsd-questions@FreeBSD.ORG Subject: Re: mergemaster -- whats the best way? Message-ID: <Pine.BSF.4.21.0110170037560.23659-200000@pemaquid.safeport.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
@#$%^& - forgot to attach the script - sorry
_____
Douglas Denault
doug@safeport.com
Voice: 301-469-8766
Fax: 301-469-0601
[-- Attachment #2 --]
#!/bin/sh
display_use() {
echo "mm_update is designed to be run after mergemaster. The goal is to"
echo "identify files in /etc that were not changed since the last invocation"
echo "of mergemaster but were left after 'mergemaster -ai'. There will be some"
echo "number of files with the same date that can be recognized as unchanged."
echo "These files can be selected by date to be updated, leaving the files"
echo "that have been locally changed to the standard process."
echo " "
echo "So to use mm_update:"
echo " "
echo " mergemaster -ai"
echo " mm_update -l"
echo " mm_update -r -d date"
echo " "
echo "The last step may need to be repeated depending on how"
echo "mergemaster was used previously"
echo " "
}
display_help () {
echo "Usage: mm_update [-hlr] [-d date] [-t /path]"
echo "Options:"
echo "-h Usage information"
echo "-l List remaining files and last modification date"
echo "-d Replacement date - must match ls -l format"
echo "-r Replace files in /etc that match [date]"
echo "-t /path/directory of temp root used by mergemaster"
echo "-v list files as they are updated"
}
TEMPROOT='/var/tmp/temproot'
USER_ROOT=no
BASE_DATE=none
UPDATE=no
LIST=no
# process command line parms
#
while getopts ":hld:t:rv" OPTIONS ; do
case "${OPTIONS}" in
h)
display_use
display_help
exit 0
;;
l)
LIST=yes
;;
d)
BASE_DATE=${OPTARG}
;;
r)
UPDATE=yes
;;
t)
TEMPROOT=${OPTARG}
USER_ROOT=yes
;;
v)
VERBOSE=yes
;;
*)
display_help
exit 1
;;
esac
done
# check to allow mm_update when temp root does not exist
#
if [ "${#}" = 0 ]; then
display_help
exit 1
fi
# do some sanity checking on the options
#
if [ -d "${TEMPROOT}" ]; then
if [ ! -d "${TEMPROOT}/etc" ]; then
echo "${TEMPROOT}/etc does not exist"
exit 1
fi
else
echo "${TEMPROOT} does not exist - run: mergemaster -ai"
exit 1
fi
if [ "${UPDATE}" = "yes" -a "${LIST}" = "yes" ]; then
echo "list and replace are mutually exclusive"
exit 1
fi
if [ "${UPDATE}" = "yes" -a "${BASE_DATE}" = "none" ]; then
echo "to do update you must specify a base date for /etc files"
exit 1
fi
# seems okay to do what was asked for
#
if [ "${LIST}" = "yes" ]; then
cd ${TEMPROOT}/etc
for FILE_LEFT in `find . -type f`; do
ls -l /etc/${FILE_LEFT} | awk '{print $6 " " $7 " " $8 " " $9}'
done
exit 0
fi
if [ "${UPDATE}" = "yes" ]; then
cd ${TEMPROOT}/etc
for FILE_LEFT in `find . -type f`; do
(ls -l /etc/${FILE_LEFT} | grep "${BASE_DATE}">/dev/null) && \
(if [ "${VERBOSE}" = "yes" ]; then
echo move ${FILE_LEFT}
fi
mv ${TEMPROOT}/etc/$FILE_LEFT /etc/$FILE_LEFT)
done
exit 0
fi
echo "mm_update flow error" #should not get here
exit 1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0110170037560.23659-200000>
