summaryrefslogtreecommitdiff
path: root/src/Propellor
diff options
context:
space:
mode:
authorJoey Hess2016-03-20 13:28:53 -0400
committerJoey Hess2016-03-20 13:28:53 -0400
commit394d44880ede6dd7fb916f21ca4fe24d9b3549c6 (patch)
treeae41ec177598827b743449a461a8fd20b27ce174 /src/Propellor
parent8e27dce708f9af48712dfa26274715ce22cb40e0 (diff)
parent80109620f6af779a2c58bc5766fb77301729f60f (diff)
Merge branch 'master' into typed-os-requirements
Diffstat (limited to 'src/Propellor')
-rw-r--r--src/Propellor/Bootstrap.hs4
-rw-r--r--src/Propellor/CmdLine.hs9
-rw-r--r--src/Propellor/Property/FreeBSD/Pkg.hs2
-rw-r--r--src/Propellor/Property/FreeBSD/Poudriere.hs2
-rw-r--r--src/Propellor/Property/Tor.hs22
5 files changed, 26 insertions, 13 deletions
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs
index 11e59e6f..69eee66c 100644
--- a/src/Propellor/Bootstrap.hs
+++ b/src/Propellor/Bootstrap.hs
@@ -34,7 +34,7 @@ checkBinaryCommand = "if test -x ./propellor && ! ./propellor --check; then " ++
buildCommand :: ShellCommand
buildCommand = intercalate " && "
[ "cabal configure"
- , "cabal build"
+ , "cabal build propellor-config"
, "ln -sf dist/build/propellor-config/propellor-config propellor"
]
@@ -141,7 +141,7 @@ build :: IO Bool
build = catchBoolIO $ do
make "dist/setup-config" ["propellor.cabal"] $
cabal ["configure"]
- unlessM (cabal ["build"]) $ do
+ unlessM (cabal ["build", "propellor-config"]) $ do
void $ cabal ["configure"]
unlessM (cabal ["build"]) $
error "cabal build failed"
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs
index 1761a11e..ee057d05 100644
--- a/src/Propellor/CmdLine.hs
+++ b/src/Propellor/CmdLine.hs
@@ -122,11 +122,10 @@ defaultMain hostlist = withConcurrentOutput $ do
go cr cmdline@(Spin hs mrelay) = buildFirst cr cmdline $ do
unless (isJust mrelay) commitSpin
forM_ hs $ \hn -> withhost hn $ spin mrelay hn
- go cr (Run hn) = fetchFirst $
- ifM ((==) 0 <$> getRealUserID)
- ( runhost hn
- , go cr (Spin [hn] Nothing)
- )
+ go cr cmdline@(Run hn) = ifM ((==) 0 <$> getRealUserID)
+ ( updateFirst cr cmdline $ runhost hn
+ , fetchFirst $ go cr (Spin [hn] Nothing)
+ )
go cr cmdline@(SimpleRun hn) = forceConsole >>
fetchFirst (buildFirst cr cmdline (runhost hn))
-- When continuing after a rebuild, don't want to rebuild again.
diff --git a/src/Propellor/Property/FreeBSD/Pkg.hs b/src/Propellor/Property/FreeBSD/Pkg.hs
index 913710f7..6bbd2570 100644
--- a/src/Propellor/Property/FreeBSD/Pkg.hs
+++ b/src/Propellor/Property/FreeBSD/Pkg.hs
@@ -2,7 +2,7 @@
--
-- FreeBSD pkgng properties
-{-# Language ScopedTypeVariables, GeneralizedNewtypeDeriving #-}
+{-# Language ScopedTypeVariables, GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
module Propellor.Property.FreeBSD.Pkg where
diff --git a/src/Propellor/Property/FreeBSD/Poudriere.hs b/src/Propellor/Property/FreeBSD/Poudriere.hs
index 7ed7f59e..5467c668 100644
--- a/src/Propellor/Property/FreeBSD/Poudriere.hs
+++ b/src/Propellor/Property/FreeBSD/Poudriere.hs
@@ -2,7 +2,7 @@
--
-- FreeBSD Poudriere properties
-{-# Language GeneralizedNewtypeDeriving #-}
+{-# Language GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
module Propellor.Property.FreeBSD.Poudriere where
diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs
index e5fcdaa4..0c040f95 100644
--- a/src/Propellor/Property/Tor.hs
+++ b/src/Propellor/Property/Tor.hs
@@ -54,18 +54,32 @@ named n = configured [("Nickname", n')]
torPrivKey :: Context -> Property HasInfo
torPrivKey context = f `File.hasPrivContent` context
`onChange` File.ownerGroup f user (userGroup user)
- -- install tor first, so the directory exists with right perms
- `requires` Apt.installed ["tor"]
+ `requires` torPrivKeyDirExists
where
- f = "/var/lib/tor/keys/secret_id_key"
+ f = torPrivKeyDir </> "secret_id_key"
+
+torPrivKeyDirExists :: Property NoInfo
+torPrivKeyDirExists = File.dirExists torPrivKeyDir
+ `onChange` setperms
+ `requires` installed
+ where
+ setperms = File.ownerGroup torPrivKeyDir user (userGroup user)
+ `before` File.mode torPrivKeyDir 0O2700
+
+torPrivKeyDir :: FilePath
+torPrivKeyDir = "/var/lib/tor/keys"
-- | A tor server (bridge, relay, or exit)
-- Don't use if you just want to run tor for personal use.
server :: Property NoInfo
server = configured [("SocksPort", "0")]
- `requires` Apt.installed ["tor", "ntp"]
+ `requires` installed
+ `requires` Apt.installed ["ntp"]
`describe` "tor server"
+installed :: Property NoInfo
+installed = Apt.installed ["tor"]
+
-- | Specifies configuration settings. Any lines in the config file
-- that set other values for the specified settings will be removed,
-- while other settings are left as-is. Tor is restarted when