From: ajacoutot Date: Fri, 29 Dec 2017 18:56:36 +0000 (+0000) Subject: Prevent syspatch from running and throw an error out if reorder_kernel is X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=538bf5e3e2dca1cf5baca039d904d58b63b479e8;p=openbsd Prevent syspatch from running and throw an error out if reorder_kernel is running. This is to prevent syspatch from installing new kernel object files while reordering is in progress (typically after an install/upgrade on slow machines). req. by and OK sthen@ --- diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh index 3b5cc4b8ab0..9c4f5c54252 100644 --- a/usr.sbin/syspatch/syspatch.sh +++ b/usr.sbin/syspatch/syspatch.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: syspatch.sh,v 1.133 2017/11/09 14:59:07 ajacoutot Exp $ +# $OpenBSD: syspatch.sh,v 1.134 2017/12/29 18:56:36 ajacoutot Exp $ # # Copyright (c) 2016, 2017 Antoine Jacoutot # @@ -251,6 +251,8 @@ unpriv() [[ $@ == @(|-[[:alpha:]]) ]] || usage; [[ $@ == @(|-(c|R|r)) ]] && (($(id -u) != 0)) && sp_err "${0##*/}: need root privileges" +[[ $@ == @(|-(R|r)) ]] && pgrep -qxf '/bin/ksh .*reorder_kernel' && + sp_err "${0##*/}: cannot apply patches while reorder_kernel is running" # only run on release (not -current nor -stable) set -A _KERNV -- $(sysctl -n kern.version |