]> git.e2factory.org Git - e2factory.git/commitdiff
adding support for ports in scp transport
authorrk@emlix.com <rk@emlix.com>
Fri, 8 May 2009 09:09:02 +0000 (11:09 +0200)
committerGordon Hecker <gh@emlix.com>
Tue, 2 Jun 2009 10:21:31 +0000 (12:21 +0200)
Signed-off-by: rk@emlix.com <rainer.keller@emlix.com>
generic/transport.lua

index 037d396bb2e11ced84f46ca68ace77937c3e6096..6c40ece4a7255d4815639f26bfa2fcb6e61960f1 100644 (file)
@@ -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