This commit is contained in:
Joey Hess 2014-11-18 20:19:50 -04:00
parent d4a4f0193e
commit be1287d5f9
1 changed files with 24 additions and 24 deletions

View File

@ -208,6 +208,30 @@ spin hn hst = do
runcmd = mkcmd runcmd = mkcmd
[ "cd " ++ localdir ++ " && ./propellor --continue " ++ shellEscape (show (SimpleRun hn)) ] [ "cd " ++ localdir ++ " && ./propellor --continue " ++ shellEscape (show (SimpleRun hn)) ]
-- Update the privdata, repo url, and git repo over the ssh
-- connection from the client that ran propellor --spin.
update :: IO ()
update = do
req NeedRepoUrl repoUrlMarker setRepoUrl
makePrivDataDir
req NeedPrivData privDataMarker $
writeFileProtected privDataLocal
req NeedGitPush gitPushMarker $ \_ -> do
hin <- dup stdInput
hout <- dup stdOutput
hClose stdin
hClose stdout
unlessM (boolSystem "git" (pullparams hin hout)) $
errorMessage "git pull from client failed"
where
pullparams hin hout =
[ Param "pull"
, Param "--progress"
, Param "--upload-pack"
, Param $ "./propellor --continue " ++ show (GitPush hin hout)
, Param "."
]
comm :: HostName -> Host -> (((Handle, Handle) -> IO ()) -> IO ()) -> IO () comm :: HostName -> Host -> (((Handle, Handle) -> IO ()) -> IO ()) -> IO ()
comm hn hst connect = connect go comm hn hst connect = connect go
where where
@ -275,30 +299,6 @@ sendGitClone hn = void $ actionMessage ("Cloning git repository to " ++ hn) $ do
, "rm -f " ++ remotebundle , "rm -f " ++ remotebundle
] ]
-- Update the privdata, repo url, and git repo over the ssh
-- connection from the client that ran propellor --spin.
update :: IO ()
update = do
req NeedRepoUrl repoUrlMarker setRepoUrl
makePrivDataDir
req NeedPrivData privDataMarker $
writeFileProtected privDataLocal
req NeedGitPush gitPushMarker $ \_ -> do
hin <- dup stdInput
hout <- dup stdOutput
hClose stdin
hClose stdout
unlessM (boolSystem "git" (pullparams hin hout)) $
errorMessage "git pull from client failed"
where
pullparams hin hout =
[ Param "pull"
, Param "--progress"
, Param "--upload-pack"
, Param $ "./propellor --continue " ++ show (GitPush hin hout)
, Param "."
]
-- Shim for git push over the propellor ssh channel. -- Shim for git push over the propellor ssh channel.
-- Reads from stdin and sends it to hout; -- Reads from stdin and sends it to hout;
-- reads from hin and sends it to stdout. -- reads from hin and sends it to stdout.