diff options
author | Norbert Preining <preining@logic.at> | 2016-04-12 06:08:19 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2016-04-12 06:08:19 +0000 |
commit | e07d46f3136a56953eaef1286a762650d2f85ada (patch) | |
tree | 248ba05c72058ded50edae8f3dc75a6101e963e8 /Master/texmf-dist | |
parent | 17df0395c6d67aaee65ca0a0461e7e82a7734ce2 (diff) |
use verify_checksum in remote init of tlpdb
git-svn-id: svn://tug.org/texlive/trunk@40433 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index bbfaecc872a..16b379bdf86 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -5848,10 +5848,11 @@ sub setup_one_remotetlpdb { # check for the remote hash my $path = "$location/$InfraLocation/$DatabaseName.checksum"; ddebug("remote path of digest = $path\n"); - my $fh = TeXLive::TLUtils::download_file($path, "|"); - my $rem_digest; - if (read ($fh, $rem_digest, $ChecksumLength) != $ChecksumLength) { - info(<<END_NO_INTERNET); + + my ($ret, $msg) = TeXLive::TLUtils::verify_checksum($loc_copy_of_remote_tlpdb, $path); + if (!$ret) { + if (($msg eq "file not found") || (msg eq "read error") || ($msg eq "digest not found")) { + info(<<END_NO_INTERNET); No connection to the internet. Unable to download the checksum of the remote TeX Live database, but found a local copy so using that. @@ -5864,29 +5865,23 @@ http://tug.org/texlive/doc/install-tl.html END_NO_INTERNET # above text duplicated in install-tl - $remotetlpdb = TeXLive::TLPDB->new(root => $location, - tlpdbfile => $loc_copy_of_remote_tlpdb); - $local_copy_tlpdb_used = 1; - } else { - ddebug("found remote digest: $rem_digest\n"); - my $rem_copy_digest = TeXLive::TLUtils::tlchecksum($loc_copy_of_remote_tlpdb); - ddebug("rem_copy_digest = $rem_copy_digest\n"); - if ($rem_copy_digest eq $rem_digest) { - debug("checksum of local copy identical with remote hash\n"); $remotetlpdb = TeXLive::TLPDB->new(root => $location, tlpdbfile => $loc_copy_of_remote_tlpdb); $local_copy_tlpdb_used = 1; + } elsif ($msg eq "checksum error") { + # no problem, reload it! + } else { + tlwarn("Unknown return message from verify_checksum: $msg\n"); } + } else { + debug("checksum of local copy identical with remote hash\n"); + $remotetlpdb = TeXLive::TLPDB->new(root => $location, + tlpdbfile => $loc_copy_of_remote_tlpdb); + $local_copy_tlpdb_used = 1; } } } if (!$local_copy_tlpdb_used) { - # TODO verification - # here we should add code to download the remote .checksum.gpg (.asc?) - # and verify it. - my $path = "$location/$InfraLocation/$DatabaseName.checksum.asc"; - my $fh = TeXLive::TLUtils::download_file($path, "|"); - # TODO verify ... $remotetlpdb = TeXLive::TLPDB->new(root => $location); } if (!defined($remotetlpdb)) { |