From cf836c35a6a02fbd7e61b956296dff94f9fe0515 Mon Sep 17 00:00:00 2001
From: Scott McCarty <scott.mccarty@gmail.com>
Date: Wed, 8 Jul 2015 06:09:53 -0400
Subject: [PATCH 1/2] Created a much more sophisticated check for whether
 storage has really been moved off the root volume

Signed-off-by: Scott McCarty <smccarty@redhat.com>
---
 tests/1_1_check.sh            | 19 +++++++++++++++++++
 tests/1_host_configuration.sh |  2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100755 tests/1_1_check.sh

diff --git a/tests/1_1_check.sh b/tests/1_1_check.sh
new file mode 100755
index 0000000..4bde2e1
--- /dev/null
+++ b/tests/1_1_check.sh
@@ -0,0 +1,19 @@
+# Run tests
+THINPOOLDEV=`ps -ef | grep docker | awk '/--storage-opt/ { for (x=1;x<=NF;x++) if ($x~"--storage-opt") print $(x+1) }' | grep thinpooldev | awk -F\= '{print $2}'`
+ROOTVOLUME=`df -P | grep " \/$" | awk '{print $1}'`
+SEPARATEPARTITION=`grep /var/lib/docker /etc/fstab`
+
+# Verify that somebody didn't put a dummy entry in /etc/fstab and are really 
+# using devicemapper
+if [ "$SEPARATEPARTITION" ] && [ ! "$THINPOOLDEV" ]; then
+	RETVAL=0
+
+# Verify that THINPOOLDEV exists and is not the same as root volume. I am not
+# completely sure you could ever do this, but figured it's a safer check
+elif [ "$THINPOOLDEV" ] && [ "$THINPOOLDEV" != "$ROOTVOLUME" ]; then
+	RETVAL=0
+else
+	RETVAL=1
+fi
+
+return $RETVAL	
diff --git a/tests/1_host_configuration.sh b/tests/1_host_configuration.sh
index 9d0b72d..6d35ce3 100644
--- a/tests/1_host_configuration.sh
+++ b/tests/1_host_configuration.sh
@@ -5,7 +5,7 @@ info "1 - Host Configuration"
 
 # 1.1
 check_1_1="1.1  - Create a separate partition for containers"
-grep /var/lib/docker /etc/fstab >/dev/null 2>&1
+sh 1_1_check.sh 2>&1
 if [ $? -eq 0 ]; then
   pass "$check_1_1"
 else

From 3f1e2c7c13b459a9a9e69894da5ca6ad39f9ed5a Mon Sep 17 00:00:00 2001
From: Scott McCarty <scott.mccarty@gmail.com>
Date: Wed, 8 Jul 2015 16:46:02 -0400
Subject: [PATCH 2/2] Made some minor changes after check with ShellCheck. 
 Also fixed sourcing and verified that things work right with bash -x.

Signed-off-by: Scott McCarty <smccarty@redhat.com>
---
 tests/1_1_check.sh            | 9 ++++-----
 tests/1_host_configuration.sh | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/1_1_check.sh b/tests/1_1_check.sh
index 4bde2e1..4a3f972 100755
--- a/tests/1_1_check.sh
+++ b/tests/1_1_check.sh
@@ -1,7 +1,6 @@
-# Run tests
-THINPOOLDEV=`ps -ef | grep docker | awk '/--storage-opt/ { for (x=1;x<=NF;x++) if ($x~"--storage-opt") print $(x+1) }' | grep thinpooldev | awk -F\= '{print $2}'`
-ROOTVOLUME=`df -P | grep " \/$" | awk '{print $1}'`
-SEPARATEPARTITION=`grep /var/lib/docker /etc/fstab`
+THINPOOLDEV=$(ps -ef | grep docker | awk '/--storage-opt/ { for (x=1;x<=NF;x++) if ($x~"--storage-opt") print $(x+1) }' | grep thinpooldev | awk -F= '{print $2}')
+ROOTVOLUME=$(df -P | grep " \/$" | awk '{print $1}')
+SEPARATEPARTITION=$(grep /var/lib/docker /etc/fstab)
 
 # Verify that somebody didn't put a dummy entry in /etc/fstab and are really 
 # using devicemapper
@@ -16,4 +15,4 @@ else
 	RETVAL=1
 fi
 
-return $RETVAL	
+return $RETVAL
diff --git a/tests/1_host_configuration.sh b/tests/1_host_configuration.sh
index 6d35ce3..d4bdd3c 100644
--- a/tests/1_host_configuration.sh
+++ b/tests/1_host_configuration.sh
@@ -5,7 +5,7 @@ info "1 - Host Configuration"
 
 # 1.1
 check_1_1="1.1  - Create a separate partition for containers"
-sh 1_1_check.sh 2>&1
+source tests/1_1_check.sh 2>&1
 if [ $? -eq 0 ]; then
   pass "$check_1_1"
 else