diff options
Diffstat (limited to 'usr.sbin/syspatch/syspatch.sh')
-rw-r--r-- | usr.sbin/syspatch/syspatch.sh | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh index d95c6e9d914..653eb5cede4 100644 --- a/usr.sbin/syspatch/syspatch.sh +++ b/usr.sbin/syspatch/syspatch.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: syspatch.sh,v 1.12 2016/09/10 16:07:33 ajacoutot Exp $ +# $OpenBSD: syspatch.sh,v 1.13 2016/09/10 16:19:14 ajacoutot Exp $ # # Copyright (c) 2016 Antoine Jacoutot <ajacoutot@openbsd.org> # @@ -18,23 +18,21 @@ set -e -trap "syspatch_trap" 2 3 9 13 15 ERR +trap "rm -rf ${_TMP}; exit 1" 2 3 9 13 15 ERR -usage() +sp_err() { - echo "usage: ${0##*/} [-c | -l | -r]" >&2 && return 1 + echo "${@}" 1>&2 && return 1 } -needs_root() +usage() { - [[ $(id -u) -ne 0 ]] && echo "${0##*/}: need root privileges" && \ - return 1 + sp_err "usage: ${0##*/} [-c | -l | -r]" } -syspatch_trap() +needs_root() { - rm -rf ${_TMP} - exit 1 + [[ $(id -u) -ne 0 ]] && sp_err "${0##*/}: need root privileges" } apply_patches() |