diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2016-12-08 09:47:38 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2016-12-08 09:47:38 +0000 |
commit | 4ae5207aa474ae9230a65d5ee12d0c053371fccb (patch) | |
tree | a7c65323fc51a52c06d25ba5bbc811a9bd29e82b /usr.sbin/syspatch | |
parent | 0f630a62f42440d49c043968238e7ccb983e48f3 (diff) |
Make it possible to install patches even if we don't have all sets installed
(e.g. no x sets); in this case, syspatch will skip the patch *but* it will still
be listed as available. This will allow applying the patch in case sets are
installed later on.
Diffstat (limited to 'usr.sbin/syspatch')
-rw-r--r-- | usr.sbin/syspatch/syspatch.8 | 17 | ||||
-rw-r--r-- | usr.sbin/syspatch/syspatch.sh | 12 |
2 files changed, 17 insertions, 12 deletions
diff --git a/usr.sbin/syspatch/syspatch.8 b/usr.sbin/syspatch/syspatch.8 index 58a3b5e7fd6..90dbd4a520b 100644 --- a/usr.sbin/syspatch/syspatch.8 +++ b/usr.sbin/syspatch/syspatch.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: syspatch.8,v 1.12 2016/11/30 12:58:28 ajacoutot Exp $ +.\" $OpenBSD: syspatch.8,v 1.13 2016/12/08 09:47:37 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: November 30 2016 $ +.Dd $Mdocdate: December 8 2016 $ .Dt SYSPATCH 8 .Os .Sh NAME @@ -31,9 +31,11 @@ binary patches. .Pp When run without any options, .Nm syspatch -will apply all missing patches by saving the original release kernel if needed, -creating a rollback tarball containing the files it is about to replace, -then extracting and installing all files contained in the syspatch tarball. +will apply +.Pa all +missing patches by saving the original release kernel if needed, creating a +rollback tarball containing the files it is about to replace, then extracting +and installing all files contained in the syspatch tarball. .Pp The options are as follows: .Bl -tag -width Ds @@ -69,5 +71,6 @@ was written by .An Antoine Jacoutot Aq Mt ajacoutot@openbsd.org . .Sh CAVEATS .Nm -only works on official releases and will always sync and apply all patches -regardless of the installed sets. +is designed to work solely on official +.Ox +releases. diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh index 557890cb1f9..a65ed527529 100644 --- a/usr.sbin/syspatch/syspatch.sh +++ b/usr.sbin/syspatch/syspatch.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: syspatch.sh,v 1.77 2016/12/07 15:36:50 ajacoutot Exp $ +# $OpenBSD: syspatch.sh,v 1.78 2016/12/08 09:47:37 ajacoutot Exp $ # # Copyright (c) 2016 Antoine Jacoutot <ajacoutot@openbsd.org> # @@ -47,6 +47,12 @@ apply_patch() create_rollback ${_patch} "${_files}" + # create_rollback(): tar(1) was fed with an empty list of files; that is + # not an error but no tarball is created; this happens if no earlier + # version of the files contained in the syspatch exists on the system + [[ ! -f ${_PDIR}/${_patch}/rollback.tgz ]] && unset _files && + echo "Missing set, skipping patch ${_patch##${_OSrev}-}" + for _file in ${_files}; do ((_ret == 0)) || break if [[ ${_file} == @(bsd|bsd.mp) ]]; then @@ -122,9 +128,6 @@ create_rollback() _ret=$? fi - # missing archive (empty _rbfiles list) - [[ -f ${_PDIR}/${_patch}/rollback.tgz ]] || _ret=$? - if ((_ret != 0)); then sp_err "Failed to create rollback patch ${_patch##${_OSrev}-}" 0 rm -r ${_PDIR}/${_patch}; return ${_ret} @@ -180,7 +183,6 @@ ls_installed() ls_missing() { - # XXX match with installed sets local _c _idx=${_TMP}/idx.txt _l="$(ls_installed)" unpriv -f "${_idx}" ${_FETCH} -o "${_idx}" "${_URL}/index.txt" |