diff options
author | 2017-05-05 08:07:36 +0000 | |
---|---|---|
committer | 2017-05-05 08:07:36 +0000 | |
commit | b40f9483777fcf92becc1ba3902c687c0f9c83e5 (patch) | |
tree | f951b84c9c90dd3f3d42346086bc2ac10dcef2a8 | |
parent | Allow vmd(8) to set guest %xcr0 (diff) | |
download | wireguard-openbsd-b40f9483777fcf92becc1ba3902c687c0f9c83e5.tar.xz wireguard-openbsd-b40f9483777fcf92becc1ba3902c687c0f9c83e5.zip |
Add a `-R' switch that reverts all patches.
prodded by deraadt@
knobs sorting input jmc@
ok sthen@
-rw-r--r-- | usr.sbin/syspatch/syspatch.8 | 8 | ||||
-rw-r--r-- | usr.sbin/syspatch/syspatch.sh | 17 |
2 files changed, 14 insertions, 11 deletions
diff --git a/usr.sbin/syspatch/syspatch.8 b/usr.sbin/syspatch/syspatch.8 index cbe73542974..41cd5a6bf3b 100644 --- a/usr.sbin/syspatch/syspatch.8 +++ b/usr.sbin/syspatch/syspatch.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: syspatch.8,v 1.16 2017/04/08 20:36:50 schwarze Exp $ +.\" $OpenBSD: syspatch.8,v 1.17 2017/05/05 08:07:36 ajacoutot Exp $ .\" .\" Copyright (c) 2016 Antoine Jacoutot <ajacoutot@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 8 2017 $ +.Dd $Mdocdate: May 5 2017 $ .Dt SYSPATCH 8 .Os .Sh NAME @@ -22,7 +22,7 @@ .Nd manage base system binary patches .Sh SYNOPSIS .Nm syspatch -.Op Fl c | l | r +.Op Fl c | l | R | r .Sh DESCRIPTION .Nm is a utility to fetch, verify, install and revert @@ -44,6 +44,8 @@ List available patches; suitable for .Xr cron 8 . .It Fl l List installed patches. +.It Fl R +Revert all patches. .It Fl r Revert the most recently installed patch. .El diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh index 671574d2776..8b3aa32158f 100644 --- a/usr.sbin/syspatch/syspatch.sh +++ b/usr.sbin/syspatch/syspatch.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: syspatch.sh,v 1.98 2017/05/04 12:28:14 ajacoutot Exp $ +# $OpenBSD: syspatch.sh,v 1.99 2017/05/05 08:07:36 ajacoutot Exp $ # # Copyright (c) 2016, 2017 Antoine Jacoutot <ajacoutot@openbsd.org> # @@ -26,7 +26,7 @@ sp_err() usage() { - sp_err "usage: ${0##*/} [-c | -l | -r]" + sp_err "usage: ${0##*/} [-c | -l | -R | -r]" } apply_patch() @@ -206,7 +206,7 @@ rollback_patch() local _explodir _file _files _patch _ret=0 _patch="$(ls_installed | tail -1)" - [[ -n ${_patch} ]] + [[ -n ${_patch} ]] || return # function used as a while condition _explodir=${_TMP}/${_patch}-rollback _patch=${_OSrev}-${_patch} @@ -297,12 +297,13 @@ readonly _BSDMP _KERNV _MIRROR _OSrev _PDIR _TMP trap 'set +e; rm -rf "${_TMP}"' EXIT trap exit HUP INT TERM -while getopts clr arg; do +while getopts clRr arg; do case ${arg} in - c) ls_missing;; - l) ls_installed;; - r) rollback_patch;; - *) usage;; + c) ls_missing ;; + l) ls_installed ;; + R) while rollback_patch; do :; done ;; + r) rollback_patch ;; + *) usage ;; esac done shift $((OPTIND - 1)) |