summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2016-11-03 12:27:35 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2016-11-03 12:27:35 +0000
commitdca0209b67114ebe3fa3231c61a1ae2769375468 (patch)
tree1d48848de731ca526f35472e9f3ef912f6663a1c /usr.sbin
parent097d26c80860562381aa8edba3720bbd79261314 (diff)
Simplify for loops; prompted by a comment from rpe@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/syspatch/syspatch.sh17
1 files changed, 7 insertions, 10 deletions
diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh
index 91477e8b401..566c57fa064 100644
--- a/usr.sbin/syspatch/syspatch.sh
+++ b/usr.sbin/syspatch/syspatch.sh
@@ -1,6 +1,6 @@
#!/bin/ksh
#
-# $OpenBSD: syspatch.sh,v 1.26 2016/11/02 18:04:50 ajacoutot Exp $
+# $OpenBSD: syspatch.sh,v 1.27 2016/11/03 12:27:34 ajacoutot Exp $
#
# Copyright (c) 2016 Antoine Jacoutot <ajacoutot@openbsd.org>
#
@@ -166,10 +166,9 @@ ls_avail()
ls_installed()
{
local _p
- # no _REL dir = no installed patch
- cd ${_PDIR}/${_REL} 2>/dev/null && set -- * || return 0
- for _p; do
- [[ ${_p} = rollback-syspatch-${_RELINT}-*.tgz ]] &&
+ for _p in ${_PDIR}/${_REL}/*; do
+ _p=${_p:##*/}
+ [[ ${_p} = rollback-syspatch-${_RELINT}-*.tgz ]] &&
_p=${_p#rollback-} && echo ${_p%.tgz}
done | sort -V
}
@@ -224,15 +223,13 @@ sp_cleanup()
local _d _k
# remove non matching release /var/syspatch/ content
- cd ${_PDIR} && set -- *
- for _d; do
+ for _d in ${_PDIR}/*; do
[[ -e ${_d} ]] || continue
- [[ ${_d} == ${_REL} ]] || rm -r ${_d}
+ [[ ${_d:##*/} == ${_REL} ]] || rm -r ${_d}
done
# remove non matching release rollback kernel
- set -- /bsd.rollback*
- for _k; do
+ for _k in /bsd.rollback*; do
[[ -f ${_k} ]] || continue
[[ ${_k} == /bsd.rollback${_RELINT} ]] || rm ${_k}
done