Blame SOURCES/0096-p2v-Add-verbose-option-to-virt-p2v-make-disk-kicksta.patch

e76f14
From 34ab1cf2d4f849b69a01ddb2eb7e87c80523f03f Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Thu, 2 Jun 2016 13:53:37 +0100
e76f14
Subject: [PATCH] p2v: Add --verbose option to virt-p2v-make-{disk,kickstart}.
e76f14
e76f14
For virt-p2v-make-kickstart this doesn't do very much.  But for
e76f14
virt-p2v-make-disk it enables verbose mode in virt-builder which is
e76f14
extremely useful for debugging problems.
e76f14
e76f14
Thanks: Ming Xie.
e76f14
(cherry picked from commit 6358633bf22d19c1bc9b9638dfff8e5ac50a37eb)
e76f14
---
e76f14
 p2v/virt-p2v-make-disk.in       | 13 ++++++++++++-
e76f14
 p2v/virt-p2v-make-disk.pod      |  7 +++++++
e76f14
 p2v/virt-p2v-make-kickstart.in  |  9 +++++++--
e76f14
 p2v/virt-p2v-make-kickstart.pod |  7 +++++++
e76f14
 4 files changed, 33 insertions(+), 3 deletions(-)
e76f14
e76f14
diff --git a/p2v/virt-p2v-make-disk.in b/p2v/virt-p2v-make-disk.in
e76f14
index 88c171f..d58e7f1 100644
e76f14
--- a/p2v/virt-p2v-make-disk.in
e76f14
+++ b/p2v/virt-p2v-make-disk.in
e76f14
@@ -24,7 +24,7 @@ version="@PACKAGE_VERSION@"
e76f14
 
e76f14
 TEMP=`getopt \
e76f14
         -o o:V \
e76f14
-        --long help,inject-ssh-identity:,output:,version \
e76f14
+        --long help,inject-ssh-identity:,output:,verbose,version \
e76f14
         -n $program -- "$@"`
e76f14
 if [ $? != 0 ]; then
e76f14
     echo "$program: problem parsing the command line arguments"
e76f14
@@ -34,6 +34,7 @@ eval set -- "$TEMP"
e76f14
 
e76f14
 output=
e76f14
 upload=
e76f14
+verbose=
e76f14
 
e76f14
 usage ()
e76f14
 {
e76f14
@@ -52,6 +53,10 @@ while true; do
e76f14
         -o|--output)
e76f14
             output="$2"
e76f14
             shift 2;;
e76f14
+        -v|--verbose)
e76f14
+            set +x
e76f14
+            verbose=1
e76f14
+            shift;;
e76f14
         -V|--version)
e76f14
             echo "$program $version"
e76f14
             exit 0;;
e76f14
@@ -170,9 +175,15 @@ while read line; do
e76f14
     fi
e76f14
 done < $depsfile
e76f14
 
e76f14
+# Add -v -x if we're in verbose mode.
e76f14
+if [ "x$verbose" = "x1" ]; then
e76f14
+    verbose_option="-v -x"
e76f14
+fi
e76f14
+
e76f14
 # Run virt-builder.  Note we controversially assume systemd here.  We
e76f14
 # could provide a sysvinit fallback if required.
e76f14
 virt-builder "$osversion"                                       \
e76f14
+    $verbose_option						\
e76f14
     --output "$output"                                          \
e76f14
     --update                                                    \
e76f14
     --install "$install"                                        \
e76f14
diff --git a/p2v/virt-p2v-make-disk.pod b/p2v/virt-p2v-make-disk.pod
e76f14
index 79bf499..d5a5db5 100644
e76f14
--- a/p2v/virt-p2v-make-disk.pod
e76f14
+++ b/p2v/virt-p2v-make-disk.pod
e76f14
@@ -106,6 +106,13 @@ See L</ADDING AN SSH IDENTITY> above.
e76f14
 Write output to C<OUTPUT>, which can be a local file or block device.
e76f14
 B<The existing contents of the device will be erased>.
e76f14
 
e76f14
+=item B<-v>
e76f14
+
e76f14
+=item B<--verbose>
e76f14
+
e76f14
+Enable verbose output.  Use this if you need to debug problems with
e76f14
+the script or if you are filing a bug.
e76f14
+
e76f14
 =item B<-V>
e76f14
 
e76f14
 =item B<--version>
e76f14
diff --git a/p2v/virt-p2v-make-kickstart.in b/p2v/virt-p2v-make-kickstart.in
e76f14
index 74bee61..8a6e4d8 100644
e76f14
--- a/p2v/virt-p2v-make-kickstart.in
e76f14
+++ b/p2v/virt-p2v-make-kickstart.in
e76f14
@@ -23,8 +23,8 @@ program="virt-p2v-make-kickstart"
e76f14
 version="@PACKAGE_VERSION@"
e76f14
 
e76f14
 TEMP=`getopt \
e76f14
-        -o o:V \
e76f14
-        --long help,inject-ssh-identity:,output:,proxy:,version \
e76f14
+        -o o:vV \
e76f14
+        --long help,inject-ssh-identity:,output:,proxy:,verbose,version \
e76f14
         -n $program -- "$@"`
e76f14
 if [ $? != 0 ]; then
e76f14
     echo "$program: problem parsing the command line arguments"
e76f14
@@ -44,6 +44,7 @@ usage ()
e76f14
 output=p2v.ks
e76f14
 proxy=
e76f14
 ssh_identity=
e76f14
+verbose=
e76f14
 
e76f14
 while true; do
e76f14
     case "$1" in
e76f14
@@ -59,6 +60,10 @@ while true; do
e76f14
         --repo)
e76f14
             repo="$2"
e76f14
             shift 2;;
e76f14
+        -v|--verbose)
e76f14
+            set +x
e76f14
+            verbose=1
e76f14
+            shift;;
e76f14
         -V|--version)
e76f14
             echo "$program $version"
e76f14
             exit 0;;
e76f14
diff --git a/p2v/virt-p2v-make-kickstart.pod b/p2v/virt-p2v-make-kickstart.pod
e76f14
index 6e65c07..cea3787 100644
e76f14
--- a/p2v/virt-p2v-make-kickstart.pod
e76f14
+++ b/p2v/virt-p2v-make-kickstart.pod
e76f14
@@ -254,6 +254,13 @@ F<p2v.ks> in the current directory.
e76f14
 
e76f14
 Tell the kickstart to use a proxy server or web cache for downloads.
e76f14
 
e76f14
+=item B<-v>
e76f14
+
e76f14
+=item B<--verbose>
e76f14
+
e76f14
+Enable verbose output.  Use this if you need to debug problems with
e76f14
+the script or if you are filing a bug.
e76f14
+
e76f14
 =item B<-V>
e76f14
 
e76f14
 =item B<--version>
e76f14
-- 
e76f14
1.8.3.1
e76f14