diff options
author | Norbert Preining <preining@logic.at> | 2018-05-24 03:08:27 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2018-05-24 03:08:27 +0000 |
commit | 7895df6ab5d011bd09484b5aba16db682a2621e9 (patch) | |
tree | aa6e25725d18fece2089cfba8fd2eec378d59fca /Master/tlpkg/TeXLive/TLUtils.pm | |
parent | d73f728b5ea3ef4a3a8fd60ba9a264bded6dd5ad (diff) |
support ssh://user@host/path as well as scp://...
git-svn-id: svn://tug.org/texlive/trunk@47823 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index d6c4a700677..b8151bf35de 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -198,6 +198,7 @@ BEGIN { &encode_json &True &False + &SshURIRegex ); @EXPORT = qw(setup_programs download_file process_logging_options tldie tlwarn info log debug ddebug dddebug debug_hash @@ -213,6 +214,7 @@ use TeXLive::TLConfig; $::opt_verbosity = 0; # see process_logging_options +our $SshURIRegex = '^((ssh|scp)://([^@]*)@([^/]*)/|([^@]*)@([^:]*):).*$'; =head2 Platform detection @@ -2176,7 +2178,7 @@ sub unpack { $containerfile_quote = "\"$containerfile\""; $tarfile_quote = "\"$tarfile\""; $target_quote = "\"$target\""; - if ($what =~ m,^(https?|ftp)://, || $what =~ m,^[^@]*@[^:]*:,) { + if ($what =~ m,^(https?|ftp)://, || $what =~ m!$SshURIRegex!) { # we are installing from the NET # check for the presence of $what in $tempdir if (-r $containerfile) { @@ -2575,7 +2577,7 @@ sub download_file { } } - if ($relpath =~ m;([^@]*)@([^:]*):(.*)$;) { + if ($relpath =~ m!$SshURIRegex!) { my $downdest; if ($dest eq "|") { my ($fh, $fn) = TeXLive::TLUtils::tl_tmpfile(); @@ -2583,6 +2585,8 @@ sub download_file { } else { $downdest = $dest; } + # massage ssh:// into the scp acceptable scp:// + $relpath =~ s!^ssh://!scp://!; my $retval = system("scp", "-q", $relpath, $downdest); if ($retval != 0) { $retval /= 256 if $retval > 0; @@ -3834,7 +3838,7 @@ Returns the local file name if succeeded, otherwise undef. sub download_to_temp_or_file { my $url = shift; my ($url_fh, $url_file); - if ($url =~ m,^(https?|ftp|file)://, || $url =~ m,^[^@]*@[^:]*:,) { + if ($url =~ m,^(https?|ftp|file)://, || $url =~ m!$SshURIRegex!) { ($url_fh, $url_file) = tl_tmpfile(); # now $url_fh filehandle is open, the file created # TLUtils::download_file will just overwrite what is there |