summaryrefslogtreecommitdiff
path: root/Assistant/MakeRemote.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-26 18:22:44 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-26 18:22:52 -0400
commit8d7348fe1be96f95eda6c8cf386b54825e0b69fd (patch)
tree30cd1c58fcd6766573892873a2cd7f9fa999c196 /Assistant/MakeRemote.hs
parentee51adad7bdad29e77e5d51a192c8de5653fd06e (diff)
To enable an existing special remote, the new enableremote command must be used. The initremote command now is used only to create new special remotes.
Diffstat (limited to 'Assistant/MakeRemote.hs')
-rw-r--r--Assistant/MakeRemote.hs25
1 files changed, 15 insertions, 10 deletions
diff --git a/Assistant/MakeRemote.hs b/Assistant/MakeRemote.hs
index 33ca0b2c0..2ef35a7b9 100644
--- a/Assistant/MakeRemote.hs
+++ b/Assistant/MakeRemote.hs
@@ -69,17 +69,22 @@ makeRsyncRemote name location = makeRemote name location $
, ("type", "rsync")
]
-{- Inits a special remote. Currently, only 'weak' ciphers can be
- - generated from the assistant, because otherwise GnuPG may block once
- - the entropy pool is drained, and as of now there's no way to tell the
- - user to perform IO actions to refill the pool. -}
+{- Inits a new special remote, or enables an existing one.
+ -
+ - Currently, only 'weak' ciphers can be generated from the assistant,
+ - because otherwise GnuPG may block once the entropy pool is drained,
+ - and as of now there's no way to tell the user to perform IO actions
+ - to refill the pool. -}
makeSpecialRemote :: String -> RemoteType -> R.RemoteConfig -> Annex ()
-makeSpecialRemote name remotetype config = do
- (u, c) <- Command.InitRemote.findByName name
- c' <- R.setup remotetype u $
- M.insert "highRandomQuality" "false" $ M.union config c
- describeUUID u name
- configSet u c'
+makeSpecialRemote name remotetype config =
+ go =<< Command.InitRemote.findExisting name
+ where
+ go Nothing = go =<< Just <$> Command.InitRemote.generateNew name
+ go (Just (u, c)) = do
+ c' <- R.setup remotetype u $
+ M.insert "highRandomQuality" "false" $ M.union config c
+ describeUUID u name
+ configSet u c'
{- Returns the name of the git remote it created. If there's already a
- remote at the location, returns its name. -}