diff options
author | Joey Hess <joey@kitenet.net> | 2010-12-31 13:39:30 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-12-31 13:39:43 -0400 |
commit | 60df4e5728b8af804f06c39ef3b897af12247ceb (patch) | |
tree | 682d1443d4d8e27f63f87ee9e0ae2f5629538385 /RsyncFile.hs | |
parent | f38aa3e83abb251a88362dbaf6e8fbddd477fa53 (diff) |
git-annex-shell is complete
still not used
Diffstat (limited to 'RsyncFile.hs')
-rw-r--r-- | RsyncFile.hs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/RsyncFile.hs b/RsyncFile.hs new file mode 100644 index 000000000..14f6dc926 --- /dev/null +++ b/RsyncFile.hs @@ -0,0 +1,33 @@ +{- git-annex file copying with rsync + - + - Copyright 2010 Joey Hess <joey@kitenet.net> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module RsyncFile where + +import Utility +import System.Posix.Process + +{- Runs rsync in server mode to send a file, and exits. -} +rsyncServerSend :: FilePath -> IO () +rsyncServerSend file = rsyncExec $ rsyncServerParams ++ ["--sender", file] + +{- Runs rsync in server mode to receive a file. -} +rsyncServerReceive :: FilePath -> IO Bool +rsyncServerReceive file = rsync $ rsyncServerParams ++ [file] + +rsyncServerParams :: [String] +rsyncServerParams = + [ "--server" + , "-p" -- preserve permissions + , "--inplace" -- allow resuming of transfers of big files + , "-e.Lsf", "." -- other options rsync normally uses in server mode + ] + +rsync :: [String] -> IO Bool +rsync params = boolSystem "rsync" params + +rsyncExec :: [String] -> IO () +rsyncExec params = executeFile "rsync" True params Nothing |