From 331b1f46d392235de980a8a9d1815d62209c3dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sun, 11 Mar 2012 22:01:46 +0000 Subject: [PATCH] Making the stage2 'debug2' spawn a shell with job control, like in stage1, running it in a virtual terminal and not in the console. This brings wonderful things like ^C. svn path=/nixos/trunk/; revision=33001 --- modules/system/boot/stage-2-init.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/system/boot/stage-2-init.sh b/modules/system/boot/stage-2-init.sh index 947ba4b7f352..589cd2c79273 100644 --- a/modules/system/boot/stage-2-init.sh +++ b/modules/system/boot/stage-2-init.sh @@ -170,8 +170,19 @@ export MODULE_DIR=@kernel@/lib/modules/ # For debugging Upstart. if [ -n "$debug2" ]; then + # Get the console from the kernel cmdline + console=tty1 + for o in $(cat /proc/cmdline); do + case $o in + console=*) + set -- $(IFS==; echo $o) + console=$2 + ;; + esac + done + echo "Debug shell called from @out@" - @shell@ + setsid @shell@ < /dev/$console >/dev/$console 2>/dev/console fi