use ssh -p to preserve perms

and refactor
This commit is contained in:
Joey Hess 2010-10-31 22:29:11 -04:00
parent c6206c4560
commit e70812eca9

View file

@ -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