summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Tor.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Property/Tor.hs')
-rw-r--r--src/Propellor/Property/Tor.hs30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs
index 862af983..426d4209 100644
--- a/src/Propellor/Property/Tor.hs
+++ b/src/Propellor/Property/Tor.hs
@@ -172,22 +172,20 @@ hiddenServiceData hn context = combineProperties desc $ props
where
desc = unwords ["hidden service data available in", varLib </> hn]
installonion :: FilePath -> Property (HasInfo + DebianLike)
- installonion basef =
- let f = varLib </> hn </> basef
- in withPrivData (PrivFile f) context $ \getcontent ->
- property' desc $ \w -> getcontent $ \privcontent ->
- ifM (liftIO $ doesFileExist f)
- ( noChange
- , ensureProperty w $ propertyList desc $ toProps
- [ property desc $ makeChange $ do
- createDirectoryIfMissing True (takeDirectory f)
- writeFileProtected f (unlines (privDataLines privcontent))
- , File.mode (takeDirectory f) $ combineModes
- [ownerReadMode, ownerWriteMode, ownerExecuteMode]
- , File.ownerGroup (takeDirectory f) user (userGroup user)
- , File.ownerGroup f user (userGroup user)
- ]
- )
+ installonion f = withPrivData (PrivFile $ varLib </> hn </> f) context $ \getcontent ->
+ property' desc $ \w -> getcontent $ install w $ varLib </> hn </> f
+ install w f privcontent = ifM (liftIO $ doesFileExist f)
+ ( noChange
+ , ensureProperty w $ propertyList desc $ toProps
+ [ property desc $ makeChange $ do
+ createDirectoryIfMissing True (takeDirectory f)
+ writeFileProtected f (unlines (privDataLines privcontent))
+ , File.mode (takeDirectory f) $ combineModes
+ [ownerReadMode, ownerWriteMode, ownerExecuteMode]
+ , File.ownerGroup (takeDirectory f) user (userGroup user)
+ , File.ownerGroup f user (userGroup user)
+ ]
+ )
restarted :: Property DebianLike
restarted = Service.restarted "tor"