summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2023-03-10 10:33:41 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2023-03-10 10:33:41 +0000
commitbe10c5757471ccee4110273ada5f8c25d8b1743f (patch)
treeb8815515530b299bcd9674b7d540c85a22218e99
parentcfe35f548573731d5fb7d5325edd6ee4e3040e05 (diff)
Fix error on installer abort/exit
^C during questiong yields /install: /tmp/cppid: cannot open $(<) input The trap handler must first test existence, then read the PID file. Quote like other PID file constructs in install.sub do. Use newlines to make the trap function readable. OK miod
-rw-r--r--distrib/miniroot/install.sub13
1 files changed, 10 insertions, 3 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 8a242480021..c5d0d7f1299 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1233 2023/03/09 19:49:57 naddy Exp $
+# $OpenBSD: install.sub,v 1.1234 2023/03/10 10:33:40 kn Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -557,8 +557,15 @@ unlock() {
# Add a trap to kill the dmesg listener co-process on exit of the installer.
retrap() {
- trap '_cppid=$(</tmp/cppid); if [ -n $_cppid ]; then kill -KILL -$_cppid 2>/dev/null; rm -f /tmp/cppid; fi; echo; stty echo; exit 0' \
- INT EXIT TERM
+ trap '
+ if [[ -f /tmp/cppid ]]; then
+ kill -KILL -"$(</tmp/cppid)" 2>/dev/null
+ rm -f /tmp/cppid
+ fi
+ echo
+ stty echo
+ exit 0
+ ' INT EXIT TERM
}
# Start a listener process looking for dmesg changes which indicates a possible