[Libguestfs] [PATCH 48/61] p2v-systemd: nogui startup, View log option on fail

Maros Zatko mzatko at redhat.com
Wed Feb 12 14:31:00 UTC 2014


---
 p2v/image-builder/p2v-systemd.ks | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/p2v/image-builder/p2v-systemd.ks b/p2v/image-builder/p2v-systemd.ks
index 33b4716..0ff6ab9 100644
--- a/p2v/image-builder/p2v-systemd.ks
+++ b/p2v/image-builder/p2v-systemd.ks
@@ -18,7 +18,13 @@ Xlog=/tmp/X.log
 again=$(mktemp)
 
 while [ -f "$again" ]; do
-    /usr/bin/xinit /usr/bin/virt-p2v-launcher > $Xlog 2>&1
+    if [[ $(cat /proc/cmdline) =~ "p2v_nogui=true" ]] ; then
+      /usr/bin/openvt -sw -c 7 -f -- bash -c "
+/usr/bin/virt-p2v-launcher -nogui 2>&1 | tee -a $Xlog
+"
+    else
+      /usr/bin/xinit /usr/bin/virt-p2v-launcher > $Xlog 2>&1
+    fi
 
     # virt-p2v-launcher will have touched this file if it ran
     if [ -f /tmp/virt-p2v-launcher ]; then
@@ -26,12 +32,13 @@ while [ -f "$again" ]; do
         break
     fi
 
-    /usr/bin/openvt -sw -- /bin/bash -c "
+    /usr/bin/openvt -sw -c 7 -f -- /bin/bash -c "
 echo virt-p2v-launcher failed
 select c in \
     \"Try again\" \
     \"Debug\" \
-    \"Power off\"
+    \"Power off\" \
+    \"View log\"
 do
     if [ \"\$c\" == Debug ]; then
         echo Output was written to $Xlog
@@ -40,6 +47,9 @@ do
         bash -l
     elif [ \"\$c\" == \"Power off\" ]; then
         rm $again
+    elif [ \"\$c\" == \"View log\" ]; then
+        TERM=xterm less /tmp/X.log
+        continue
     fi
     break
 done
-- 
1.8.3.1




More information about the Libguestfs mailing list