From 6f2ea4ecc79dc191ec690d57d0cabb19542ddd65 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 15 Jul 2017 17:02:48 -0700 Subject: add Timezone.configured --- src/Propellor/Property/Timezone.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/Propellor/Property/Timezone.hs diff --git a/src/Propellor/Property/Timezone.hs b/src/Propellor/Property/Timezone.hs new file mode 100644 index 00000000..91dcbfc6 --- /dev/null +++ b/src/Propellor/Property/Timezone.hs @@ -0,0 +1,19 @@ +-- | Maintainer: Sean Whitton + +module Propellor.Property.Timezone where + +import Propellor.Base +import qualified Propellor.Property.Apt as Apt + +type Timezone = String + +-- | Sets the system's timezone +configured :: Timezone -> Property DebianLike +configured zone = File.hasContent "/etc/timezone" zone + `onChange` update + `describe` (zone ++ " timezone configured") + where + update = Apt.reConfigure "tzdata" mempty + -- work around a bug in recent tzdata. See + -- https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/1554806/ + `requires` File.notPresent "/etc/localtime" -- cgit v1.2.3 From f14958e11eed0c4167972b0d434d251f4c81f7df Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 15 Jul 2017 17:05:26 -0700 Subject: missing import --- src/Propellor/Property/Timezone.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Propellor/Property/Timezone.hs b/src/Propellor/Property/Timezone.hs index 91dcbfc6..896e83fb 100644 --- a/src/Propellor/Property/Timezone.hs +++ b/src/Propellor/Property/Timezone.hs @@ -4,6 +4,7 @@ module Propellor.Property.Timezone where import Propellor.Base import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.File as File type Timezone = String -- cgit v1.2.3 From 7c91ef33df74808423e28daee9e87b513d278360 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 15 Jul 2017 17:06:44 -0700 Subject: docstring for Timezone type --- src/Propellor/Property/Timezone.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Propellor/Property/Timezone.hs b/src/Propellor/Property/Timezone.hs index 896e83fb..267c4f0b 100644 --- a/src/Propellor/Property/Timezone.hs +++ b/src/Propellor/Property/Timezone.hs @@ -6,6 +6,7 @@ import Propellor.Base import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.File as File +-- | A timezone from /usr/share/zoneinfo type Timezone = String -- | Sets the system's timezone -- cgit v1.2.3 From 2d1b302bb29332f6afa602bb4b4a5cca75bf99fd Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 15 Jul 2017 17:06:54 -0700 Subject: fix usage of File.hasContent --- src/Propellor/Property/Timezone.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/Timezone.hs b/src/Propellor/Property/Timezone.hs index 267c4f0b..96a5e59c 100644 --- a/src/Propellor/Property/Timezone.hs +++ b/src/Propellor/Property/Timezone.hs @@ -11,7 +11,7 @@ type Timezone = String -- | Sets the system's timezone configured :: Timezone -> Property DebianLike -configured zone = File.hasContent "/etc/timezone" zone +configured zone = File.hasContent "/etc/timezone" [zone] `onChange` update `describe` (zone ++ " timezone configured") where -- cgit v1.2.3