generalized git-annex autobuilder to not need a rsync password
This commit is contained in:
parent
b456e8aedc
commit
cd10ceb976
|
@ -12,8 +12,8 @@ builduser = "builder"
|
||||||
builddir :: FilePath
|
builddir :: FilePath
|
||||||
builddir = "gitbuilder"
|
builddir = "gitbuilder"
|
||||||
|
|
||||||
builder :: Architecture -> CronTimes -> Property
|
builder :: Architecture -> CronTimes -> Bool -> Property
|
||||||
builder arch crontimes = combineProperties "gitannexbuilder"
|
builder arch crontimes rsyncupload = combineProperties "gitannexbuilder"
|
||||||
[ Apt.stdSourcesList Unstable
|
[ Apt.stdSourcesList Unstable
|
||||||
, Apt.buildDep ["git-annex"]
|
, Apt.buildDep ["git-annex"]
|
||||||
, Apt.installed ["git", "rsync", "moreutils", "ca-certificates",
|
, Apt.installed ["git", "rsync", "moreutils", "ca-certificates",
|
||||||
|
@ -38,11 +38,17 @@ builder arch crontimes = combineProperties "gitannexbuilder"
|
||||||
, Property "rsync password" $ do
|
, Property "rsync password" $ do
|
||||||
d <- homedir
|
d <- homedir
|
||||||
let f = d </> "rsyncpassword"
|
let f = d </> "rsyncpassword"
|
||||||
withPrivData (Password builduser) $ \p -> do
|
if rsyncupload
|
||||||
|
then withPrivData (Password builduser) $ \p -> do
|
||||||
oldp <- catchDefaultIO "" $ readFileStrict f
|
oldp <- catchDefaultIO "" $ readFileStrict f
|
||||||
if p /= oldp
|
if p /= oldp
|
||||||
then makeChange $ writeFile f p
|
then makeChange $ writeFile f p
|
||||||
else noChange
|
else noChange
|
||||||
|
else do
|
||||||
|
ifM (doesFileExist f)
|
||||||
|
( noChange
|
||||||
|
, makeChange $ writeFile f "no password configured"
|
||||||
|
)
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
homedir = fromMaybe ("/home/" ++ builduser) <$> User.homedir builduser
|
homedir = fromMaybe ("/home/" ++ builduser) <$> User.homedir builduser
|
||||||
|
|
|
@ -76,7 +76,7 @@ container _host name
|
||||||
let arch = takeWhile (/= '-') name
|
let arch = takeWhile (/= '-') name
|
||||||
in Just $ Docker.containerFrom
|
in Just $ Docker.containerFrom
|
||||||
(image $ System (Debian Unstable) arch)
|
(image $ System (Debian Unstable) arch)
|
||||||
[ Docker.inside $ props & GitAnnexBuilder.builder arch "15 * * * *" ]
|
[ Docker.inside $ props & GitAnnexBuilder.builder arch "15 * * * *" True ]
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
|
|
||||||
-- | Docker images I prefer to use.
|
-- | Docker images I prefer to use.
|
||||||
|
|
Loading…
Reference in New Issue