From 4e25bbb6545f912eb6ce99f340abd542629f613379c94e10e884e51159a99536 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Fri, 7 Sep 2012 14:32:27 +0000 Subject: [PATCH] run the rescue shell with setctsid so that it gets a controlling tty OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=81 --- libguestfs.mkinitrd.boot.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libguestfs.mkinitrd.boot.sh b/libguestfs.mkinitrd.boot.sh index c83f418..9570314 100644 --- a/libguestfs.mkinitrd.boot.sh +++ b/libguestfs.mkinitrd.boot.sh @@ -87,6 +87,9 @@ #%programs: date #%programs: valgrind #%programs: guestfsd +#%programs: find +#%programs: xargs +#%programs: setctsid # # Generated at build time: #@GUESTFS_EXT_CMDS@ @@ -154,6 +157,10 @@ else # Use appliance in rescue mode, also used by the virt-rescue command. eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline) PS1='> ' + console_major_minor="`sed 's@^.* @@;p;Q' < /proc/consoles `" + console_dev="`find /sys/ -name dev -type f -print0 | xargs -0 --no-run-if-empty grep -m 1 -l ${console_major_minor}`" + console_kname=${console_dev%/dev} + console_kname=${console_kname##*/} export TERM PS1 echo echo "------------------------------------------------------------" @@ -164,7 +171,7 @@ else echo "You have to mount the guest's partitions under /sysroot" echo "before you can examine them." echo - bash -i + setctsid "/dev/${console_kname}" bash -i echo echo "virt-rescue: Syncing the disk now before exiting ..." echo