summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-31 22:29:11 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-31 22:29:11 -0400
commite70812eca9748ee53468e68563366ebd856b7e82 (patch)
tree98700049d157af747855356fe3c20ed9f433c455
parentc6206c4560adf35427569a9d9a637f9ee23cb2b8 (diff)
use ssh -p to preserve perms
and refactor
-rw-r--r--Remotes.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Remotes.hs b/Remotes.hs
index 135a701ff..a5c4597eb 100644
--- a/Remotes.hs
+++ b/Remotes.hs
@@ -196,8 +196,7 @@ copyFromRemote r key file = do
where
getlocal = liftIO $ boolSystem "cp" ["-a", keyloc, file]
getssh = do
- Core.showProgress -- make way for scp progress bar
- liftIO $ boolSystem "scp" [sshLocation r keyloc, file]
+ scp [sshLocation r keyloc, file]
keyloc = annexLocation r key
{- Tries to copy a key's content to a file on a remote. -}
@@ -213,12 +212,16 @@ copyToRemote r key file = do
where
putlocal src = liftIO $ boolSystem "cp" ["-a", src, file]
putssh src = do
- Core.showProgress -- make way for scp progress bar
- liftIO $ boolSystem "scp" [src, sshLocation r file]
+ scp [src, sshLocation r file]
sshLocation :: Git.Repo -> FilePath -> FilePath
sshLocation r file = (Git.urlHost r) ++ ":" ++ shellEscape file
+scp :: [String] -> Annex Bool
+scp params = do
+ Core.showProgress -- make way for scp progress bar
+ liftIO $ boolSystem "scp" ("-p":params)
+
{- Runs a command in a remote. -}
runCmd :: Git.Repo -> String -> [String] -> Annex Bool
runCmd r command params = do