propellor spin
This commit is contained in:
parent
0d188bf5f6
commit
90682a7984
|
@ -25,7 +25,7 @@ reloaded = Service.reloaded "postfix"
|
||||||
-- futher coniguration/keys. But this should be enough to get cron job
|
-- futher coniguration/keys. But this should be enough to get cron job
|
||||||
-- mail flowing to a place where it will be seen.
|
-- mail flowing to a place where it will be seen.
|
||||||
satellite :: Property
|
satellite :: Property
|
||||||
satellite = check norelayhost setup
|
satellite = check (not <$> mainCfIsSet "relayhost") setup
|
||||||
`requires` installed
|
`requires` installed
|
||||||
where
|
where
|
||||||
setup = trivial $ property "postfix satellite system" $ do
|
setup = trivial $ property "postfix satellite system" $ do
|
||||||
|
@ -41,13 +41,6 @@ satellite = check norelayhost setup
|
||||||
, mainCf ("relayhost", domain)
|
, mainCf ("relayhost", domain)
|
||||||
`onChange` reloaded
|
`onChange` reloaded
|
||||||
]
|
]
|
||||||
norelayhost = not . any relayhostset . lines
|
|
||||||
<$> readProcess "postconf" []
|
|
||||||
relayhostset l
|
|
||||||
| l == "relayhost =" = False
|
|
||||||
| l == "relayhost = " = False
|
|
||||||
| "relayhost =" `isPrefixOf` l = True
|
|
||||||
| otherwise = False
|
|
||||||
|
|
||||||
-- | Sets up a file by running a property (which the filename is passed
|
-- | Sets up a file by running a property (which the filename is passed
|
||||||
-- to). If the setup property makes a change, postmap will be run on the
|
-- to). If the setup property makes a change, postmap will be run on the
|
||||||
|
@ -84,6 +77,13 @@ getMainCf name = parse . lines <$> readProcess "postconf" [name]
|
||||||
(_, v) -> v
|
(_, v) -> v
|
||||||
parse [] = Nothing
|
parse [] = Nothing
|
||||||
|
|
||||||
|
-- | Checks if a main.cf field is set. A field that is set to ""
|
||||||
|
-- is considered not set.
|
||||||
|
mainCfIsSet :: String -> IO Bool
|
||||||
|
mainCfIsSet name = do
|
||||||
|
v <- getMainCf name
|
||||||
|
return $ v == Nothing || v == Just ""
|
||||||
|
|
||||||
-- | Parses main.cf, and removes any initial configuration lines that are
|
-- | Parses main.cf, and removes any initial configuration lines that are
|
||||||
-- overridden to other values later in the file.
|
-- overridden to other values later in the file.
|
||||||
--
|
--
|
||||||
|
|
Loading…
Reference in New Issue