From 0a415a7b41f871a514575d0ac2475374f49db70a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Nov 2014 23:30:01 -0400 Subject: show last line if it cannot be parsed as a serialized Result --- src/Propellor/Engine.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs index 969769ce..0a51736f 100644 --- a/src/Propellor/Engine.hs +++ b/src/Propellor/Engine.hs @@ -11,7 +11,6 @@ import "mtl" Control.Monad.Reader import Control.Exception (bracket) import System.PosixCompat import System.Posix.IO -import Data.Maybe import Propellor.Types import Propellor.Message @@ -74,8 +73,14 @@ processChainOutput h = go Nothing go lastline = do v <- catchMaybeIO (hGetLine h) case v of - Nothing -> pure $ fromMaybe FailedChange $ - readish =<< lastline + Nothing -> case lastline of + Nothing -> pure FailedChange + Just l -> case readish l of + Just r -> pure r + Nothing -> do + putStrLn l + hFlush stdout + return FailedChange Just s -> do maybe noop (\l -> unless (null l) (putStrLn l)) lastline hFlush stdout -- cgit v1.2.3 From 6eb64d56e3718339b209853b838d04606dcd2dbb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Nov 2014 23:33:39 -0400 Subject: avoid setting title when not at console --- src/Propellor/Engine.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs index 0a51736f..b551ca05 100644 --- a/src/Propellor/Engine.hs +++ b/src/Propellor/Engine.hs @@ -27,7 +27,9 @@ mainProperties :: Host -> IO () mainProperties host = do r <- runPropellor host $ ensureProperties [Property "overall" (ensureProperties $ hostProperties host) mempty] - setTitle "propellor: done" + h <- mkMessageHandle + whenConsole h $ + setTitle "propellor: done" hFlush stdout case r of FailedChange -> exitWith (ExitFailure 1) -- cgit v1.2.3 From f62d2fb18389947ce11021ba80b2aee52c6d03c2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:22:19 -0400 Subject: propellor --spin can now deploy propellor to hosts that do not have git, ghc, or apt-get. This is accomplished by uploading a fairly portable precompiled tarball of propellor. --- debian/changelog | 8 ++++++++ src/Propellor/CmdLine.hs | 27 +++++++++++++++------------ src/Propellor/Git.hs | 2 +- src/Propellor/Protocol.hs | 2 +- src/Propellor/Server.hs | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 14 deletions(-) (limited to 'src/Propellor') diff --git a/debian/changelog b/debian/changelog index 66e5caef..784dcdb7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +propellor (1.0.1) UNRELEASED; urgency=medium + + * propellor --spin can now deploy propellor to hosts that do not have + git, ghc, or apt-get. This is accomplished by uploading a fairly + portable precompiled tarball of propellor. + + -- Joey Hess Sat, 22 Nov 2014 00:12:35 -0400 + propellor (1.0.0) unstable; urgency=medium * propellor --spin can now be used to update remote hosts, without diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index 142efa1d..ec2ca7ed 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -114,16 +114,19 @@ unknownhost h hosts = errorMessage $ unlines ] buildFirst :: CmdLine -> IO () -> IO () -buildFirst cmdline next = do - oldtime <- getmtime - ifM (actionMessage "Propellor build" $ boolSystem "make" [Param "build"]) - ( do - newtime <- getmtime - if newtime == oldtime - then next - else void $ boolSystem "./propellor" [Param "--continue", Param (show cmdline)] - , errorMessage "Propellor build failed!" - ) +buildFirst cmdline next = ifM (doesFileExist "Makefile") + ( do + oldtime <- getmtime + ifM (actionMessage "Propellor build" $ boolSystem "make" [Param "build"]) + ( do + newtime <- getmtime + if newtime == oldtime + then next + else void $ boolSystem "./propellor" [Param "--continue", Param (show cmdline)] + , errorMessage "Propellor build failed!" + ) + , next + ) where getmtime = catchMaybeIO $ getModificationTime "propellor" @@ -172,11 +175,11 @@ spin hn hst = do updatecmd = mkcmd [ "if [ ! -d " ++ localdir ++ " ]" - , "then " ++ intercalate " && " + , "then (" ++ intercalate " && " [ "apt-get update" , "apt-get --no-install-recommends --no-upgrade -y install git make" , "echo " ++ toMarked statusMarker (show NeedGitClone) - ] + ] ++ ") || echo " ++ toMarked statusMarker (show NeedPrecompiled) , "else " ++ intercalate " && " [ "cd " ++ localdir , "if ! test -x ./propellor; then make deps build; fi" diff --git a/src/Propellor/Git.hs b/src/Propellor/Git.hs index 73de1def..e5f464c0 100644 --- a/src/Propellor/Git.hs +++ b/src/Propellor/Git.hs @@ -38,7 +38,7 @@ getRepoUrl = getM get urls _ -> Nothing hasOrigin :: IO Bool -hasOrigin = do +hasOrigin = catchDefaultIO False $ do rs <- lines <$> readProcess "git" ["remote"] return $ "origin" `elem` rs diff --git a/src/Propellor/Protocol.hs b/src/Propellor/Protocol.hs index 68c2443b..95a671bc 100644 --- a/src/Propellor/Protocol.hs +++ b/src/Propellor/Protocol.hs @@ -13,7 +13,7 @@ import Data.List import Propellor -data Stage = NeedGitClone | NeedRepoUrl | NeedPrivData | NeedGitPush +data Stage = NeedGitClone | NeedRepoUrl | NeedPrivData | NeedGitPush | NeedPrecompiled deriving (Read, Show, Eq) type Marker = String diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index 513a81f4..786d1211 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -16,6 +16,7 @@ import Propellor.Protocol import Propellor.PrivData.Paths import Propellor.Git import Propellor.Ssh +import qualified Propellor.Shim as Shim import Utility.FileMode import Utility.SafeCommand @@ -69,6 +70,11 @@ updateServer hn hst connect = connect go hClose fromh sendGitClone hn updateServer hn hst connect + (Just NeedPrecompiled) -> do + hClose toh + hClose fromh + sendPrecompiled hn + updateServer hn hst connect Nothing -> return () sendRepoUrl :: Handle -> IO () @@ -113,6 +119,32 @@ sendGitClone hn = void $ actionMessage ("Clone git repository to " ++ hn) $ do , "rm -f " ++ remotebundle ] +-- Send a tarball containing the precompiled propellor, and libraries. +-- This should be reasonably portable, as long as the remote host has the +-- same architecture as the build host. +sendPrecompiled :: HostName -> IO () +sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor as a last resort " ++ hn) $ do + cacheparams <- sshCachingParams hn + withTmpDir "propellor" $ \tmpdir -> + bracket getWorkingDirectory changeWorkingDirectory $ \_ -> do + changeWorkingDirectory tmpdir + let shimdir = "propellor" + let me = localdir "propellor" + void $ Shim.setup me shimdir + withTmpFile "propellor.tar" $ \tarball -> allM id + [ boolSystem "strip" [File me] + , boolSystem "tar" [Param "cf", File tmp, File shimdir] + , boolSystem "scp" $ cacheparams ++ [File tarball, Param ("root@"++hn++":"++remotetarball) + , boolSystem "ssh" $ cacheparams ++ [Param ("root@"++hn), Param unpackcmd] + ] + where + remotetarball = "/usr/local/propellor.tar" + unpackcmd = shellSwap $ intercalate " && " + [ "cd " ++ takeDirectory remotetarball + , "tar xf " ++ remotetarball + , "rm -f " ++ remotetarball + ] + -- Shim for git push over the propellor ssh channel. -- Reads from stdin and sends it to hout; -- reads from hin and sends it to stdout. -- cgit v1.2.3 From 7fd338f96f5852ea309bd4a2964bf93d06062086 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:25:00 -0400 Subject: propellor spin --- src/Propellor/CmdLine.hs | 2 +- src/Propellor/Server.hs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index ec2ca7ed..99826c3a 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -176,7 +176,7 @@ spin hn hst = do updatecmd = mkcmd [ "if [ ! -d " ++ localdir ++ " ]" , "then (" ++ intercalate " && " - [ "apt-get update" + [ "apt-get-fail update" , "apt-get --no-install-recommends --no-upgrade -y install git make" , "echo " ++ toMarked statusMarker (show NeedGitClone) ] ++ ") || echo " ++ toMarked statusMarker (show NeedPrecompiled) diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index 786d1211..a8cd6a00 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -8,7 +8,9 @@ import Data.List import System.Exit import System.PosixCompat import System.Posix.IO +import System.Posix.Directory import Control.Concurrent.Async +import Control.Exception (bracket) import qualified Data.ByteString as B import Propellor @@ -131,15 +133,15 @@ sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor let shimdir = "propellor" let me = localdir "propellor" void $ Shim.setup me shimdir - withTmpFile "propellor.tar" $ \tarball -> allM id + withTmpFile "propellor.tar" $ \tarball _ -> allM id [ boolSystem "strip" [File me] - , boolSystem "tar" [Param "cf", File tmp, File shimdir] - , boolSystem "scp" $ cacheparams ++ [File tarball, Param ("root@"++hn++":"++remotetarball) + , boolSystem "tar" [Param "cf", File tarball, File shimdir] + , boolSystem "scp" $ cacheparams ++ [File tarball, Param ("root@"++hn++":"++remotetarball)] , boolSystem "ssh" $ cacheparams ++ [Param ("root@"++hn), Param unpackcmd] ] where remotetarball = "/usr/local/propellor.tar" - unpackcmd = shellSwap $ intercalate " && " + unpackcmd = shellWrap $ intercalate " && " [ "cd " ++ takeDirectory remotetarball , "tar xf " ++ remotetarball , "rm -f " ++ remotetarball -- cgit v1.2.3 From 99e0a5fea733fbeb18ee8fa4556994a50e470b7b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:27:35 -0400 Subject: propellor spin --- src/Propellor/Server.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index a8cd6a00..eff56997 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -131,7 +131,7 @@ sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor bracket getWorkingDirectory changeWorkingDirectory $ \_ -> do changeWorkingDirectory tmpdir let shimdir = "propellor" - let me = localdir "propellor" + me <- readSymbolicLink "/proc/self/exe" void $ Shim.setup me shimdir withTmpFile "propellor.tar" $ \tarball _ -> allM id [ boolSystem "strip" [File me] -- cgit v1.2.3 From e5135c19489ee0799f9408c2336ebf98c6ddadf3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:32:04 -0400 Subject: propellor spin --- src/Propellor/Server.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index eff56997..d6987d2d 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -76,7 +76,6 @@ updateServer hn hst connect = connect go hClose toh hClose fromh sendPrecompiled hn - updateServer hn hst connect Nothing -> return () sendRepoUrl :: Handle -> IO () @@ -125,14 +124,16 @@ sendGitClone hn = void $ actionMessage ("Clone git repository to " ++ hn) $ do -- This should be reasonably portable, as long as the remote host has the -- same architecture as the build host. sendPrecompiled :: HostName -> IO () -sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor as a last resort " ++ hn) $ do +sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor as a last resort") $ do cacheparams <- sshCachingParams hn withTmpDir "propellor" $ \tmpdir -> bracket getWorkingDirectory changeWorkingDirectory $ \_ -> do changeWorkingDirectory tmpdir let shimdir = "propellor" me <- readSymbolicLink "/proc/self/exe" - void $ Shim.setup me shimdir + shim <- Shim.setup me shimdir + when (shim /= shimdir "propellor") $ + renameFile shim (shimdir "propellor") withTmpFile "propellor.tar" $ \tarball _ -> allM id [ boolSystem "strip" [File me] , boolSystem "tar" [Param "cf", File tarball, File shimdir] -- cgit v1.2.3 From f1fdd6f678d2d5d753407434a53cc6e2876185ae Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:34:34 -0400 Subject: propellor spin --- src/Propellor/Server.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index d6987d2d..a72c83ae 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -128,13 +128,14 @@ sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor cacheparams <- sshCachingParams hn withTmpDir "propellor" $ \tmpdir -> bracket getWorkingDirectory changeWorkingDirectory $ \_ -> do - changeWorkingDirectory tmpdir let shimdir = "propellor" + changeWorkingDirectory shimdir me <- readSymbolicLink "/proc/self/exe" - shim <- Shim.setup me shimdir + shim <- Shim.setup me "." + changeWorkingDirectory tmpdir when (shim /= shimdir "propellor") $ renameFile shim (shimdir "propellor") - withTmpFile "propellor.tar" $ \tarball _ -> allM id + withTmpFile "propellor.tar." $ \tarball _ -> allM id [ boolSystem "strip" [File me] , boolSystem "tar" [Param "cf", File tarball, File shimdir] , boolSystem "scp" $ cacheparams ++ [File tarball, Param ("root@"++hn++":"++remotetarball)] -- cgit v1.2.3 From 1af398d33eee40a13d7c310e6f97b170b47d21ff Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:35:14 -0400 Subject: propellor spin --- src/Propellor/Server.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index a72c83ae..fb37ff1a 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -129,6 +129,7 @@ sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor withTmpDir "propellor" $ \tmpdir -> bracket getWorkingDirectory changeWorkingDirectory $ \_ -> do let shimdir = "propellor" + createDirectoryIfMissing True shimdir changeWorkingDirectory shimdir me <- readSymbolicLink "/proc/self/exe" shim <- Shim.setup me "." -- cgit v1.2.3 From 083b82d8100ef1915a00f8fbcd1530b85448dc9d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:36:16 -0400 Subject: propellor spin --- src/Propellor/Server.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index fb37ff1a..fde9c2ec 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -129,13 +129,13 @@ sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor withTmpDir "propellor" $ \tmpdir -> bracket getWorkingDirectory changeWorkingDirectory $ \_ -> do let shimdir = "propellor" - createDirectoryIfMissing True shimdir - changeWorkingDirectory shimdir + createDirectoryIfMissing True (tmpdir shimdir) + changeWorkingDirectory (tmpdir shimdir) me <- readSymbolicLink "/proc/self/exe" shim <- Shim.setup me "." + when (shim /= "propellor") $ + renameFile shim "propellor" changeWorkingDirectory tmpdir - when (shim /= shimdir "propellor") $ - renameFile shim (shimdir "propellor") withTmpFile "propellor.tar." $ \tarball _ -> allM id [ boolSystem "strip" [File me] , boolSystem "tar" [Param "cf", File tarball, File shimdir] -- cgit v1.2.3 From 0d65fdeb1dcb414b0fb1d5719dd734a1b04da1e5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:44:13 -0400 Subject: propellor spin --- src/Propellor/Server.hs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index fde9c2ec..06fede7e 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -27,17 +27,19 @@ import Utility.SafeCommand -- running the updateServer update :: IO () update = do - req NeedRepoUrl repoUrlMarker setRepoUrl + whenM hasOrigin $ + 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" + whenM hasOrigin $ + 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" @@ -76,6 +78,7 @@ updateServer hn hst connect = connect go hClose toh hClose fromh sendPrecompiled hn + loop Nothing -> return () sendRepoUrl :: Handle -> IO () -- cgit v1.2.3 From 5d6e1a27a5a39f05b254a7fc351a2dc34ef4620c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:46:07 -0400 Subject: propellor spin --- src/Propellor/Server.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index 06fede7e..eaf9649f 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -78,7 +78,7 @@ updateServer hn hst connect = connect go hClose toh hClose fromh sendPrecompiled hn - loop + updateServer hn hst connect Nothing -> return () sendRepoUrl :: Handle -> IO () -- cgit v1.2.3 From ea058a5f9f4bf20d82f5d5d0fbbdbf74ce3cbfcc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:47:26 -0400 Subject: remove test hack --- src/Propellor/CmdLine.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Propellor') diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index 99826c3a..ec2ca7ed 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -176,7 +176,7 @@ spin hn hst = do updatecmd = mkcmd [ "if [ ! -d " ++ localdir ++ " ]" , "then (" ++ intercalate " && " - [ "apt-get-fail update" + [ "apt-get update" , "apt-get --no-install-recommends --no-upgrade -y install git make" , "echo " ++ toMarked statusMarker (show NeedGitClone) ] ++ ") || echo " ++ toMarked statusMarker (show NeedPrecompiled) -- cgit v1.2.3 From cd6ca049b8ba90bdb4a1ba6ebf258fc68809049a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:50:56 -0400 Subject: cleanup --- src/Propellor/Server.hs | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index eaf9649f..001b4762 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -128,25 +128,28 @@ 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 - cacheparams <- sshCachingParams hn - withTmpDir "propellor" $ \tmpdir -> - bracket getWorkingDirectory changeWorkingDirectory $ \_ -> do - let shimdir = "propellor" - createDirectoryIfMissing True (tmpdir shimdir) - changeWorkingDirectory (tmpdir shimdir) - me <- readSymbolicLink "/proc/self/exe" - shim <- Shim.setup me "." - when (shim /= "propellor") $ - renameFile shim "propellor" - changeWorkingDirectory tmpdir - withTmpFile "propellor.tar." $ \tarball _ -> allM id - [ boolSystem "strip" [File me] - , boolSystem "tar" [Param "cf", File tarball, File shimdir] - , boolSystem "scp" $ cacheparams ++ [File tarball, Param ("root@"++hn++":"++remotetarball)] - , boolSystem "ssh" $ cacheparams ++ [Param ("root@"++hn), Param unpackcmd] - ] + bracket getWorkingDirectory changeWorkingDirectory $ \_ -> + withTmpDir "propellor" go where + go tmpdir = do + cacheparams <- sshCachingParams hn + let shimdir = takeFileName localdir + createDirectoryIfMissing True (tmpdir shimdir) + changeWorkingDirectory (tmpdir shimdir) + me <- readSymbolicLink "/proc/self/exe" + shim <- Shim.setup me "." + when (shim /= "propellor") $ + renameFile shim "propellor" + changeWorkingDirectory tmpdir + withTmpFile "propellor.tar." $ \tarball _ -> allM id + [ boolSystem "strip" [File me] + , boolSystem "tar" [Param "cf", File tarball, File shimdir] + , boolSystem "scp" $ cacheparams ++ [File tarball, Param ("root@"++hn++":"++remotetarball)] + , boolSystem "ssh" $ cacheparams ++ [Param ("root@"++hn), Param unpackcmd] + ] + remotetarball = "/usr/local/propellor.tar" + unpackcmd = shellWrap $ intercalate " && " [ "cd " ++ takeDirectory remotetarball , "tar xf " ++ remotetarball -- cgit v1.2.3 From c0662e6258e5fc8f5755f01de7d7184c532c6431 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 00:52:59 -0400 Subject: comment --- src/Propellor/Server.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index 001b4762..743490a4 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -1,3 +1,7 @@ +-- When propellor --spin is running, the local host acts as a server, +-- which connects to the remote host's propellor and responds to its +-- requests. + module Propellor.Server ( update, updateServer, -- cgit v1.2.3 From 128e16472a03929b089dcf44e28c651edcefcd43 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 01:13:53 -0400 Subject: compress tarball 11 mb -> 4 mb --- src/Propellor/Server.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index 743490a4..19a2c901 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -147,7 +147,7 @@ sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor changeWorkingDirectory tmpdir withTmpFile "propellor.tar." $ \tarball _ -> allM id [ boolSystem "strip" [File me] - , boolSystem "tar" [Param "cf", File tarball, File shimdir] + , boolSystem "tar" [Param "czf", File tarball, File shimdir] , boolSystem "scp" $ cacheparams ++ [File tarball, Param ("root@"++hn++":"++remotetarball)] , boolSystem "ssh" $ cacheparams ++ [Param ("root@"++hn), Param unpackcmd] ] @@ -156,7 +156,7 @@ sendPrecompiled hn = void $ actionMessage ("Uploading locally compiled propellor unpackcmd = shellWrap $ intercalate " && " [ "cd " ++ takeDirectory remotetarball - , "tar xf " ++ remotetarball + , "tar xzf " ++ remotetarball , "rm -f " ++ remotetarball ] -- cgit v1.2.3 From e0c2d6a73af01f138a50b80a6885718ed0b9dad1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 02:04:01 -0400 Subject: comment --- src/Propellor/Shim.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Propellor') diff --git a/src/Propellor/Shim.hs b/src/Propellor/Shim.hs index 5b5aa68e..1bfbb0ca 100644 --- a/src/Propellor/Shim.hs +++ b/src/Propellor/Shim.hs @@ -45,6 +45,8 @@ setup propellorbin dest = do modifyFileMode shim (addModes executeModes) return shim +-- Called when the shimmed propellor is running, so that commands it runs +-- don't see it. cleanEnv :: IO () cleanEnv = void $ unsetEnv "GCONV_PATH" -- cgit v1.2.3