2010-12-31 13:39:30 -04:00
|
|
|
{- git-annex command
|
|
|
|
-
|
|
|
|
- Copyright 2010 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.SendKey where
|
|
|
|
|
2011-10-05 16:02:51 -04:00
|
|
|
import Common.Annex
|
2010-12-31 13:39:30 -04:00
|
|
|
import Command
|
2011-10-04 00:40:47 -04:00
|
|
|
import Annex.Content
|
2011-07-05 20:24:10 -04:00
|
|
|
import Utility.RsyncFile
|
2010-12-31 13:39:30 -04:00
|
|
|
|
|
|
|
command :: [Command]
|
2011-03-19 18:58:49 -04:00
|
|
|
command = [repoCommand "sendkey" paramKey seek
|
2010-12-31 13:39:30 -04:00
|
|
|
"runs rsync in server mode to send content"]
|
|
|
|
|
|
|
|
seek :: [CommandSeek]
|
|
|
|
seek = [withKeys start]
|
|
|
|
|
2011-09-15 16:50:49 -04:00
|
|
|
start :: Key -> CommandStart
|
2011-03-15 22:42:34 -04:00
|
|
|
start key = do
|
2011-10-03 22:24:57 -04:00
|
|
|
g <- gitRepo
|
2011-01-27 17:00:32 -04:00
|
|
|
let file = gitAnnexLocation g key
|
2011-05-17 03:10:13 -04:00
|
|
|
whenM (inAnnex key) $
|
|
|
|
liftIO $ rsyncServerSend file -- does not return
|
2011-05-22 14:03:06 -04:00
|
|
|
warning "requested key is not present"
|
2010-12-31 13:39:30 -04:00
|
|
|
liftIO exitFailure
|