summaryrefslogtreecommitdiff
path: root/src/Propellor/DotDir.hs
diff options
context:
space:
mode:
authorJoey Hess2016-04-01 23:40:39 -0400
committerJoey Hess2016-04-01 23:42:50 -0400
commit71bc7071094ef56bca518f1eb4660718a0c9d0b0 (patch)
tree0bf2962f6265272d727449c9ef6217d8731abc06 /src/Propellor/DotDir.hs
parent1dc914a71c94e0395641565e5891a2dc33ba1b35 (diff)
verify use of gpg key
having a prompt here makes it clearer to the user why gpg is prompting for a passphrase.
Diffstat (limited to 'src/Propellor/DotDir.hs')
-rw-r--r--src/Propellor/DotDir.hs20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/Propellor/DotDir.hs b/src/Propellor/DotDir.hs
index 92c20654..bf7550d5 100644
--- a/src/Propellor/DotDir.hs
+++ b/src/Propellor/DotDir.hs
@@ -64,7 +64,7 @@ welcomeBanner = putStr $ unlines $ map prettify
, " - Welcome to -- ~ / | / ) _.-'-._"
, " - Propellor! -- `/-==__ _/__|/__=-| ( ~_"
, " `--------------------------- * ~ | | '--------'"
- , " (o) `"
+ , " (o) `"
, ""
, ""
]
@@ -90,7 +90,7 @@ prompt p cs = do
section :: IO ()
section = do
putStrLn ""
- putStrLn "---------------------------------------------------------------------------------"
+ putStrLn "------------------------------------------------------------------------------"
putStrLn ""
setup :: IO ()
@@ -111,11 +111,13 @@ setup = do
section
putStrLn "Let's try building the propellor configuration, to make sure it will work..."
+ putStrLn ""
buildPropellor Nothing
+ putStrLn ""
putStrLn "Great! Propellor is bootstrapped."
section
- putStrLn "Propellor uses gpg to encrypt private data about the systems it manages,"
+ putStrLn "Propellor can use gpg to encrypt private data about the systems it manages,"
putStrLn "and to sign git commits."
gpg <- getGpgBin
ifM (inPath gpg)
@@ -146,14 +148,21 @@ setupGpgKey = do
putStrLn ""
case ks of
[] -> makeGpgKey
- [(k, _)] -> propellorAddKey k
+ [(k, d)] -> do
+ putStrLn $ "You have one gpg key: " ++ desckey k d
+ prompt "Should propellor use that key?"
+ [ ("Y", propellorAddKey k)
+ , ("N", putStrLn $ "Skipping gpg setup. If you change your mind, run: propellor --add-key " ++ k)
+ ]
_ -> do
let nks = zip ks (map show ([1..] :: [Integer]))
putStrLn "I see you have several gpg keys:"
forM_ nks $ \((k, d), n) ->
- putStrLn $ " " ++ n ++ " " ++ d ++ " (keyid " ++ k ++ ")"
+ putStrLn $ " " ++ n ++ " " ++ desckey k d
prompt "Which of your gpg keys should propellor use?"
(map (\((k, _), n) -> (n, propellorAddKey k)) nks)
+ where
+ desckey k d = d ++ " (keyid " ++ k ++ ")"
makeGpgKey :: IO ()
makeGpgKey = do
@@ -199,6 +208,7 @@ minimalConfig = do
where
cabalcontent =
[ "-- This is a cabal file to use to build your propellor configuration."
+ , "-- https://propellor.branchable.com/"
, ""
, "Name: config"
, "Cabal-Version: >= 1.6"