summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-05-02 13:08:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-05-02 13:08:33 -0400
commit6d61067599142af3eb520527589b0adfbf45867d (patch)
tree5c0ec323e6598e8a11e33ba0591dc1b9f0eb38eb /Remote
parent17fd57bd818931532eda1892f23e0998ad0110d5 (diff)
rsync shellescape disable option
Rsync special remotes can be configured with shellescape=no to avoid shell quoting that is normally done when using rsync over ssh. This is known to be needed for certian rsync hosting providers (specificially hidrive.strato.com) that use rsync over ssh but do not pass it through the shell.
Diffstat (limited to 'Remote')
-rw-r--r--Remote/Rsync.hs21
1 files changed, 12 insertions, 9 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 571cd8f5e..60cbf4595 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -22,9 +22,10 @@ import Utility.RsyncFile
type RsyncUrl = String
-data RsyncOpts = RsyncOpts {
- rsyncUrl :: RsyncUrl,
- rsyncOptions :: [CommandParam]
+data RsyncOpts = RsyncOpts
+ { rsyncUrl :: RsyncUrl
+ , rsyncOptions :: [CommandParam]
+ , rsyncShellEscape :: Bool
}
remote :: RemoteType
@@ -37,7 +38,7 @@ remote = RemoteType {
gen :: Git.Repo -> UUID -> Maybe RemoteConfig -> Annex Remote
gen r u c = do
- o <- genRsyncOpts r
+ o <- genRsyncOpts r c
cst <- remoteCost r expensiveRemoteCost
return $ encryptableRemote c
(storeEncrypted o)
@@ -58,11 +59,13 @@ gen r u c = do
remotetype = remote
}
-genRsyncOpts :: Git.Repo -> Annex RsyncOpts
-genRsyncOpts r = do
+genRsyncOpts :: Git.Repo -> Maybe RemoteConfig -> Annex RsyncOpts
+genRsyncOpts r c = do
url <- getRemoteConfig r "rsyncurl" (error "missing rsyncurl")
- opts <- getRemoteConfig r "rsync-options" ""
- return $ RsyncOpts url $ map Param $ filter safe $ words opts
+ opts <- map Param . filter safe . words
+ <$> getRemoteConfig r "rsync-options" ""
+ let escape = maybe True (\m -> M.lookup "shellescape" m /= Just "no") c
+ return $ RsyncOpts url opts escape
where
safe o
-- Don't allow user to pass --delete to rsync;
@@ -86,7 +89,7 @@ rsyncSetup u c = do
rsyncEscape :: RsyncOpts -> String -> String
rsyncEscape o s
- | rsyncUrlIsShell (rsyncUrl o) = shellEscape s
+ | rsyncShellEscape o && rsyncUrlIsShell (rsyncUrl o) = shellEscape s
| otherwise = s
rsyncUrls :: RsyncOpts -> Key -> [String]