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.State (liftIO)
|
|
|
|
import System.Exit
|
|
|
|
|
|
|
|
import Locations
|
|
|
|
import qualified Annex
|
|
|
|
import Command
|
2011-01-16 20:05:05 +00:00
|
|
|
import Content
|
2011-05-17 07:10:13 +00:00
|
|
|
import Utility
|
2010-12-31 17:39:30 +00:00
|
|
|
import RsyncFile
|
2011-05-22 18:03:06 +00:00
|
|
|
import Messages
|
2010-12-31 17:39:30 +00:00
|
|
|
|
|
|
|
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
|
|
|
g <- Annex.gitRepo
|
2011-01-27 21:00:32 +00:00
|
|
|
let file = gitAnnexLocation g key
|
2011-05-17 07:10:13 +00:00
|
|
|
whenM (inAnnex key) $
|
|
|
|
liftIO $ rsyncServerSend file -- does not return
|
2011-05-22 18:03:06 +00:00
|
|
|
warning "requested key is not present"
|
2010-12-31 17:39:30 +00:00
|
|
|
liftIO exitFailure
|