summaryrefslogtreecommitdiff
path: root/Property
diff options
context:
space:
mode:
authorJoey Hess2014-03-30 00:52:02 -0400
committerJoey Hess2014-03-30 00:52:02 -0400
commite812acce3e46b7dd259783fc28c2c65d4ad7a228 (patch)
tree0e4fb9437427d5b58cfaaee77d3025a6c8c93498 /Property
parent08a0a46efe9b96ba741d4cd28451e313726dcba4 (diff)
improvements
Diffstat (limited to 'Property')
-rw-r--r--Property/GitHome.hs2
-rw-r--r--Property/Tor.hs21
2 files changed, 11 insertions, 12 deletions
diff --git a/Property/GitHome.hs b/Property/GitHome.hs
index 217e129a..09d21326 100644
--- a/Property/GitHome.hs
+++ b/Property/GitHome.hs
@@ -11,11 +11,13 @@ import Utility.SafeCommand
import Utility.Directory
import Utility.Monad
import Utility.Exception
+import qualified Property.Apt as Apt
{- Clones Joey Hess's git home directory, and runs its fixups script. -}
installedFor :: UserName -> Property
installedFor user = check (not <$> hasGitDir user) $
IOProperty ("githome " ++ user) (go =<< homedir user)
+ `requires` Apt.installed ["git", "myrepos"]
where
go Nothing = noChange
go (Just home) = do
diff --git a/Property/Tor.hs b/Property/Tor.hs
index bebf0763..b26ba68e 100644
--- a/Property/Tor.hs
+++ b/Property/Tor.hs
@@ -1,21 +1,18 @@
module Property.Tor where
-import Control.Applicative
-import Control.Monad
-import System.FilePath
-
import Property
-import Property.User
import Utility.SafeCommand
-import Utility.Exception
+import qualified Property.Apt as Apt
isBridge :: Property
-isBridge = fileHasContent "/etc/tor/torrc"
- [ "SocksPort 0"
- , "ORPort 443"
- , "BridgeRelay 1"
- , "Exitpolicy reject *:*"
- ] `onChange` restartTor
+isBridge = setup `requires` Apt.installed ["tor"]
+ where
+ setup = fileHasContent "/etc/tor/torrc"
+ [ "SocksPort 0"
+ , "ORPort 443"
+ , "BridgeRelay 1"
+ , "Exitpolicy reject *:*"
+ ] `onChange` restartTor
restartTor :: Property
restartTor = cmdProperty "service" [Param "tor", Param "restart"]