From 538bf5e3e2dca1cf5baca039d904d58b63b479e8 Mon Sep 17 00:00:00 2001 From: ajacoutot Date: Fri, 29 Dec 2017 18:56:36 +0000 Subject: [PATCH] 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@ --- usr.sbin/syspatch/syspatch.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 | -- 2.20.1