summaryrefslogtreecommitdiff
path: root/RsyncFile.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-12-31 19:09:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-12-31 19:09:17 -0400
commit700aed13cff27f9315df1209e0cd37d5e51f5390 (patch)
tree4b28a2499293b1aea9cac2ac661a6bc68c319478 /RsyncFile.hs
parent30e0065ab97843f866a7fe095b8a18ee6eb4c321 (diff)
git-annex-shell now exclusively used for all remote access
Diffstat (limited to 'RsyncFile.hs')
-rw-r--r--RsyncFile.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/RsyncFile.hs b/RsyncFile.hs
index 14f6dc926..274e66151 100644
--- a/RsyncFile.hs
+++ b/RsyncFile.hs
@@ -7,8 +7,20 @@
module RsyncFile where
-import Utility
import System.Posix.Process
+import Data.String.Utils
+
+import Utility
+
+{- Generates parameters to make rsync use a specified command as its remote
+ - shell. -}
+rsyncShell :: [String] -> [String]
+rsyncShell command = ["-e", unwords $ map escape command]
+ where
+ {- rsync requires some weird, non-shell like quoting in
+ - here. A doubled single quote inside the single quoted
+ - string is a single quote. -}
+ escape s = "'" ++ (join "''" $ split "'" s) ++ "'"
{- Runs rsync in server mode to send a file, and exits. -}
rsyncServerSend :: FilePath -> IO ()