diff options
author | Norbert Preining <preining@logic.at> | 2016-04-16 12:20:54 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2016-04-16 12:20:54 +0000 |
commit | 6925ed72574cb1d92b4237fa51d3299098d61c36 (patch) | |
tree | 7f29b401e267fa6af38de767b5a38fe09411eae7 | |
parent | 46b7cf4b054f7c71f4f8a91941bdf1d79fdd7a87 (diff) |
test for TL_GNUPG, gpg, gpg2
git-svn-id: svn://tug.org/texlive/trunk@40550 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 15 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 71 |
2 files changed, 60 insertions, 26 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 9f64aa03cb7..0d53f1aad7a 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -7520,7 +7520,8 @@ a different hash), it's harmless to delete them. =head1 CRYPTOGRAPHIC VERIFICATION -If a working GnuPG binary (C<gpg>) is found, by default verification of +If a working GnuPG binary (C<gpg>) is found (see below for how it is +searched), by default verification of downloaded files is performed. This can be supressed by specifying C<--no-verify-downloads> on the command line, or adding an entry C<verify-downloads = 0> to a tlmgr config file. @@ -7537,6 +7538,18 @@ the TeX Live Distribution GPG key 0x06BAB6BC, which in turn is signed by Karl Berry's key 0x9DEB46C0 and Norbert Preining's key 0x6CACA448. All of these keys are obtainable from the standard key servers. +=head2 Configuration of GnuPG invocation + +The executable used for GnuPG is searched as follows: If the environment +variable C<TL_GNUPG> is set, it is tested and used. Otherwise C<gpg> is +checked, and finally 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>. + + =head1 USER MODE C<tlmgr> provides a restricted way, called ``user mode'', to manage 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(); |