summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2015-09-23 14:26:26 -0400
committerJoey Hess2015-09-23 14:26:26 -0400
commit4ded5bf3d9cd878d00adc7b9a6063b44d528094c (patch)
tree898785a455ad2f3d5356b3022c71554f060d66dd /src
parent873c64a8564ac4cc852894ccddf17ddddfa9fbf0 (diff)
remove git signing key when it's the key to be removed
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Gpg.hs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Propellor/Gpg.hs b/src/Propellor/Gpg.hs
index 46f2c7d9..84f67dc1 100644
--- a/src/Propellor/Gpg.hs
+++ b/src/Propellor/Gpg.hs
@@ -43,7 +43,7 @@ addKey keyid = exitBool =<< allM (uncurry actionMessage)
[ ("adding key to propellor's keyring", addkeyring)
, ("staging propellor's keyring", gitAdd keyring)
, ("updating encryption of any privdata", reencryptPrivData)
- , ("configuring git signing to use key", gitconfig)
+ , ("configuring git commit signing to use key", gitconfig)
, ("committing changes", gitCommitKeyRing "add-key")
]
where
@@ -71,12 +71,25 @@ rmKey keyid = exitBool =<< allM (uncurry actionMessage)
[ ("removing key from propellor's keyring", rmkeyring)
, ("staging propellor's keyring", gitAdd keyring)
, ("updating encryption of any privdata", reencryptPrivData)
+ , ("configuring git commit signing to not use key", gitconfig)
, ("committing changes", gitCommitKeyRing "rm-key")
]
where
rmkeyring = boolSystem "gpg" $
(map Param useKeyringOpts) ++
- [Param "--delete-key", Param keyid]
+ [ Param "--batch"
+ , Param "--yes"
+ , Param "--delete-key", Param keyid
+ ]
+
+ gitconfig = ifM ((==) (keyid++"\n", True) <$> processTranscript "git" ["config", "user.signingkey"] Nothing)
+ ( boolSystem "git"
+ [ Param "config"
+ , Param "--unset"
+ , Param "user.signingkey"
+ ]
+ , return True
+ )
reencryptPrivData :: IO Bool
reencryptPrivData = ifM (doesFileExist privDataFile)