2010-12-31 17:39:30 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
|
|
|
- Copyright 2010 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.SendKey where
|
|
|
|
|
|
|
|
import Control.Monad (when)
|
|
|
|
import Control.Monad.State (liftIO)
|
|
|
|
import System.Exit
|
|
|
|
|
|
|
|
import Locations
|
|
|
|
import qualified Annex
|
|
|
|
import Command
|
2011-01-16 20:05:05 +00:00
|
|
|
import Content
|
2010-12-31 17:39:30 +00:00
|
|
|
import RsyncFile
|
|
|
|
|
|
|
|
command :: [Command]
|
2011-03-19 22:58:49 +00:00
|
|
|
command = [repoCommand "sendkey" paramKey seek
|
2010-12-31 17:39:30 +00:00
|
|
|
"runs rsync in server mode to send content"]
|
|
|
|
|
|
|
|
seek :: [CommandSeek]
|
|
|
|
seek = [withKeys start]
|
|
|
|
|
2011-03-16 02:42:34 +00:00
|
|
|
start :: CommandStartKey
|
|
|
|
start key = do
|
2010-12-31 17:39:30 +00:00
|
|
|
present <- inAnnex key
|
|
|
|
g <- Annex.gitRepo
|
2011-01-27 21:00:32 +00:00
|
|
|
let file = gitAnnexLocation g key
|
2010-12-31 17:39:30 +00:00
|
|
|
when present $
|
|
|
|
liftIO $ rsyncServerSend file
|
|
|
|
liftIO exitFailure
|