From 3763acafaafd7ebc94a528f5e6abe4e8c148ffd0 Mon Sep 17 00:00:00 2001 From: kn Date: Tue, 4 Oct 2022 19:59:10 +0000 Subject: [PATCH] Replace temporary file with variable On supported -release systems, syspatch(8) -c is run from rc.firsttime(8) and the list of patches it pretty-printed if non-empty. -c output fits into a shell variable, not needing a temporary file, which is also what usr.sbin/syspatch/syspatch.sh does internally. OK millert --- distrib/miniroot/install.sub | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 8af91b509c0..a93aa574782 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1208 2022/10/04 19:34:44 kn Exp $ +# $OpenBSD: install.sub,v 1.1209 2022/10/04 19:59:10 kn Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer @@ -2905,15 +2905,13 @@ finish_up() { isin "$ARCH" $_syspatch_archs && cat <<'__EOT' >>/mnt/etc/rc.firsttime set -A _KERNV -- $(sysctl -n kern.version | sed 's/^OpenBSD \([1-9][0-9]*\.[0-9]\)\([^ ]*\).*/\1 \2/;q') -if ((${#_KERNV[*]} == 1)) && [[ -s /etc/installurl ]] && - _CKPATCH=$(mktemp /tmp/_ckpatch.XXXXXXXXXX); then +if ((${#_KERNV[*]} == 1)) && [[ -s /etc/installurl ]]; then echo "Checking for available binary patches..." - syspatch -c > $_CKPATCH - if [[ -s $_CKPATCH ]]; then + _CKPATCH=$(syspatch -c) + if [[ -n $_CKPATCH ]]; then echo "Run syspatch(8) to install:" - column -xc 80 $_CKPATCH + echo "$_CKPATCH" | column -xc 80 fi - rm -f $_CKPATCH fi __EOT -- 2.20.1