From e134f0e4f35fba81acb04433a3548053716d5717 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Sun, 5 Mar 2017 16:05:48 +0100 Subject: [PATCH] rc: trap CTRL-C for importer, exit gracefully for resuming boot --- src/etc/rc | 2 +- src/etc/rc.importer | 33 ++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/etc/rc b/src/etc/rc index 6e89279e0..8c0878dfc 100755 --- a/src/etc/rc +++ b/src/etc/rc @@ -100,7 +100,7 @@ fi /etc/rc.d/syscons onestart # run the config importer during early startup -/usr/local/etc/rc.importer -b || exit 1 +/usr/local/etc/rc.importer -b # Enable console output if its muted. /sbin/conscontrol mute off > /dev/null diff --git a/src/etc/rc.importer b/src/etc/rc.importer index 41178f298..59a32581a 100755 --- a/src/etc/rc.importer +++ b/src/etc/rc.importer @@ -27,21 +27,6 @@ INSTALL="/.probe.for.install.media" MNT="/tmp/hdrescue" -DO_BOOT= - -while getopts b OPT; do - case ${OPT} in - b) - DO_BOOT="-b" - shift - ;; - *) - echo "Unknown argument during import." >&2 - exit 0 - ;; - esac -done - bootstrap_and_exit() { # ensure config directory structure @@ -64,6 +49,24 @@ bootstrap_and_exit() exit 0 } + +trap bootstrap_and_exit 2 + +DO_BOOT= + +while getopts b OPT; do + case ${OPT} in + b) + DO_BOOT="-b" + shift + ;; + *) + echo "Unknown argument during import." >&2 + bootstrap_and_exit + ;; + esac +done + timeout_prompt() { OUTPUT=$(echo ${2} | sed 's/./& /g')