Blame 0012-test-TEST-30-ISCSI-add-rd.shell-to-client-root.patch

Harald Hoyer e09d6b
From ece72160cedbe47b973a7925d5e2f5adc409a849 Mon Sep 17 00:00:00 2001
Harald Hoyer e09d6b
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer e09d6b
Date: Tue, 22 Jul 2014 14:22:21 +0200
Harald Hoyer e09d6b
Subject: [PATCH] test/TEST-30-ISCSI: add rd.shell to client root
Harald Hoyer e09d6b
Harald Hoyer e09d6b
---
Harald Hoyer e09d6b
 test/TEST-30-ISCSI/client-init.sh | 6 ++++++
Harald Hoyer e09d6b
 1 file changed, 6 insertions(+)
Harald Hoyer e09d6b
Harald Hoyer e09d6b
diff --git a/test/TEST-30-ISCSI/client-init.sh b/test/TEST-30-ISCSI/client-init.sh
Harald Hoyer e09d6b
index e78db27..b3e2ee1 100755
Harald Hoyer e09d6b
--- a/test/TEST-30-ISCSI/client-init.sh
Harald Hoyer e09d6b
+++ b/test/TEST-30-ISCSI/client-init.sh
Harald Hoyer e09d6b
@@ -1,6 +1,8 @@
Harald Hoyer e09d6b
 #!/bin/sh
Harald Hoyer e09d6b
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
Harald Hoyer e09d6b
 exec >/dev/console 2>&1
Harald Hoyer e09d6b
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
Harald Hoyer e09d6b
+CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
Harald Hoyer e09d6b
 export TERM=linux
Harald Hoyer e09d6b
 export PS1='initramfs-test:\w\$ '
Harald Hoyer e09d6b
 stty sane
Harald Hoyer e09d6b
@@ -11,4 +13,8 @@ while read dev fs fstype opts rest; do
Harald Hoyer e09d6b
     break
Harald Hoyer e09d6b
 done < /proc/mounts
Harald Hoyer e09d6b
 #sh -i
Harald Hoyer e09d6b
+if strstr "$CMDLINE" "rd.shell"; then
Harald Hoyer e09d6b
+	strstr "$(setsid --help)" "control" && CTTY="-c"
Harald Hoyer e09d6b
+	setsid $CTTY sh -i
Harald Hoyer e09d6b
+fi
Harald Hoyer e09d6b
 poweroff -f