summaryrefslogtreecommitdiff
path: root/usr.sbin/sysmerge/sysmerge.sh
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/sysmerge.sh
parent548396f5cebc58c3d3e7108b079c1e07bf28b97c (diff)
Simplify: we don't need a work directory anymore, temproot is enough.
Diffstat (limited to 'usr.sbin/sysmerge/sysmerge.sh')
-rw-r--r--usr.sbin/sysmerge/sysmerge.sh17
1 files changed, 8 insertions, 9 deletions
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}