From 3755094ab1737d45b5591368558d46f5555503e8 Mon Sep 17 00:00:00 2001 From: ajacoutot Date: Sun, 18 Oct 2015 04:45:21 +0000 Subject: [PATCH] Make sure sm_rotate_bak() is only run once. --- usr.sbin/sysmerge/sysmerge.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.sbin/sysmerge/sysmerge.sh b/usr.sbin/sysmerge/sysmerge.sh index 4498d746d16..f8b525069ab 100644 --- a/usr.sbin/sysmerge/sysmerge.sh +++ b/usr.sbin/sysmerge/sysmerge.sh @@ -1,6 +1,6 @@ #!/bin/ksh - # -# $OpenBSD: sysmerge.sh,v 1.215 2015/10/16 19:55:39 ajacoutot Exp $ +# $OpenBSD: sysmerge.sh,v 1.216 2015/10/18 04:45:21 ajacoutot Exp $ # # Copyright (c) 2008-2014 Antoine Jacoutot # Copyright (c) 1998-2003 Douglas Barton @@ -81,7 +81,8 @@ sm_rotate_bak() { done rm -rf ${_BKPDIR}.4 [[ -d ${_BKPDIR} ]] && mv ${_BKPDIR} ${_BKPDIR}.0 - install -d ${_BKPDIR} || return + # make sure this function is only run _once_ per sysmerge invocation + unset -f sm_rotate_bak } # get pkg @sample information @@ -314,7 +315,9 @@ sm_install() { fi if [[ -f ${TARGET} ]]; then - sm_rotate_bak || return + if typeset -f sm_rotate_bak >/dev/null; then + sm_rotate_bak || return + fi mkdir -p ${_BKPDIR}/${_instdir} || return cp -p ${TARGET} ${_BKPDIR}/${_instdir} || return fi -- 2.20.1