propellor spin

This commit is contained in:
Joey Hess 2014-04-10 03:06:35 -04:00
parent eb71c76711
commit 7a0074454b
Failed to extract signature
4 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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")

View File

@ -4,6 +4,7 @@ import Data.Monoid
import System.Console.ANSI
type HostName = String
type GroupName = String
type UserName = String
data Property = Property

View File

@ -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