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
This commit is contained in:
Olaf Hering 2012-09-07 14:32:27 +00:00 committed by Git OBS Bridge
parent 01411068c2
commit 4e25bbb654

View File

@ -87,6 +87,9 @@
#%programs: date #%programs: date
#%programs: valgrind #%programs: valgrind
#%programs: guestfsd #%programs: guestfsd
#%programs: find
#%programs: xargs
#%programs: setctsid
# #
# Generated at build time: # Generated at build time:
#@GUESTFS_EXT_CMDS@ #@GUESTFS_EXT_CMDS@
@ -154,6 +157,10 @@ else
# Use appliance in rescue mode, also used by the virt-rescue command. # Use appliance in rescue mode, also used by the virt-rescue command.
eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline) eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
PS1='><rescue> ' PS1='><rescue> '
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 export TERM PS1
echo echo
echo "------------------------------------------------------------" echo "------------------------------------------------------------"
@ -164,7 +171,7 @@ else
echo "You have to mount the guest's partitions under /sysroot" echo "You have to mount the guest's partitions under /sysroot"
echo "before you can examine them." echo "before you can examine them."
echo echo
bash -i setctsid "/dev/${console_kname}" bash -i
echo echo
echo "virt-rescue: Syncing the disk now before exiting ..." echo "virt-rescue: Syncing the disk now before exiting ..."
echo echo