From 005e6985dca760bced6e6f2af5df4a0a5cadb0e3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 8 Mar 2017 14:02:31 -0400 Subject: added Apache.confEnabled --- src/Propellor/Property/Apache.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/Propellor/Property/Apache.hs b/src/Propellor/Property/Apache.hs index d912acc1..554a5837 100644 --- a/src/Propellor/Property/Apache.hs +++ b/src/Propellor/Property/Apache.hs @@ -64,6 +64,24 @@ modEnabled modname = enable disable `onChange` reloaded isenabled = boolSystem "a2query" [Param "-q", Param "-m", Param modname] +-- | Control whether an apache configuration file is enabled. +-- +-- The String is the base name of the configuration, eg "charset" or "gitweb". +confEnabled :: String -> RevertableProperty DebianLike DebianLike +confEnabled confname = enable disable + where + enable = check (not <$> isenabled) + (cmdProperty "a2enconf" ["--quiet", confname]) + `describe` ("apache configuration enabled " ++ confname) + `requires` installed + `onChange` reloaded + disable = check isenabled + (cmdProperty "a2disconf" ["--quiet", confname]) + `describe` ("apache configuration disabled " ++ confname) + `requires` installed + `onChange` reloaded + isenabled = boolSystem "a2query" [Param "-q", Param "-c", Param confname] + -- | Make apache listen on the specified ports. -- -- Note that ports are also specified inside a site's config file, -- cgit v1.2.3