Harald Hoyer 1ee1e3
From d8eb522e8062751f53def079ac1bab8f1c05a401 Mon Sep 17 00:00:00 2001
Harald Hoyer 1ee1e3
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 1ee1e3
Date: Wed, 14 Mar 2012 16:32:19 +0100
Harald Hoyer 1ee1e3
Subject: [PATCH] TEST-01-BASIC: add setsid
Harald Hoyer 1ee1e3
Harald Hoyer 1ee1e3
---
Harald Hoyer 1ee1e3
 test/TEST-01-BASIC/test-init.sh |    5 ++++-
Harald Hoyer 1ee1e3
 test/TEST-01-BASIC/test.sh      |    2 +-
Harald Hoyer 1ee1e3
 2 files changed, 5 insertions(+), 2 deletions(-)
Harald Hoyer 1ee1e3
Harald Hoyer 1ee1e3
diff --git a/test/TEST-01-BASIC/test-init.sh b/test/TEST-01-BASIC/test-init.sh
Harald Hoyer 1ee1e3
index fd03aa5..f8d6693 100755
Harald Hoyer 1ee1e3
--- a/test/TEST-01-BASIC/test-init.sh
Harald Hoyer 1ee1e3
+++ b/test/TEST-01-BASIC/test-init.sh
Harald Hoyer 1ee1e3
@@ -11,7 +11,10 @@ export PS1='initramfs-test:\w\$ '
Harald Hoyer 1ee1e3
 [ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
Harald Hoyer 1ee1e3
 stty sane
Harald Hoyer 1ee1e3
 echo "made it to the rootfs!"
Harald Hoyer 1ee1e3
-strstr "$CMDLINE" "rd.shell" && sh -i
Harald Hoyer 1ee1e3
+if strstr "$CMDLINE" "rd.shell"; then
Harald Hoyer 1ee1e3
+	strstr "$(setsid --help)" "control" && CTTY="-c"
Harald Hoyer 1ee1e3
+	setsid $CTTY sh -i
Harald Hoyer 1ee1e3
+fi
Harald Hoyer 1ee1e3
 echo "Powering down."
Harald Hoyer 1ee1e3
 mount -n -o remount,ro /
Harald Hoyer 1ee1e3
 poweroff -f
Harald Hoyer 1ee1e3
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
Harald Hoyer 1ee1e3
index ca7a1fe..6187144 100755
Harald Hoyer 1ee1e3
--- a/test/TEST-01-BASIC/test.sh
Harald Hoyer 1ee1e3
+++ b/test/TEST-01-BASIC/test.sh
Harald Hoyer 1ee1e3
@@ -29,7 +29,7 @@ test_setup() {
Harald Hoyer 1ee1e3
 	. $basedir/dracut-functions.sh
Harald Hoyer 1ee1e3
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
Harald Hoyer 1ee1e3
 	    mount dmesg ifconfig dhclient mkdir cp ping dhclient \
Harald Hoyer 1ee1e3
-	    umount strace less
Harald Hoyer 1ee1e3
+	    umount strace less setsid
Harald Hoyer 1ee1e3
 	for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
Harald Hoyer 1ee1e3
             [ -f ${_terminfodir}/l/linux ] && break
Harald Hoyer 1ee1e3
 	done