summaryrefslogtreecommitdiff
path: root/usr.sbin/sysmerge
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2008-09-12 13:32:00 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2008-09-12 13:32:00 +0000
commit024542023024523225b79fc96c0b6172fcc1e970 (patch)
treeddf542bcdfa7d05d553b36b8d915711c0614b2fe /usr.sbin/sysmerge
parent9022edacf64c24db94b217546ec4350bd2472627 (diff)
- make it possible to use a user defined MERGE_CMD instead of sdiff
mostly from andreas@ man page enhancing by jmc@ ok andreas@
Diffstat (limited to 'usr.sbin/sysmerge')
-rw-r--r--usr.sbin/sysmerge/sysmerge.815
-rw-r--r--usr.sbin/sysmerge/sysmerge.sh13
2 files changed, 19 insertions, 9 deletions
diff --git a/usr.sbin/sysmerge/sysmerge.8 b/usr.sbin/sysmerge/sysmerge.8
index 130ebcd476e..e1ca611bec9 100644
--- a/usr.sbin/sysmerge/sysmerge.8
+++ b/usr.sbin/sysmerge/sysmerge.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysmerge.8,v 1.10 2008/07/04 15:03:45 sthen Exp $
+.\" $OpenBSD: sysmerge.8,v 1.11 2008/09/12 13:31:59 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: July 4 2008 $
+.Dd $Mdocdate: September 12 2008 $
.Dt SYSMERGE 8
.Os
.Sh NAME
@@ -109,8 +109,8 @@ mode.
.Pp
.Nm
will work through the fileset,
-offering the chance to merge any differences using
-.Xr sdiff 1 .
+offering the chance to merge any differences
+using ${MERGE_CMD}.
Files may also be left to deal with at a later date.
Should any problems occur,
such as a failure to upgrade a file,
@@ -181,6 +181,13 @@ If unset, this defaults to
Command used to fetch remote files.
Defaults to
.Xr ftp 1 .
+.It Ev MERGE_CMD
+Command used to merge diffs.
+This will be called with three arguments: the first argument is the
+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 TMPDIR
Directory in which the work directory is created.
If unset, this defaults to
diff --git a/usr.sbin/sysmerge/sysmerge.sh b/usr.sbin/sysmerge/sysmerge.sh
index 3cec70e7016..188859c4f0d 100644
--- a/usr.sbin/sysmerge/sysmerge.sh
+++ b/usr.sbin/sysmerge/sysmerge.sh
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: sysmerge.sh,v 1.23 2008/09/12 13:23:17 ajacoutot Exp $
+# $OpenBSD: sysmerge.sh,v 1.24 2008/09/12 13:31:59 ajacoutot Exp $
#
# This script is based on the FreeBSD mergemaster script, written by
# Douglas Barton <DougB@FreeBSD.org>
@@ -26,9 +26,10 @@
umask 0022
-PAGER="${PAGER:=/usr/bin/more}"
-SWIDTH=`stty size | awk '{w=$2} END {if (w==0) {w=80} print w}'`
WRKDIR=`mktemp -d -p /var/tmp sysmerge.XXXXX` || exit 1
+SWIDTH=`stty size | awk '{w=$2} END {if (w==0) {w=80} print w}'`
+PAGER="${PAGER:=/usr/bin/more}"
+MERGE_CMD="${MERGE_CMD:=sdiff -as -w ${SWIDTH} -o}"
# clean leftovers created by make in src
clean_src() {
@@ -193,11 +194,13 @@ mm_install() {
merge_loop() {
- echo "===> Type h at the sdiff prompt (%) to get usage help\n"
+ if [ `expr "$MERGE_CMD" : ^sdiff.*` -gt 0 ]; then
+ echo "===> Type h at the sdiff prompt (%) to get usage help\n"
+ fi
MERGE_AGAIN=1
while [ "${MERGE_AGAIN}" ]; do
cp -p "${COMPFILE}" "${COMPFILE}.merged"
- sdiff -as -o "${COMPFILE}.merged" -w ${SWIDTH} \
+ ${MERGE_CMD} "${COMPFILE}.merged" \
"${DESTDIR}${COMPFILE#.}" "${COMPFILE}"
INSTALL_MERGED=v
while [ "${INSTALL_MERGED}" = "v" ]; do