From 4107d367a686622974660c1dc45bc8e40d50624d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 20 Nov 2014 22:22:49 +0000
Subject: [PATCH] p2v: Include version and md5sum in kickstart.
Include the version of virt-p2v and its MD5 checksum in the source
kickstart. This is useful for working out which version of virt-p2v
the kickstart corresponds to.
(cherry picked from commit c64467a4c1a31de1134084a15a4acb841557140f)
---
p2v/p2v.ks.in | 3 ++-
p2v/virt-p2v-make-kickstart.in | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/p2v/p2v.ks.in b/p2v/p2v.ks.in
index 9f55e18..26bb925 100644
--- a/p2v/p2v.ks.in
+++ b/p2v/p2v.ks.in
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-# Generated by virt-p2v-make-kickstart.
+# Generated by virt-p2v-make-kickstart __PACKAGE_VERSION__.
lang en_US.UTF-8
keyboard us
@@ -102,6 +102,7 @@ EOF
systemctl enable p2v.service
# Base64-decoding of virt-p2v binary
+# md5(virt-p2v) = __MD5SUM_VIRT_P2V__
base64 -d <<EOF | gzip -cd > __LIBEXECDIR__/virt-p2v
__BASE64_VIRT_P2V__
diff --git a/p2v/virt-p2v-make-kickstart.in b/p2v/virt-p2v-make-kickstart.in
index a2937b3..22a4eaa 100644
--- a/p2v/virt-p2v-make-kickstart.in
+++ b/p2v/virt-p2v-make-kickstart.in
@@ -97,6 +97,7 @@ base64_p2v_service="$(base64 $datadir/p2v.service)"
# virt-p2v binary is too large unless we strip it and compress it.
tmpfile="$(mktemp -u)"
cp $host_libexecdir/virt-p2v $tmpfile
+md5sum_virt_p2v="$(md5sum $tmpfile | @AWK@ '{print $1}')"
strip --strip-all $tmpfile
gzip -9 $tmpfile
base64_virt_p2v="$(base64 $tmpfile.gz)"
@@ -139,6 +140,7 @@ done
-v "base64_launch_virt_p2v=$base64_launch_virt_p2v" \
-v "base64_p2v_service=$base64_p2v_service" \
-v "base64_virt_p2v=$base64_virt_p2v" \
+ -v "md5sum_virt_p2v=$md5sum_virt_p2v" \
-v "repos=$repos" \
-v "libexecdir=$libexecdir" \
'{
@@ -148,6 +150,7 @@ done
gsub (/__BASE64_LAUNCH_VIRT_P2V__/, base64_launch_virt_p2v);
gsub (/__BASE64_P2V_SERVICE__/, base64_p2v_service);
gsub (/__BASE64_VIRT_P2V__/, base64_virt_p2v);
+ gsub (/__MD5SUM_VIRT_P2V__/, md5sum_virt_p2v);
gsub (/__REPOS__/, repos);
gsub (/__LIBEXECDIR__/, libexecdir);
print;
--
1.8.3.1