propellor spin

This commit is contained in:
Joey Hess 2014-03-31 15:05:13 -04:00
parent 35d79711fc
commit bba03dc896
Failed to extract signature
1 changed files with 10 additions and 8 deletions

View File

@ -75,15 +75,11 @@ spin host = do
status <- getstatus fromh `catchIO` error "protocol error" status <- getstatus fromh `catchIO` error "protocol error"
case status of case status of
NeedKeyRing -> do NeedKeyRing -> do
d <- BL.readFile keyring d <- w82s . BL.unpack . B64.encode
putStr $ "Sending " ++ keyring ++ " (" ++ show (BL.length d) ++ " bytes) to " ++ host ++ "..." <$> BL.readFile keyring
hFlush stdout senddata toh keyring keyringMarker d
hPutStrLn toh $ toMarked keyringMarker $ w82s $ BL.unpack $ B64.encode d
hFlush toh
putStrLn "done"
HaveKeyRing -> noop HaveKeyRing -> noop
hPutStrLn toh $ toMarked privDataMarker privdata senddata toh (privDataFile host) privDataMarker privdata
hFlush toh
hClose toh hClose toh
-- Display remaining output. -- Display remaining output.
@ -115,6 +111,12 @@ spin host = do
getstatus h getstatus h
Just status -> return status Just status -> return status
showremote s = putStrLn s showremote s = putStrLn s
senddata toh f marker s = do
putStr $ "Sending " ++ f ++ " (" ++ show (length s) ++ " bytes) to " ++ host ++ "..."
hFlush stdout
hPutStrLn toh $ toMarked marker s
hFlush toh
putStrLn "done"
data BootStrapStatus = HaveKeyRing | NeedKeyRing data BootStrapStatus = HaveKeyRing | NeedKeyRing
deriving (Read, Show, Eq) deriving (Read, Show, Eq)