summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Propellor/Property/File.hs10
-rw-r--r--Propellor/Property/Git.hs3
-rw-r--r--Propellor/Types.hs1
-rw-r--r--config-joey.hs1
4 files changed, 14 insertions, 1 deletions
diff --git a/Propellor/Property/File.hs b/Propellor/Property/File.hs
index 0c1155fe..64dce66f 100644
--- a/Propellor/Property/File.hs
+++ b/Propellor/Property/File.hs
@@ -58,3 +58,13 @@ fileProperty desc a f = Property desc $ go =<< doesFileExist f
dirExists :: FilePath -> Property
dirExists d = check (not <$> doesDirectoryExist d) $ Property (d ++ " exists") $
makeChange $ createDirectoryIfMissing True d
+
+-- | Ensures that a file/dir has the specified owner and group.
+ownerGroup :: FilePath -> UserName -> GroupName -> Property
+ownerGroup f owner group = Property (f ++ " owner " ++ og) $ do
+ r <- ensureProperty $ cmdProperty "chown" [og, f]
+ if r == FailedChange
+ then return r
+ else noChange
+ where
+ og = owner ++ ":" ++ group
diff --git a/Propellor/Property/Git.hs b/Propellor/Property/Git.hs
index 356ff87a..c0494160 100644
--- a/Propellor/Property/Git.hs
+++ b/Propellor/Property/Git.hs
@@ -22,7 +22,8 @@ daemonRunning exportdir = RevertableProperty setup unsetup
`requires`
Apt.serviceInstalledRunning "openbsd-inetd"
`onChange`
- Service.reloaded "openbsd-inetd"
+ Service.running "openbsd-inetd"
+ `describe` ("git-daemon exporting " ++ exportdir)
unsetup = lacksLine conf (mkl "tcp4")
`requires`
lacksLine conf (mkl "tcp6")
diff --git a/Propellor/Types.hs b/Propellor/Types.hs
index c6be30c4..3be10d3f 100644
--- a/Propellor/Types.hs
+++ b/Propellor/Types.hs
@@ -4,6 +4,7 @@ import Data.Monoid
import System.Console.ANSI
type HostName = String
+type GroupName = String
type UserName = String
data Property = Property
diff --git a/config-joey.hs b/config-joey.hs
index b4aeebe6..d07e12b5 100644
--- a/config-joey.hs
+++ b/config-joey.hs
@@ -67,6 +67,7 @@ host hostname@"diatom.kitenet.net" = Just $ props
& Apt.installed ["git", "git-annex", "rsync"]
& Apt.buildDep ["git-annex"] `period` Daily
& Git.daemonRunning "/srv/git"
+ & File.ownerGroup "/srv/git" "joey" "joey"
-- git repos restore (how?)
-- kgb installation and setup
-- ssh keys for branchable and github repo hooks