summaryrefslogtreecommitdiff
path: root/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-04-08 01:42:59 -0400
committerJoey Hess2014-04-08 01:42:59 -0400
commitd8a241322e16cc55881781f06a12005395010d3e (patch)
treed4a64fa6a8fcbc2ec0af9737a19a008483e4a188 /Propellor/Property
parentc62c606c0e459fe19f258bcf5ba80958349f3e1e (diff)
propellor spin
Diffstat (limited to 'Propellor/Property')
-rw-r--r--Propellor/Property/SiteSpecific/GitAnnexBuilder.hs33
1 files changed, 15 insertions, 18 deletions
diff --git a/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
index f4e13149..149c8e6c 100644
--- a/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
+++ b/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
@@ -9,8 +9,14 @@ import Propellor.Property.Cron (CronTimes)
builduser :: UserName
builduser = "builder"
+homedir :: FilePath
+homedir = "/home/builder"
+
+gitbuilderdir :: FilePath
+gitbuilderdir = homedir </> "gitbuilder"
+
builddir :: FilePath
-builddir = "gitbuilder"
+builddir = gitbuilderdir </> "build"
builder :: Architecture -> CronTimes -> Bool -> Property
builder arch crontimes rsyncupload = combineProperties "gitannexbuilder"
@@ -20,26 +26,22 @@ builder arch crontimes rsyncupload = combineProperties "gitannexbuilder"
"liblockfile-simple-perl", "cabal-install", "vim", "less"]
, serviceRunning "cron" `requires` Apt.installed ["cron"]
, User.accountFor builduser
- , check (lacksdir builddir) $ userScriptProperty builduser
- [ "git clone git://git.kitenet.net/gitannexbuilder " ++ builddir
- , "cd " ++ builddir
+ , check (not <$> doesDirectoryExist gitbuilderdir) $ userScriptProperty builduser
+ [ "git clone git://git.kitenet.net/gitannexbuilder " ++ gitbuilderdir
+ , "cd " ++ gitbuilderdir
, "git checkout " ++ arch
]
`describe` "gitbuilder setup"
- , check (lacksdir $ builddir </> "build") $ userScriptProperty builduser
- [ "cd " ++ builddir
- , "git clone git://git-annex.branchable.com/ build"
+ , check (not <$> doesDirectoryExist builddir) $ userScriptProperty builduser
+ [ "git clone git://git-annex.branchable.com/ " ++ builddir
]
- , Property "git-annex source build deps installed" $ do
- d <- homedir
- ensureProperty $ Apt.buildDepIn (d </> builddir </> "build")
- , Cron.niceJob "gitannexbuilder" crontimes builduser ("~/" ++ builddir) "git pull ; ./autobuild"
+ , "git-annex source build deps installed" ==> Apt.buildDepIn builddir
+ , Cron.niceJob "gitannexbuilder" crontimes builduser gitbuilderdir "git pull ; ./autobuild"
-- The builduser account does not have a password set,
-- instead use the password privdata to hold the rsync server
-- password used to upload the built image.
, Property "rsync password" $ do
- d <- homedir
- let f = d </> "rsyncpassword"
+ let f = homedir </> "rsyncpassword"
if rsyncupload
then withPrivData (Password builduser) $ \p -> do
oldp <- catchDefaultIO "" $ readFileStrict f
@@ -52,8 +54,3 @@ builder arch crontimes rsyncupload = combineProperties "gitannexbuilder"
, makeChange $ writeFile f "no password configured"
)
]
- where
- homedir = fromMaybe ("/home/" ++ builduser) <$> User.homedir builduser
- lacksdir d = do
- h <- homedir
- not <$> doesDirectoryExist (h </> d)