summaryrefslogtreecommitdiff
path: root/usr.sbin/sysmerge
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2015-09-18 17:03:45 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2015-09-18 17:03:45 +0000
commit8e7469d8ee9a19d5c84eb850f2f40afb18f819e1 (patch)
tree2b6003321a7f30f9f0932c0a8931ea31e34d8b70 /usr.sbin/sysmerge
parent548396f5cebc58c3d3e7108b079c1e07bf28b97c (diff)
Simplify: we don't need a work directory anymore, temproot is enough.
Diffstat (limited to 'usr.sbin/sysmerge')
-rw-r--r--usr.sbin/sysmerge/sysmerge.820
-rw-r--r--usr.sbin/sysmerge/sysmerge.sh17
2 files changed, 14 insertions, 23 deletions
diff --git a/usr.sbin/sysmerge/sysmerge.8 b/usr.sbin/sysmerge/sysmerge.8
index 646511e248a..8c9ea75125f 100644
--- a/usr.sbin/sysmerge/sysmerge.8
+++ b/usr.sbin/sysmerge/sysmerge.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysmerge.8,v 1.72 2015/09/07 10:02:04 ajacoutot Exp $
+.\" $OpenBSD: sysmerge.8,v 1.73 2015/09/18 17:03:44 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: September 7 2015 $
+.Dd $Mdocdate: September 18 2015 $
.Dt SYSMERGE 8
.Os
.Sh NAME
@@ -33,14 +33,9 @@ script designed to help the administrator update configuration files
after upgrading to a new release or snapshot.
.Pp
.Nm
-works by comparing a temporary reference root directory
-against currently installed files.
-All work is done under
+works by comparing the reference root directory
.Pa ${TMPDIR}/sysmerge.XXXXXXXXXX
-(known as the
-.Em work directory )
-which contains the temporary root directory
-.Pa temproot .
+against currently installed files.
.Pp
.Nm
will work through the fileset,
@@ -143,17 +138,14 @@ the default is
.It Ev PAGER
Specifies the pagination program to use.
.It Ev TMPDIR
-Directory in which the work directory is created.
+Path in which to store temporary files.
If unset, this defaults to
.Pa /tmp .
.El
.Sh FILES
.Bl -tag -width "${TMPDIR}/sysmerge.XXXXXXXXXX" -compact
.It Pa ${TMPDIR}/sysmerge.XXXXXXXXXX
-Default work directory.
-The
-.Sy temproot
-directory is created relative to this.
+Directory in which the reference root directory is created.
.It Pa /etc/sysmerge.ignore
Files and directories to ignore from comparison.
.It Pa /var/sysmerge/backups
diff --git a/usr.sbin/sysmerge/sysmerge.sh b/usr.sbin/sysmerge/sysmerge.sh
index c99809e9b79..dd2036132bf 100644
--- a/usr.sbin/sysmerge/sysmerge.sh
+++ b/usr.sbin/sysmerge/sysmerge.sh
@@ -1,6 +1,6 @@
#!/bin/ksh -
#
-# $OpenBSD: sysmerge.sh,v 1.209 2015/09/18 16:00:19 ajacoutot Exp $
+# $OpenBSD: sysmerge.sh,v 1.210 2015/09/18 17:03:44 ajacoutot Exp $
#
# Copyright (c) 2008-2014 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 1998-2003 Douglas Barton <DougB@FreeBSD.org>
@@ -38,7 +38,7 @@ stripcom() {
sm_error() {
(($#)) && echo "---- Error: $@"
- rm -rf ${_WRKDIR}
+ rm -rf ${_TMPROOT}
exit 1
}
@@ -570,15 +570,15 @@ sm_check_an_eg() {
sm_post() {
local _f
- cd ${_WRKDIR} && \
+ cd ${_TMPROOT} && \
find . -type d -depth -empty -exec rmdir -p '{}' + 2>/dev/null
- rmdir ${_WRKDIR} 2>/dev/null
+ rmdir ${_TMPROOT} 2>/dev/null
if [[ -d ${_TMPROOT} ]]; then
- sm_info "file(s) left for comparison:"
for _f in $(find ${_TMPROOT} ! -type d ! -name \*.merged -size +0)
do
- echo "${_f}" && ${BATCHMODE} && [[ -f ${_f} ]] && \
+ sm_info "${_f} left for comparison"
+ ${BATCHMODE} && [[ -f ${_f} ]] && \
sed -i "/$(sha256 -q ${_f})/d" /var/sysmerge/*sum
done
fi
@@ -608,9 +608,8 @@ shift $(( OPTIND -1 ))
# global constants
_BKPDIR=/var/sysmerge/backups
_RELINT=$(uname -r | tr -d '.') || exit 1
-_WRKDIR=$(mktemp -d -p ${TMPDIR:=/tmp} sysmerge.XXXXXXXXXX) || exit 1
-_TMPROOT=${_WRKDIR}/temproot
-readonly _BKPDIR _RELINT _TMPROOT _WRKDIR
+_TMPROOT=$(mktemp -d -p ${TMPDIR:=/tmp} sysmerge.XXXXXXXXXX) || exit 1
+readonly _BKPDIR _RELINT _TMPROOT
[[ -z ${VISUAL} ]] && EDITOR=${EDITOR:=/usr/bin/vi} || EDITOR=${VISUAL}
PAGER=${PAGER:=/usr/bin/more}