summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2014-03-29 23:24:40 -0400
committerJoey Hess2014-03-29 23:25:04 -0400
commit0e1b587442fb78bcbf4886b53b85ab64b45215b0 (patch)
tree9a5e32a9b96c4d025ed38b360c87acba0aaf5524
parentd9af8bac5eb7836a3c90e37e870fd73d30b841fd (diff)
install systemd on clam and then reboot
-rw-r--r--Host/clam.hs7
-rw-r--r--Property/GitHome.hs4
-rw-r--r--Property/Reboot.hs8
-rw-r--r--TODO4
4 files changed, 19 insertions, 4 deletions
diff --git a/Host/clam.hs b/Host/clam.hs
index 4241222d..53b349df 100644
--- a/Host/clam.hs
+++ b/Host/clam.hs
@@ -3,18 +3,21 @@ import qualified Property.Apt as Apt
import qualified Property.Ssh as Ssh
import qualified Property.User as User
import qualified Property.GitHome as GitHome
+import qualified Property.Reboot as Reboot
main = defaultMain
[ Apt.stdSourcesList Apt.Unstable `onChange` Apt.upgrade
, Apt.installed ["etckeeper"]
, Apt.installed ["ssh"]
, Apt.installed ["git", "myrepos"]
- , GitHome.installed "root"
+ , GitHome.installedFor "root"
, check (Ssh.hasAuthorizedKeys "root") $
Ssh.passwordAuthentication False
, User.nonsystem "joey"
+ , Apt.installed ["sudo"]
, fileHasContent "/etc/sudoers" ["joey ALL=(ALL:ALL) ALL"]
- , GitHome.installed "joey"
+ , GitHome.installedFor "joey"
, Apt.removed ["exim4"] `onChange` Apt.autoRemove
, Apt.installed ["tor"]
+ , Apt.installed ["systemd-sysv"] `onChange` Reboot.scheduled "+10"
]
diff --git a/Property/GitHome.hs b/Property/GitHome.hs
index 6bbae254..f0764db9 100644
--- a/Property/GitHome.hs
+++ b/Property/GitHome.hs
@@ -13,8 +13,8 @@ import Utility.Monad
import Utility.Exception
{- Clones Joey Hess's git home directory, and runs its fixups script. -}
-installed :: UserName -> Property
-installed user = check (not <$> hasGitDir user) $
+installedFor :: UserName -> Property
+installedFor user = check (not <$> hasGitDir user) $
IOProperty ("githome " ++ user) (go =<< homedir user)
where
go Nothing = noChange
diff --git a/Property/Reboot.hs b/Property/Reboot.hs
new file mode 100644
index 00000000..668a7a49
--- /dev/null
+++ b/Property/Reboot.hs
@@ -0,0 +1,8 @@
+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 ]
diff --git a/TODO b/TODO
new file mode 100644
index 00000000..4617c2b9
--- /dev/null
+++ b/TODO
@@ -0,0 +1,4 @@
+* Need a way to run an action when a property changes, but only
+ run it once for the whole. For example, may want to restart apache,
+ but only once despite many config changes being made to satisfy
+ properties. onChange is a poor substitute.