diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2018-09-18 17:43:41 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2018-09-18 17:43:41 +0000 |
commit | 10ca7ff5e2811cb9f65f8234702688c13e3a4614 (patch) | |
tree | 4ca8d7442c2965fbb8628036765c3476d5608ea7 /distrib | |
parent | 044c00b9a7cd350924bc0f5b8ec7c5a493a91ea1 (diff) |
The dmesg buffer is sufficiently large now that using the accumulated
output from several boots in the dmesg listener can overflow the
ramdisk, so use only one boot's worth of dmesg in the listener.
sed(1) expression from kn@. ok deraadt@
Diffstat (limited to 'distrib')
-rw-r--r-- | distrib/miniroot/install.sub | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 1585d6c15d7..869c42c1a4c 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1102 2018/08/29 11:30:48 krw Exp $ +# $OpenBSD: install.sub,v 1.1103 2018/09/18 17:43:40 naddy Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org> @@ -263,6 +263,11 @@ lease_value() { done } +# Extract one boot's worth of dmesg. +dmesgtail() { + dmesg | sed -n 'H;/^OpenBSD/h;${g;p;}' +} + # ------------------------------------------------------------------------------ # Device related functions # ------------------------------------------------------------------------------ @@ -546,8 +551,8 @@ start_dmesg_listener() { # the update file and sends a signal to the parent process (that # is the installer script) if the dmesg output differs from the # contents of that file. - if [[ -e $_update && "$(dmesg)" != "$(<$_update)" ]]; then - dmesg >$_update + if [[ -e $_update && "$(dmesgtail)" != "$(<$_update)" ]]; then + dmesgtail >$_update kill -TERM 2>/dev/null $$ || exit 1 fi unlock @@ -708,7 +713,7 @@ _autorespond() { _ask() { local _q=$1 _def=$2 _int _redo=0 _pid - lock; dmesg >/tmp/i/update; unlock + lock; dmesgtail >/tmp/i/update; unlock echo -n "${_q:+$_q }${_def:+[$_def] }" _autorespond "$_q" "$_def" && echo "$resp" && return trap "_int=1" INT @@ -3267,8 +3272,8 @@ V4_DHCPCONF=false V6_AUTOCONF=false WLANLIST=/tmp/i/wlanlist -# Extract and save one boot's worth of dmesg. -dmesg | sed -n '/^OpenBSD /h;/^OpenBSD /!H;${g;p;}' >/var/run/dmesg.boot +# Save one boot's worth of dmesg. +dmesgtail >/var/run/dmesg.boot # Are we in a real release, or a snapshot? If this is a snapshot # install media, default us to a snapshot directory. |