diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2009-04-06 10:35:21 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2009-04-06 10:35:21 +0000 |
commit | c2df4bda67aca395f49d4c5aa88ef6e16101675b (patch) | |
tree | 1d671073ba2555837de3b52376a22a58a6d2ebe3 /usr.sbin/sysmerge | |
parent | 313dbeaf318d0b35d10043f68d135ede418a74ea (diff) |
Add a report summary file, ${WRKDIR}/sysmerge.log, that will include all
worthy post run information instead of spreading info into several
files. Tweak some output while here.
Enchance description for the -S and -X options; thanks to sthen@ and
jmc@ for finding the correct wording... it was not as easy as it seems.
Fix a typo in the man page, spotted by jmc@
ok sthen@ jmc@
Diffstat (limited to 'usr.sbin/sysmerge')
-rw-r--r-- | usr.sbin/sysmerge/sysmerge.8 | 19 | ||||
-rw-r--r-- | usr.sbin/sysmerge/sysmerge.sh | 58 |
2 files changed, 41 insertions, 36 deletions
diff --git a/usr.sbin/sysmerge/sysmerge.8 b/usr.sbin/sysmerge/sysmerge.8 index b00315a7b7d..a6176683c20 100644 --- a/usr.sbin/sysmerge/sysmerge.8 +++ b/usr.sbin/sysmerge/sysmerge.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysmerge.8,v 1.16 2009/03/25 18:02:12 ajacoutot Exp $ +.\" $OpenBSD: sysmerge.8,v 1.17 2009/04/06 10:35:20 ajacoutot Exp $ .\" .\" Copyright (c) 2008 Antoine Jacoutot <ajacoutot@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 25 2009 $ +.Dd $Mdocdate: April 6 2009 $ .Dt SYSMERGE 8 .Os .Sh NAME @@ -122,8 +122,10 @@ may be provided using the or .Fl X options. -Installed files which have not been modified from the originals -will be updated automatically. +If files differ between the supplied tarballs, then installed +files which have not been modified from the originals will +be updated automatically. Those that have been modified will +be offered for comparison. .Pp Files and directories can be excluded from comparison by listing them in the file @@ -191,7 +193,7 @@ where XX represents the version to be upgraded from. .Nm will attempt to automatically upgrade files from this version to the one specified by -.Fl s , +.Fl x , provided that the file has no local changes. A tarball path specified as an FTP or HTTP URL will be passed to ${FETCH_CMD}. @@ -234,6 +236,11 @@ output file to create, the second argument is the currently installed file and the third argument is the reference file. If unset, this defaults to .Dq sdiff -as -w ${SWIDTH} -o . +.It Ev REPORT +Log summary which may contain information for further, manual, +updating. +Defaults to +.Pa ${WRKDIR}/sysmerge.log . .It Ev TMPDIR Directory in which the work directory is created. If unset, this defaults to @@ -248,6 +255,8 @@ The and .Sy backup directories are created relative to this. +.It ${WRKDIR}/sysmerge.log +Default log file. .It /etc/sysmerge.ignore Files and directories to ignore from comparison. .El diff --git a/usr.sbin/sysmerge/sysmerge.sh b/usr.sbin/sysmerge/sysmerge.sh index 217c77887ac..6e4117714ca 100644 --- a/usr.sbin/sysmerge/sysmerge.sh +++ b/usr.sbin/sysmerge/sysmerge.sh @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: sysmerge.sh,v 1.32 2009/03/27 15:17:31 ajacoutot Exp $ +# $OpenBSD: sysmerge.sh,v 1.33 2009/04/06 10:35:20 ajacoutot Exp $ # # This script is based on the FreeBSD mergemaster script, written by # Douglas Barton <DougB@FreeBSD.org> @@ -29,6 +29,7 @@ umask 0022 WRKDIR=`mktemp -d -p /var/tmp sysmerge.XXXXX` || exit 1 SWIDTH=`stty size | awk '{w=$2} END {if (w==0) {w=80} print w}'` MERGE_CMD="${MERGE_CMD:=sdiff -as -w ${SWIDTH} -o}" +REPORT="${REPORT:=${WRKDIR}/sysmerge.log}" EDITOR="${EDITOR:=/usr/bin/vi}" PAGER="${PAGER:=/usr/bin/more}" @@ -182,8 +183,7 @@ do_populate() { for i in ${TGZ} ${XTGZ}; do tar -tzf ${i} >> ${WRKDIR}/nlist; done - diff -C 0 ${WRKDIR}/olist ${WRKDIR}/nlist | grep -E '^- .' \ - | sed -e 's,^- .,,g' > ${WRKDIR}/obsolete_files + OBSOLETE_FILES=`diff -C 0 ${WRKDIR}/olist ${WRKDIR}/nlist | grep -E '^- .' | sed -e 's,^- .,,g'` rm -f ${WRKDIR}/olist ${WRKDIR}/nlist fi @@ -511,43 +511,39 @@ do_compare() { do_post() { - if [ "${AUTO_INSTALLED_FILES}" ]; then - echo "${AUTO_INSTALLED_FILES}" > ${WRKDIR}/auto_installed_files - fi - if [ "${NEED_NEWALIASES}" ]; then echo "===> A new ${DESTDIR}/etc/mail/aliases file was installed." - echo "However ${DESTDIR}/usr/bin/newaliases could not be run, you will" - echo "need to rebuild your aliases database manually." + echo " However ${DESTDIR}/usr/bin/newaliases could not be run," + echo " you will need to rebuild your aliases database manually." fi clean_src rm -rf ${OTEMPROOT} - echo "===> Making sure your directory hierarchy has correct perms, running mtree..." + echo "===> Making sure your directory hierarchy has correct perms, running mtree" mtree -qdef ${DESTDIR}/etc/mtree/4.4BSD.dist -p ${DESTDIR:=/} -U > /dev/null - FILES_IN_WRKDIR=`find ${WRKDIR} -type f -size +0 2> /dev/null` - if [ "${FILES_IN_WRKDIR}" ]; then - FILES_IN_TEMPROOT=`find ${TEMPROOT} -type f -size +0 2> /dev/null` - FILES_IN_BKPDIR=`find ${BKPDIR} -type f -size +0 2> /dev/null` - OBSOLETE_FILES=`stat -f %z ${WRKDIR}/obsolete_files 2> /dev/null` - if [ "${AUTO_INSTALLED_FILES}" ]; then - echo "===> Automatically installed file(s) listed in" - echo " ${WRKDIR}/auto_installed_files" - fi - if [ "${OBSOLETE_FILES}" -ne 0 ]; then - echo "===> File(s) removed from previous set (maybe obsolete) listed in" - echo " ${WRKDIR}/obsolete_files" - fi - if [ "${FILES_IN_TEMPROOT}" ]; then - echo "===> File(s) remaining for you to merge by hand:" - find "${TEMPROOT}" -type f ! -name \*.merged -size +0 -exec echo " {}" \; - fi - if [ "${FILES_IN_BKPDIR}" ]; then - echo "===> Backup of replaced file(s) can be found under" - echo " ${BKPDIR}" - fi + FILES_IN_TEMPROOT=`find ${TEMPROOT} -type f ! -name \*.merged -size +0 2> /dev/null` + FILES_IN_BKPDIR=`find ${BKPDIR} -type f -size +0 2> /dev/null` + if [ "${AUTO_INSTALLED_FILES}" ]; then + echo "===> Automatically installed file(s)" >> ${REPORT} + echo "${AUTO_INSTALLED_FILES}" >> ${REPORT} + fi + if [ "${FILES_IN_BKPDIR}" ]; then + echo "===> Backup of replaced file(s) can be found under" >> ${REPORT} + echo "${BKPDIR}\n" >> ${REPORT} + fi + if [ "${OBSOLETE_FILES}" ]; then + echo "===> File(s) removed from previous set (maybe obsolete)" >> ${REPORT} + echo "${OBSOLETE_FILES}" >> ${REPORT} + fi + if [ "${FILES_IN_TEMPROOT}" ]; then + echo "===> File(s) remaining for you to merge by hand" >> ${REPORT} + echo "${FILES_IN_TEMPROOT}" >> ${REPORT} + fi + + if [ -e "${REPORT}" ]; then + echo "===> Manual intervention may be needed, see ${REPORT}" echo "===> When done, ${WRKDIR} and its subdirectories should be removed" else echo "===> Removing ${WRKDIR}" |