From ffce1f80ae3c492fe768666a00df396448ad6368 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 11 May 2014 13:32:37 -0300 Subject: 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. --- Propellor/CmdLine.hs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'Propellor/CmdLine.hs') 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" -- cgit v1.3-2-g0d8e