propellor spin
This commit is contained in:
parent
ccd5557abe
commit
4e7928efb6
|
@ -33,7 +33,7 @@ getPrivData field = do
|
||||||
setPrivData :: HostName -> PrivDataField -> IO ()
|
setPrivData :: HostName -> PrivDataField -> IO ()
|
||||||
setPrivData host field = do
|
setPrivData host field = do
|
||||||
putStrLn "Enter private data on stdin; ctrl-D when done:"
|
putStrLn "Enter private data on stdin; ctrl-D when done:"
|
||||||
value <- hGetContentsStrict stdin
|
value <- chomp <$> hGetContentsStrict stdin
|
||||||
makePrivDataDir
|
makePrivDataDir
|
||||||
let f = privDataFile host
|
let f = privDataFile host
|
||||||
m <- fromMaybe M.empty . readish <$> gpgDecrypt f
|
m <- fromMaybe M.empty . readish <$> gpgDecrypt f
|
||||||
|
@ -41,6 +41,10 @@ setPrivData host field = do
|
||||||
gpgEncrypt f (show m')
|
gpgEncrypt f (show m')
|
||||||
putStrLn "Private data set."
|
putStrLn "Private data set."
|
||||||
void $ boolSystem "git" [Param "add", File f]
|
void $ boolSystem "git" [Param "add", File f]
|
||||||
|
where
|
||||||
|
chomp s
|
||||||
|
| end s == "\n" = chomp (beginning s)
|
||||||
|
| otherwise = s
|
||||||
|
|
||||||
makePrivDataDir :: IO ()
|
makePrivDataDir :: IO ()
|
||||||
makePrivDataDir = createDirectoryIfMissing False privDataDir
|
makePrivDataDir = createDirectoryIfMissing False privDataDir
|
||||||
|
|
Loading…
Reference in New Issue