summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2014-03-30 02:12:48 -0400
committerJoey Hess2014-03-30 02:12:48 -0400
commitd50e4dedb20054877916191d66d537defb738667 (patch)
treef10003f9b66430272f13c41832078b93f2b4fb68
parentc8bd3436973f2c6f742ab9d4189e686f58bfa412 (diff)
improved
-rw-r--r--HostProp.hs41
-rw-r--r--Property/Reboot.hs5
2 files changed, 28 insertions, 18 deletions
diff --git a/HostProp.hs b/HostProp.hs
index 84ae934f..152ad5a0 100644
--- a/HostProp.hs
+++ b/HostProp.hs
@@ -15,14 +15,34 @@ 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.kitenet.net" =
- -- Clean up the system as installed by cloudatcost.com
+getProperties "clam.kitenet.net" = concat
+ [ cleanCloudAtCost
+ , standardSystem Apt.Unstable
+ -- Clam is a tor bridge.
+ , Tor.isBridge
+ -- This is not an important system so I don't want to need to
+ -- manually upgrade it.
+ , Apt.unattendedUpgrades True
+ -- Should come last as it reboots.
+ , Apt.installed ["systemd-sysv"] `onChange` Reboot.now
+ ]
+-- add more hosts here...
+--getProperties "foo" =
+getProperties h = error $ "Unknown host: " ++ h ++ " (perhaps you should specify the real hostname on the command line?)"
+
+-- Clean up the system as installed by cloudatcost.com
+cleanCloudAtCost :: [Property]
+cleanCloudAtCost =
[ User.nuked "user"
, Apt.removed ["exim4"] `onChange` Apt.autoRemove
, Hostname.set "clam.kitenet.net"
, Ssh.uniqueHostKeys
- -- This is my standard system setup
- , Apt.stdSourcesList Apt.Unstable `onChange` Apt.upgrade
+ ]
+
+-- This is my standard system setup
+standardSystem :: Suite -> [Property]
+standardSystem suite =
+ [ Apt.stdSourcesList suite `onChange` Apt.upgrade
, Apt.installed ["etckeeper"]
, Apt.installed ["ssh"]
, GitHome.installedFor "root"
@@ -35,16 +55,7 @@ getProperties "clam.kitenet.net" =
, Apt.installed ["vim"]
, User.nonsystem "joey"
, Apt.installed ["sudo"]
- , lineInFile "/etc/sudoers" "joey ALL=(ALL:ALL) ALL"
+ -- nopasswd because no password is set up for joey.
+ , lineInFile "/etc/sudoers" "joey ALL=(ALL:ALL) NOPASSWD:ALL"
, GitHome.installedFor "joey"
- -- Clam is a tor bridge.
- , Tor.isBridge
- -- This is not an important system so I don't want to need to
- -- manually upgrade it.
- , Apt.unattendedUpgrades True
- -- Should come last as it reboots.
- , Apt.installed ["systemd-sysv"] `onChange` Reboot.scheduled "+10"
]
--- add more hosts here...
---getProperties "foo" =
-getProperties h = error $ "Unknown host: " ++ h ++ " (perhaps you should specify the real hostname on the command line?)"
diff --git a/Property/Reboot.hs b/Property/Reboot.hs
index 668a7a49..63987ad3 100644
--- a/Property/Reboot.hs
+++ b/Property/Reboot.hs
@@ -3,6 +3,5 @@ module Property.Reboot where
import Property
import Utility.SafeCommand
-{- Use eg, "+5" to reboot in 5 minutes. -}
-scheduled :: String -> Property
-scheduled rebootwhen = cmdProperty "shutdown" [ Param "-r", Param rebootwhen ]
+now -> Property
+now = cmdProperty "reboot" []