From 83de85e717ad525423b0eabe153b48ff8af90bd1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 17 May 2021 15:18:04 +0100
Subject: [PATCH] win-reg: Fix output of virt-win-reg --version
Before we split libguestfs and guestfs-tools the version of programs
was exactly the same as the version of libguestfs. This was
convenient for virt-win-reg where it is difficult to encode the
version into the script, because virt-win-reg could simply use the
version from Sys::Guestfs (ie. libguestfs). However after the split
this no longer applies, so we must do the difficult thing.
After this change virt-win-reg will print both the version of
guestfs-tools and the version of libguestfs, eg:
$ virt-win-reg --version
virt-win-reg 1.47.1
libguestfs 1.45.5fedora=35,release=1.fc35,libvirt
Reported-by: Yongkui Guo
Fixes: commit 4354a3126152a2748cc9097cba139b3908ccc342
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1961160
(cherry picked from commit 9e9eeeaf4c4b478eca82bf0d4c3e680a624d6d91)
---
.gitignore | 1 +
configure.ac | 2 ++
po-docs/podfiles | 2 +-
po/POTFILES-pl | 2 +-
po/guestfs-tools.pot | 18 +++++++++---------
win-reg/Makefile.am | 6 ------
win-reg/{virt-win-reg => virt-win-reg.in} | 5 +++--
7 files changed, 17 insertions(+), 19 deletions(-)
rename win-reg/{virt-win-reg => virt-win-reg.in} (99%)
diff --git a/.gitignore b/.gitignore
index 006042a8..6bc509fa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -163,3 +163,4 @@ Makefile.in
/test-data/phony-guests/windows-software
/test-data/phony-guests/windows-system
/website/*.html
+/win-reg/virt-win-reg
diff --git a/configure.ac b/configure.ac
index 56cfef57..ef412670 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,6 +99,8 @@ AC_CONFIG_FILES([podwrapper.pl],
[chmod +x,-w podwrapper.pl])
AC_CONFIG_FILES([run],
[chmod +x,-w run])
+AC_CONFIG_FILES([win-reg/virt-win-reg],
+ [chmod +x,-w win-reg/virt-win-reg])
AC_CONFIG_FILES([Makefile
align/Makefile
diff --git a/po-docs/podfiles b/po-docs/podfiles
index d7ef1389..6b0c481f 100644
--- a/po-docs/podfiles
+++ b/po-docs/podfiles
@@ -26,4 +26,4 @@ sparsify/virt-sparsify.pod
sysprep/sysprep-extra-options.pod
sysprep/sysprep-operations.pod
sysprep/virt-sysprep.pod
-win-reg/virt-win-reg
+win-reg/virt-win-reg.in
diff --git a/po/POTFILES-pl b/po/POTFILES-pl
index 47d30fc8..c6520cea 100644
--- a/po/POTFILES-pl
+++ b/po/POTFILES-pl
@@ -1 +1 @@
-win-reg/virt-win-reg
+win-reg/virt-win-reg.in
diff --git a/po/guestfs-tools.pot b/po/guestfs-tools.pot
index a3be1b95..d7e9a3a7 100644
--- a/po/guestfs-tools.pot
+++ b/po/guestfs-tools.pot
@@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: guestfs-tools 1.46.1\n"
"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?"
"component=libguestfs&product=Virtualization+Tools\n"
-"POT-Creation-Date: 2021-05-08 08:57+0100\n"
+"POT-Creation-Date: 2021-05-17 15:25+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -4213,11 +4213,11 @@ msgstr ""
msgid "%s: subprocess failed\n"
msgstr ""
-#: win-reg/virt-win-reg:260
+#: win-reg/virt-win-reg.in:261
msgid "no libvirt domain name or disk image given\n"
msgstr ""
-#: win-reg/virt-win-reg:316
+#: win-reg/virt-win-reg.in:317
#, perl-brace-format
msgid ""
"{prog}: No operating system could be detected inside this disk image.\n"
@@ -4230,33 +4230,33 @@ msgid ""
"information about the disk image as possible.\n"
msgstr ""
-#: win-reg/virt-win-reg:320
+#: win-reg/virt-win-reg.in:321
#, perl-brace-format
msgid "{prog}: multiboot operating systems are not supported.\n"
msgstr ""
-#: win-reg/virt-win-reg:342
+#: win-reg/virt-win-reg.in:343
msgid ""
"expecting 1 or 2 more parameters, subkey path and optionally the value to "
"export\n"
msgstr ""
-#: win-reg/virt-win-reg:502
+#: win-reg/virt-win-reg.in:503
#, perl-brace-format
msgid "virt-win-reg: {p}: cannot find user directory\n"
msgstr ""
-#: win-reg/virt-win-reg:507
+#: win-reg/virt-win-reg.in:508
#, perl-brace-format
msgid "virt-win-reg: {p}: not a supported Windows Registry path\n"
msgstr ""
-#: win-reg/virt-win-reg:580
+#: win-reg/virt-win-reg.in:581
#, perl-brace-format
msgid "virt-win-reg: {p}: could not download registry file: {err}\n"
msgstr ""
-#: win-reg/virt-win-reg:597
+#: win-reg/virt-win-reg.in:598
#, perl-brace-format
msgid "virt-win-reg: {p}: could not upload registry file: {err}\n"
msgstr ""
diff --git a/win-reg/Makefile.am b/win-reg/Makefile.am
index 22a22db4..61ec066a 100644
--- a/win-reg/Makefile.am
+++ b/win-reg/Makefile.am
@@ -17,8 +17,6 @@
include $(top_srcdir)/subdir-rules.mk
-EXTRA_DIST = virt-win-reg
-
bin_SCRIPTS = virt-win-reg
# Manual pages and HTML files for the website.
@@ -36,7 +34,3 @@ stamp-virt-win-reg.pod: virt-win-reg
--warning custom \
$<
touch $@
-
-all-local:
- for f in virt-win-reg; do echo win-reg/$$f; done \
- > $(top_srcdir)/po/POTFILES-pl
diff --git a/win-reg/virt-win-reg b/win-reg/virt-win-reg.in
similarity index 99%
rename from win-reg/virt-win-reg
rename to win-reg/virt-win-reg.in
index 1a936c5d..6d9d0a28 100755
--- a/win-reg/virt-win-reg
+++ b/win-reg/virt-win-reg.in
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
# virt-win-reg
-# Copyright (C) 2010 Red Hat Inc.
+# Copyright (C) 2010-2021 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -234,9 +234,10 @@ my %opts = ("help|?" => \$help,
GetOptions (%opts) or pod2usage (2);
pod2usage (1) if $help;
if ($version) {
+ print "virt-win-reg @PACKAGE_VERSION@\n";
my $g = Sys::Guestfs->new ();
my %h = $g->version ();
- print "virt-win-reg $h{major}.$h{minor}.$h{release}$h{extra}\n";
+ print "libguestfs $h{major}.$h{minor}.$h{release}$h{extra}\n";
exit
}
--
2.31.1