From f86804fa27a2cf5b1972b14ab41e81edb85ad661 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 3 Jan 2016 16:56:00 -0400 Subject: refactor into smaller modules to untangle git and gpg modules --- src/Propellor/Gpg.hs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/Propellor/Gpg.hs') diff --git a/src/Propellor/Gpg.hs b/src/Propellor/Gpg.hs index 0fd8c9ce..d3550e88 100644 --- a/src/Propellor/Gpg.hs +++ b/src/Propellor/Gpg.hs @@ -13,7 +13,7 @@ import Prelude import Propellor.PrivData.Paths import Propellor.Message -import Utility.Exception +import Propellor.Git.Config import Utility.SafeCommand import Utility.Process import Utility.Monad @@ -22,6 +22,8 @@ import Utility.Tmp import Utility.FileSystemEncoding import Utility.Env +type KeyId = String + getGpgBin :: IO String getGpgBin = do gitGpgBin <- getGitConfigValue "gpg.program" @@ -29,8 +31,6 @@ getGpgBin = do Nothing -> getEnvDefault "GNUPGBIN" "gpg" Just b -> return b -type KeyId = String - keyring :: FilePath keyring = privDataDir "keyring.gpg" @@ -118,15 +118,6 @@ reencryptPrivData = ifM (doesFileExist privDataFile) , return True ) -getGitConfigValue :: String -> IO (Maybe String) -getGitConfigValue key = do - value <- catchMaybeIO $ - takeWhile (/= '\n') - <$> readProcess "git" ["config", key] - return $ case value of - Just v | not (null v) -> Just v - _ -> Nothing - gitAdd :: FilePath -> IO Bool gitAdd f = boolSystem "git" [ Param "add" -- cgit v1.2.3