summaryrefslogtreecommitdiff
path: root/Propellor/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess2014-05-11 13:32:37 -0300
committerJoey Hess2014-05-11 13:32:37 -0300
commitffce1f80ae3c492fe768666a00df396448ad6368 (patch)
tree606bd38c0f1f80c621d0f23c6ad72d659a986095 /Propellor/CmdLine.hs
parent2146c8b594b93489656def353ab01a5affd8c932 (diff)
improved initial setup
Configure git to use the gpg key in --add-key, otherwise commit -S will look for a key matching the configured email and if it doesn't find one, will fail.
Diffstat (limited to 'Propellor/CmdLine.hs')
-rw-r--r--Propellor/CmdLine.hs21
1 files changed, 15 insertions, 6 deletions
diff --git a/Propellor/CmdLine.hs b/Propellor/CmdLine.hs
index 47a85d2d..b69f9aaa 100644
--- a/Propellor/CmdLine.hs
+++ b/Propellor/CmdLine.hs
@@ -290,17 +290,26 @@ boot attr ps = do
mainProperties attr ps
addKey :: String -> IO ()
-addKey keyid = exitBool =<< allM id [ gpg, gitadd, gitcommit ]
+addKey keyid = exitBool =<< allM id [ gpg, gitadd, gitconfig, gitcommit ]
where
- gpg = boolSystem "sh"
- [ Param "-c"
- , Param $ "gpg --export " ++ keyid ++ " | gpg " ++
- unwords (gpgopts ++ ["--import"])
- ]
+ gpg = do
+ createDirectoryIfMissing True privDataDir
+ boolSystem "sh"
+ [ Param "-c"
+ , Param $ "gpg --export " ++ keyid ++ " | gpg " ++
+ unwords (gpgopts ++ ["--import"])
+ ]
gitadd = boolSystem "git"
[ Param "add"
, File keyring
]
+
+ gitconfig = boolSystem "git"
+ [ Param "config"
+ , Param "user.signingkey"
+ , Param keyid
+ ]
+
gitcommit = gitCommit
[ File keyring
, Param "-m"