summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2016-04-16 12:20:54 +0000
committerNorbert Preining <preining@logic.at>2016-04-16 12:20:54 +0000
commit6925ed72574cb1d92b4237fa51d3299098d61c36 (patch)
tree7f29b401e267fa6af38de767b5a38fe09411eae7 /Master/tlpkg
parent46b7cf4b054f7c71f4f8a91941bdf1d79fdd7a87 (diff)
test for TL_GNUPG, gpg, gpg2
git-svn-id: svn://tug.org/texlive/trunk@40550 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm71
1 files changed, 46 insertions, 25 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 9dd9a42df76..bf4a819cccc 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -3633,41 +3633,62 @@ sub tlchecksum_data {
=item C<< setup_gpg() >>
Tries to set up gpg command line C<$::gpg> used for
-verification of downloads.
+verification of downloads. Checks first for the environment variable
+C<TEXLIVE_GNUPG>, then for C<gpg>, and finally for C<gpg2>.
+Further adaption of the invocation of C<gpg> can be done using the
+two enviroment variables C<TL_GNUPGHOME>, which is passed to
+C<gpg> with C<--homedir>, and C<TL_GNUPGARGS>, which replaces the
+default arguments C<--no-secmem-warning --no-permission-warning>.
Returns 1/0 on success/failure.
=cut
-sub setup_gpg {
- my $master = shift;
+sub test_one_gpg {
+ my $prg = shift;
+ my $cmdline;
+ debug("Testing for gpg in $prg\n");
if ($^O =~ /^MSWin(32|64)$/i) {
- my $sysgpg = which('gpg');
- my $found = 0;
- if ($sysgpg) {
- # test whether it actually works
- my $ret = system("gpg --version >nul 2>&1");
- if ($ret == 0) {
- $found = 1;
- $::progs{'gpg'} = $sysgpg;
- }
- }
- if (!$found) {
- my $tlgpg = conv_to_w32_path("$master/tlpkg/installer/gpg/gpg.exe");
- my $ret = system("$tlgpg --version >nul 2>&1"); # on windows
- if ($ret == 0) {
- $::progs{'gpg'} = $tlgpg;
- $found = 1;
- }
- }
- return 0 if (!$found);
+ $prg = conv_to_w32_path($prg) if ($^O =~ /^MSWin(32|64)$/i);
+ $cmdline = "$prg --version >nul 2>&1";
} else {
- # first search for a gpg binary
- return 0 if (!setup_unix_one( 'gpg' , '/no/such/path', '--version', 1));
+ $cmdline = "$prg --version >/dev/null 2>&1";
}
+ my $ret = system($cmdline);
+ if ($ret == 0) {
+ debug(" ... found!\n");
+ return $prg;
+ } else {
+ debug(" ... not found!\n");
+ return "";
+ }
+}
+
+sub setup_gpg {
+ my $master = shift;
+ my $found = 0;
+ my $prg;
+ if ($ENV{'TL_GNUPG'}) {
+ $prg = test_one_gpg($ENV{'TL_GNUPG'});
+ $found = 1 if ($prg);
+ }
+ if (!$found) {
+ $prg = test_one_gpg('gpg');
+ $found = 1 if ($prg);
+ }
+ if (!$found) {
+ $prg = test_one_gpg('gpg2');
+ $found = 1 if ($prg);
+ }
+ if (!$found && $^O =~ /^MSWin(32|64)$/i) {
+ # test on windows also a shipped version from texlive.gpg.win32
+ $prg = test_one_gpg("$master/tlpkg/installer/gpg/gpg.exe");
+ $found = 1 if ($prg);
+ }
+ return 0 if (!$found);
# ok, we found one
# Set up the gpg invocation:
- $::gpg = "$::progs{'gpg'} ";
+ $::gpg = "$prg ";
my $gpghome = ($ENV{'TL_GNUPGHOME'} ? $ENV{'TL_GNUPGHOME'} :
"$master/tlpkg/gpg" );
$gpghome =~ s!/!\\!g if win32();