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
configured :: Timezone -> Property DebianLike
configured :: Timezone -> Property DebianLike
configured Timezone
zone = Timezone -> [Timezone] -> Property UnixLike
File.hasContent Timezone
"/etc/timezone" [Timezone
zone]
Property UnixLike
-> Property DebianLike
-> CombinedType (Property UnixLike) (Property DebianLike)
forall x y. Combines x y => x -> y -> CombinedType x y
`onChange` Property DebianLike
update
Property DebianLike -> Timezone -> Property DebianLike
forall p. IsProp p => p -> Timezone -> p
`describe` (Timezone
zone Timezone -> Timezone -> Timezone
forall a. [a] -> [a] -> [a]
++ Timezone
" timezone configured")
where
update :: CombinedType (Property DebianLike) (Property UnixLike)
update = Timezone -> [(Timezone, Timezone, Timezone)] -> Property DebianLike
Apt.reConfigure Timezone
"tzdata" [(Timezone, Timezone, Timezone)]
forall a. Monoid a => a
mempty
Property DebianLike
-> Property UnixLike
-> CombinedType (Property DebianLike) (Property UnixLike)
forall x y. Combines x y => x -> y -> CombinedType x y
`requires` Timezone -> Property UnixLike
File.notPresent Timezone
"/etc/localtime"