diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-01 17:20:51 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-01 17:20:51 -0400 |
commit | e4078c3749a55ee879f73f94e4218db41bbc9aa5 (patch) | |
tree | ffaf2a287187b38f957d111b0d06b8074345c83f /Command | |
parent | 74e81cb84305f97c3b66f0f52ec51109de1d355e (diff) |
git-annex-shell gcryptsetup command
This was the least-bad alternative to get dedicated key gcrypt repos
working in the assistant.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/GCryptSetup.hs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Command/GCryptSetup.hs b/Command/GCryptSetup.hs new file mode 100644 index 000000000..a27e470c1 --- /dev/null +++ b/Command/GCryptSetup.hs @@ -0,0 +1,35 @@ +{- git-annex command + - + - Copyright 2013 Joey Hess <joey@kitenet.net> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Command.GCryptSetup where + +import Common.Annex +import Command +import Annex.UUID +import qualified Remote.GCrypt +import qualified Git + +def :: [Command] +def = [dontCheck repoExists $ noCommit $ + command "gcryptsetup" paramValue seek + SectionPlumbing "sets up gcrypt repository"] + +seek :: [CommandSeek] +seek = [withStrings start] + +start :: String -> CommandStart +start gcryptid = next $ next $ do + g <- gitRepo + u <- getUUID + gu <- Remote.GCrypt.getGCryptUUID True g + if u == NoUUID && gu == Nothing + then if Git.repoIsLocalBare g + then do + void $ Remote.GCrypt.setupRepo gcryptid g + return True + else error "cannot use gcrypt in a non-bare repository" + else error "gcryptsetup permission denied" |