From 3afa368ef1203c83365f5bd3bbf2fc5d5d53eacb Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 5 May 2016 02:15:24 +0000 Subject: switch location of keyring for additional keys to reside in texmf-dist the reason is that on Windows when using --keyring c:/foo/bar gnupg *prepends* the path og GNUPGHOME, that is one gets as keyring path c:/path/to/gnupg-home/c:/foo/bar which is rubbish. The patch is trivial, but we cannot expect that all implementation fixes this problem. Thus, we use tlpkg/gpg/repository-keys.gpg as new location, and use --keyring repository-keys.gpg as argument. git-svn-id: svn://tug.org/texlive/trunk@40899 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/texlive/tlmgr.pl | 23 ++++++++++++----------- Master/tlpkg/TeXLive/TLCrypto.pm | 12 +++++++----- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 287c45a1a87..eb51bfbe404 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -382,9 +382,9 @@ sub main { $action = shift @ARGV; if (!defined($action)) { - if ($opts{"gui"}) { # -gui = gui + if ($opts{"gui"}) { # -gui = gui $action = "gui"; - } elsif ($opts{"print-platform"}) { # -print-arch = print-arch + } elsif ($opts{"print-platform"}) { # -print-arch = print-arch $action = "print-platform"; } else { $action = ""; @@ -5644,21 +5644,22 @@ sub texconfig_conf_mimic { sub action_key { my $arg = shift @ARGV; - $arg = lc($arg); if (!defined($arg)) { tlwarn("missing arguments to action `key'\n"); return $F_ERROR; + } - } elsif ($arg =~ /^(add|delete|list)$/) { + $arg = lc($arg); + if ($arg =~ /^(add|delete|list)$/) { handle_gpg_config_settings(); if (!$::gpg) { tlwarn("gnupg is not found or setup, cannot continue with action `key'\n"); return $F_ERROR; } chomp (my $TEXMFSYSCONFIG = `kpsewhich -var-value=TEXMFSYSCONFIG`); - my $local_keyring = "$TEXMFSYSCONFIG/tlpkg/gpg/keyring.gpg"; + my $local_keyring = "$Master/tlpkg/gpg/repository-keys.gpg"; if ($arg eq 'list') { debug("running $::gpg --list-keys\n"); system("$::gpg --list-keys"); @@ -5674,9 +5675,9 @@ sub action_key { tlwarn("no local keyring available, cannot delete anything!\n"); return $F_ERROR; } - debug("running: $::gpg --primary-keyring \"$local_keyring\" --delete-key $what\n"); + debug("running: $::gpg --primary-keyring repository-keys.gpg --delete-key $what\n"); my ($out, $ret) = - TeXLive::TLUtils::run_cmd("$::gpg --primary-keyring \"$local_keyring\" --delete-key \"$what\" 2>&1"); + TeXLive::TLUtils::run_cmd("$::gpg --primary-keyring repository-keys.gpg --delete-key \"$what\" 2>&1"); if ($ret == 0) { info("key successfully removed\n"); return $F_OK; @@ -5693,13 +5694,12 @@ sub action_key { } # we need to make sure that $local_keyring is existent! if (! -r $local_keyring) { - TeXLive::TLUtils::mkdirhier("$TEXMFSYSCONFIG/tlpkg/gpg"); open(FOO, ">$local_keyring") || die("Cannot create $local_keyring: $!"); close(FOO); } - debug("running: $::gpg --primary-keyring \"$local_keyring\" --import $what\n"); + debug("running: $::gpg --primary-keyring repository-keys.gpg --import $what\n"); my ($out, $ret) = - TeXLive::TLUtils::run_cmd("$::gpg --primary-keyring \"$local_keyring\" --import \"$what\" 2>&1"); + TeXLive::TLUtils::run_cmd("$::gpg --primary-keyring repository-keys.gpg --import \"$what\" 2>&1"); if ($ret == 0) { info("key successfully imported\n"); return $F_OK; @@ -7124,7 +7124,8 @@ With the C argument lists all keys. The C argument requires another argument, either a filename or C<-> for stdin, from which the key is added. The key is added to the -local keyring C. +local keyring C, which normally is +C. The C argument requires a key id and removes the requested id from the local keyring. diff --git a/Master/tlpkg/TeXLive/TLCrypto.pm b/Master/tlpkg/TeXLive/TLCrypto.pm index f604b2b4f39..ed61a663d56 100644 --- a/Master/tlpkg/TeXLive/TLCrypto.pm +++ b/Master/tlpkg/TeXLive/TLCrypto.pm @@ -311,13 +311,15 @@ sub setup_gpg { # mind the final space for following args $::gpg = "$prg --homedir $gpghome_quote "; # - # check for additional keyrings in - # TEXMFSYSCONFIG/tlpkg/gpg/keyring.gpg - chomp (my $TEXMFSYSCONFIG = `kpsewhich -var-value=TEXMFSYSCONFIG`); - my $addkr = "$TEXMFSYSCONFIG/tlpkg/gpg/keyring.gpg"; + # check for additional keyring + # originally we wanted to use TEXMFSYSCONFIG, but gnupg on Windows + # is so stupid that it *prepends* GNUPGHOME to paths starting with + # a drive letter like c:/ + # Thus we switch to using repository-keys.gpg in GNUPGHOME! + my $addkr = "$gpghome/repository-keys.gpg"; if (-r $addkr) { debug("setup_gpg: using additional keyring $addkr\n"); - $::gpg .= "--keyring \"$addkr\" "; + $::gpg .= "--keyring repository-keys.gpg "; } if ($ENV{'TL_GNUPGARGS'}) { $::gpg .= $ENV{'TL_GNUPGARGS'}; -- cgit v1.2.3