From 8e7469d8ee9a19d5c84eb850f2f40afb18f819e1 Mon Sep 17 00:00:00 2001 From: Antoine Jacoutot Date: Fri, 18 Sep 2015 17:03:45 +0000 Subject: Simplify: we don't need a work directory anymore, temproot is enough. --- usr.sbin/sysmerge/sysmerge.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'usr.sbin/sysmerge/sysmerge.sh') 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 # Copyright (c) 1998-2003 Douglas Barton @@ -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} -- cgit v1.2.3