From: rk@emlix.com Date: Fri, 8 May 2009 09:09:02 +0000 (+0200) Subject: adding support for ports in scp transport X-Git-Tag: e2factory-2.3.1pre1~5 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=383345c47cb12d5b33ccccdf9200b8b29ce56c77;p=e2factory.git adding support for ports in scp transport Signed-off-by: rk@emlix.com --- diff --git a/generic/transport.lua b/generic/transport.lua index 037d396..6c40ece 100644 --- a/generic/transport.lua +++ b/generic/transport.lua @@ -159,15 +159,25 @@ function fetch_file(surl, location, destdir, destname) end elseif u.transport == "scp" or u.transport == "ssh" then - local user + local user,port if u.user then user = string.format("%s@", u.user) else user = "" end + if u.port then + if u.transport == "scp" then + port = "-P " .. u.port + else + port = "-p " .. u.port + end + else + port = "" + end + local args = string.format( - "'%s%s:/%s/%s' '%s/%s'", - user, u.servername, u.path, location, + " %s '%s%s:/%s/%s' '%s/%s'", + port,user, u.servername, u.path, location, destdir, tmpfile) rc, re = e2lib.scp(args) if not rc then