This commit is contained in:
Joey Hess 2014-11-22 00:50:56 -04:00
parent ea058a5f9f
commit cd6ca049b8
1 changed files with 20 additions and 17 deletions

View File

@ -128,10 +128,12 @@ sendGitClone hn = void $ actionMessage ("Clone git repository to " ++ hn) $ do
-- same architecture as the build host.
sendPrecompiled :: HostName -> IO ()
sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor as a last resort") $ do
bracket getWorkingDirectory changeWorkingDirectory $ \_ ->
withTmpDir "propellor" go
where
go tmpdir = do
cacheparams <- sshCachingParams hn
withTmpDir "propellor" $ \tmpdir ->
bracket getWorkingDirectory changeWorkingDirectory $ \_ -> do
let shimdir = "propellor"
let shimdir = takeFileName localdir
createDirectoryIfMissing True (tmpdir </> shimdir)
changeWorkingDirectory (tmpdir </> shimdir)
me <- readSymbolicLink "/proc/self/exe"
@ -145,8 +147,9 @@ sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor
, boolSystem "scp" $ cacheparams ++ [File tarball, Param ("root@"++hn++":"++remotetarball)]
, boolSystem "ssh" $ cacheparams ++ [Param ("root@"++hn), Param unpackcmd]
]
where
remotetarball = "/usr/local/propellor.tar"
unpackcmd = shellWrap $ intercalate " && "
[ "cd " ++ takeDirectory remotetarball
, "tar xf " ++ remotetarball