diff options
author | 2016-09-10 16:07:33 +0000 | |
---|---|---|
committer | 2016-09-10 16:07:33 +0000 | |
commit | c027aa9e776920aad24eabd12239000ae44e0594 (patch) | |
tree | a674232250e38b1562130f7caa48af32851ff58f /usr.sbin/syspatch/syspatch.sh | |
parent | Moving the host reset after setting the clock in the attach path makes (diff) | |
download | wireguard-openbsd-c027aa9e776920aad24eabd12239000ae44e0594.tar.xz wireguard-openbsd-c027aa9e776920aad24eabd12239000ae44e0594.zip |
apply_patches should not take any arguments.
Few tweaks while here.
Diffstat (limited to 'usr.sbin/syspatch/syspatch.sh')
-rw-r--r-- | usr.sbin/syspatch/syspatch.sh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh index f13e7708c55..d95c6e9d914 100644 --- a/usr.sbin/syspatch/syspatch.sh +++ b/usr.sbin/syspatch/syspatch.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: syspatch.sh,v 1.11 2016/09/07 16:01:48 ajacoutot Exp $ +# $OpenBSD: syspatch.sh,v 1.12 2016/09/10 16:07:33 ajacoutot Exp $ # # Copyright (c) 2016 Antoine Jacoutot <ajacoutot@openbsd.org> # @@ -27,8 +27,8 @@ usage() needs_root() { - [[ $(id -u) -eq 0 ]] || \ - (echo "${0##*/}: need root privileges"; return 1) + [[ $(id -u) -ne 0 ]] && echo "${0##*/}: need root privileges" && \ + return 1 } syspatch_trap() @@ -41,7 +41,7 @@ apply_patches() { needs_root # XXX cleanup mismatch/old rollback patches and sig (installer should as well) - local _m _patch _patches="$@" + local _m _patch _patches="$(ls_missing)" [[ -n ${_patches} ]] || return 0 # nothing to do for _patch in ${_patches}; do @@ -168,7 +168,8 @@ ls_avail() ls_installed() { local _p - cd ${_PDIR}/${_REL} && set -- * || return 0 # no _REL dir = no patch + # no _REL dir = no installed patch + cd ${_PDIR}/${_REL} 2>/dev/null && set -- * || return 0 for _p; do [[ ${_p} = rollback-syspatch-${_RELINT}-*.tgz ]] && \ _p=${_p#rollback-} && echo ${_p%.tgz} @@ -245,7 +246,7 @@ shift $(( OPTIND -1 )) [[ $# -ne 0 ]] && usage if [[ ${OPTIND} == 1 ]]; then - apply_patches $(ls_missing) + apply_patches fi rm -rf ${_TMP} |