summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2014-03-30 01:17:19 -0400
committerJoey Hess2014-03-30 01:17:19 -0400
commit3940f2cbde7a7ca220be932abb58f1c1a99c9b26 (patch)
tree0b4b31ce29161e1adcfdb1087b5dfd08bb9f7691
parent8684db8bbf886d5dc41523e2b79df54aa1702cf8 (diff)
use fqdn
-rw-r--r--HostName.hs10
-rw-r--r--HostProp.hs2
-rw-r--r--Utility/Network.hs21
3 files changed, 7 insertions, 26 deletions
diff --git a/HostName.hs b/HostName.hs
index dfe9efb4..2cc50ea9 100644
--- a/HostName.hs
+++ b/HostName.hs
@@ -1,10 +1,9 @@
module HostName where
-import Data.Maybe
import Control.Applicative
import System.Environment
-import qualified Utility.Network as Network
+import Utility.Process
type HostName = String
@@ -12,5 +11,8 @@ getHostName :: IO HostName
getHostName = go =<< getArgs
where
go (h:_) = return h
- go [] = fromMaybe nohostname <$> Network.getHostname
- nohostname = error "Cannot determine hostname! Pass it on the command line."
+ go [] = do
+ s <- takeWhile (/= '\n') <$> readProcess "hostname" ["-f"]
+ if null s
+ then error "Cannot determine hostname! Pass it on the command line."
+ else return s
diff --git a/HostProp.hs b/HostProp.hs
index 7a98c5a5..2b393cdd 100644
--- a/HostProp.hs
+++ b/HostProp.hs
@@ -15,7 +15,7 @@ main = ensureProperties . getProperties =<< getHostName
- or one specified on the command line is converted into a list of
- Properties for that system. -}
getProperties :: HostName -> [Property]
-getProperties "clam" =
+getProperties "clam.kitenet.net" =
-- Clean up the system as installed by cloudatcost.com
[ User.nuked "user"
, Apt.removed ["exim4"] `onChange` Apt.autoRemove
diff --git a/Utility/Network.hs b/Utility/Network.hs
deleted file mode 100644
index 62523c9e..00000000
--- a/Utility/Network.hs
+++ /dev/null
@@ -1,21 +0,0 @@
-{- network functions
- -
- - Copyright 2012 Joey Hess <joey@kitenet.net>
- -
- - Licensed under the GNU GPL version 3 or higher.
- -}
-
-module Utility.Network where
-
-import Utility.Process
-import Utility.Exception
-
-import Control.Applicative
-
-{- Haskell lacks uname(2) bindings, except in the
- - Bindings.Uname addon. Rather than depend on that,
- - use uname -n when available. -}
-getHostname :: IO (Maybe String)
-getHostname = catchMaybeIO uname_node
- where
- uname_node = takeWhile (/= '\n') <$> readProcess "uname" ["-n"]