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 where
getlocal = liftIO $ boolSystem "cp" ["-a", keyloc, file] getlocal = liftIO $ boolSystem "cp" ["-a", keyloc, file]
getssh = do getssh = do
Core.showProgress -- make way for scp progress bar scp [sshLocation r keyloc, file]
liftIO $ boolSystem "scp" [sshLocation r keyloc, file]
keyloc = annexLocation r key keyloc = annexLocation r key
{- Tries to copy a key's content to a file on a remote. -} {- Tries to copy a key's content to a file on a remote. -}
@ -213,12 +212,16 @@ copyToRemote r key file = do
where where
putlocal src = liftIO $ boolSystem "cp" ["-a", src, file] putlocal src = liftIO $ boolSystem "cp" ["-a", src, file]
putssh src = do putssh src = do
Core.showProgress -- make way for scp progress bar scp [src, sshLocation r file]
liftIO $ boolSystem "scp" [src, sshLocation r file]
sshLocation :: Git.Repo -> FilePath -> FilePath sshLocation :: Git.Repo -> FilePath -> FilePath
sshLocation r file = (Git.urlHost r) ++ ":" ++ shellEscape file 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. -} {- Runs a command in a remote. -}
runCmd :: Git.Repo -> String -> [String] -> Annex Bool runCmd :: Git.Repo -> String -> [String] -> Annex Bool
runCmd r command params = do runCmd r command params = do