diff options
author | Alexander Hall <halex@cvs.openbsd.org> | 2013-12-04 21:21:36 +0000 |
---|---|---|
committer | Alexander Hall <halex@cvs.openbsd.org> | 2013-12-04 21:21:36 +0000 |
commit | 40799001045ca3aada24643cea2c88116e097737 (patch) | |
tree | 2234b407553e8d439d35ccc78a6d2b8421d83827 | |
parent | d6fd712f6b0e7771467e8e58bd88daf5b585c9c0 (diff) |
Defer spooling of the install log output mail until we are up and
running again, with our mail system of choice running.
ok deraadt@
-rw-r--r-- | distrib/miniroot/install.sub | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 099f9f8179c..57dd3896871 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.711 2013/12/04 16:19:32 krw Exp $ +# $OpenBSD: install.sub,v 1.712 2013/12/04 21:21:35 halex Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback @@ -2177,20 +2177,14 @@ if $auto && [[ -z $RESPONSEFILE ]]; then RESPONSEFILE=/$action.conf /$action auto 2>&1 </dev/null | sed 'w/ai.log' if [[ -f /ai.done ]]; then - _sf=/mnt/var/mail/root - (_root="root@$(hostname)" - cat <<__EOT -From $_root $(date -u '+%a %b %d %T %Y') -Date: $(date '+%a, %d %b %Y %T %z (%Z)') -From: root <$_root> -To: $_root -Subject: $action log - -__EOT - sed 's/^.*
//;s/^\(>*From \)/>\1/' /ai.log - echo) >>$_sf - chmod 600 $_sf - echo "done." + # Generate unique filename and let rc.firsttime feed it to + # whatever mail system we have at hand by then. + while _lf=/mnt/var/tmp/ai.log.$RANDOM && test -e $_lf; do done + sed 's/^.*
//' /ai.log >> $_lf + chmod 600 $_lf + _lf=${_lf#/mnt} + echo "( /usr/bin/mail -s '$action log' root < $_lf &&" \ + "rm $_lf ) >/dev/null 2>&1 &" >> /mnt/etc/rc.firsttime exec reboot else echo "failed; check /ai.log" |