2014-03-31 03:37:54 +00:00
|
|
|
module Propellor.Property.Hostname where
|
2014-03-30 03:45:48 +00:00
|
|
|
|
2014-03-31 03:55:59 +00:00
|
|
|
import Propellor
|
2014-03-31 03:37:54 +00:00
|
|
|
import qualified Propellor.Property.File as File
|
2014-03-30 03:45:48 +00:00
|
|
|
|
2014-04-04 03:32:00 +00:00
|
|
|
-- | Sets the hostname. Should be provided with a FQDN, and will configure
|
|
|
|
-- both /etc/hostname (with the base hostname) and /etc/hosts (with the
|
|
|
|
-- full hostname). Also sets the current hostname.
|
2014-03-30 03:45:48 +00:00
|
|
|
set :: HostName -> Property
|
2014-03-30 17:12:33 +00:00
|
|
|
set hostname = "/etc/hostname" `File.hasContent` [hostname]
|
2014-03-31 03:55:59 +00:00
|
|
|
`onChange` cmdProperty "hostname" [hostname]
|
2014-03-30 20:04:50 +00:00
|
|
|
`describe` ("hostname " ++ hostname)
|
2014-04-04 03:35:36 +00:00
|
|
|
where
|
|
|
|
(host, domain) = separate (== '.') hostname
|