summaryrefslogtreecommitdiff
path: root/src/Propellor/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-11-11 13:47:25 -0400
committerJoey Hess <joey@kitenet.net>2014-11-11 13:47:25 -0400
commit08ff95fbfaf867ad5a6acdecfd0eb1e84ed44fd9 (patch)
treeb5fa72c40d3c6c1438e7ab3191c1136887fe7b4f /src/Propellor/CmdLine.hs
parentbd7869c01c38065275acfdc4b139a93439433229 (diff)
parent05a793dd5916a3d21cbec783e26bd629891ad7f1 (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/CmdLine.hs')
-rw-r--r--src/Propellor/CmdLine.hs44
1 files changed, 2 insertions, 42 deletions
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs
index 415b8576..c3b792d1 100644
--- a/src/Propellor/CmdLine.hs
+++ b/src/Propellor/CmdLine.hs
@@ -13,6 +13,8 @@ import System.Posix.IO
import Data.Time.Clock.POSIX
import Propellor
+import Propellor.PrivData.Paths
+import Propellor.Gpg
import qualified Propellor.Property.Docker as Docker
import qualified Propellor.Property.Docker.Shim as DockerShim
import Utility.FileMode
@@ -303,48 +305,6 @@ boot h = do
fromMarked privDataMarker reply
mainProperties h
-addKey :: String -> IO ()
-addKey keyid = exitBool =<< allM id [ gpg, gitadd, gitconfig, gitcommit ]
- where
- 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"
- , Param "propellor addkey"
- ]
-
-{- Automatically sign the commit if there'a a keyring. -}
-gitCommit :: [CommandParam] -> IO Bool
-gitCommit ps = do
- k <- doesFileExist keyring
- boolSystem "git" $ catMaybes $
- [ Just (Param "commit")
- , if k then Just (Param "--gpg-sign") else Nothing
- ] ++ map Just ps
-
-keyring :: FilePath
-keyring = privDataDir </> "keyring.gpg"
-
-gpgopts :: [String]
-gpgopts = ["--options", "/dev/null", "--no-default-keyring", "--keyring", keyring]
-
getUrl :: IO String
getUrl = maybe nourl return =<< getM get urls
where