diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2017-05-05 08:07:37 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2017-05-05 08:07:37 +0000 |
commit | 9fdc055a7bc989fbc91e5f33db3912f9aeb48772 (patch) | |
tree | 03455547b4b1c4f8e33e11708ea122084ffcbb6b /usr.sbin/syspatch/syspatch.sh | |
parent | 823402a64be3bb4d13b63e10763666a30622fa68 (diff) |
Add a `-R' switch that reverts all patches.
prodded by deraadt@
knobs sorting input jmc@
ok sthen@
Diffstat (limited to 'usr.sbin/syspatch/syspatch.sh')
-rw-r--r-- | usr.sbin/syspatch/syspatch.sh | 17 |
1 files changed, 9 insertions, 8 deletions
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)) |