summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Restic.hs
diff options
context:
space:
mode:
authorFélix Sipma2017-05-09 17:21:31 +0200
committerFélix Sipma2017-05-09 17:27:20 +0200
commitf40e794bc51ebd58654376b8849a31a7bc2acff6 (patch)
treea89ee7592fb9b2f898bee90d296e90eae09fcde0 /src/Propellor/Property/Restic.hs
parent40e757c8f01e2e706dc54a5905f6be27159808c0 (diff)
Restic: backup' now takes a list of filepaths, export backup'
Diffstat (limited to 'src/Propellor/Property/Restic.hs')
-rw-r--r--src/Propellor/Property/Restic.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Propellor/Property/Restic.hs b/src/Propellor/Property/Restic.hs
index 64cd4091..d9d4d4be 100644
--- a/src/Propellor/Property/Restic.hs
+++ b/src/Propellor/Property/Restic.hs
@@ -9,6 +9,7 @@ module Propellor.Property.Restic
, init
, restored
, backup
+ , backup'
, KeepPolicy (..)
) where
@@ -138,17 +139,17 @@ restored dir repo = go
-- backup job will be run at a time. Other jobs will wait their turns to
-- run.
backup :: FilePath -> ResticRepo -> Cron.Times -> [ResticParam] -> [KeepPolicy] -> Property (HasInfo + DebianLike)
-backup dir repo crontimes extraargs kp = backup' dir repo crontimes extraargs kp
+backup dir repo crontimes extraargs kp = backup' [dir] repo crontimes extraargs kp
`requires` restored dir repo
-- | Does a backup, but does not automatically restore.
-backup' :: FilePath -> ResticRepo -> Cron.Times -> [ResticParam] -> [KeepPolicy] -> Property (HasInfo + DebianLike)
-backup' dir repo crontimes extraargs kp = cronjob
+backup' :: [FilePath] -> ResticRepo -> Cron.Times -> [ResticParam] -> [KeepPolicy] -> Property (HasInfo + DebianLike)
+backup' dirs repo crontimes extraargs kp = cronjob
`describe` desc
`requires` init repo
where
desc = val repo ++ " restic backup"
- cronjob = Cron.niceJob ("restic_backup" ++ dir) crontimes (User "root") "/" $
+ cronjob = Cron.niceJob ("restic_backup" ++ intercalate "_" dirs) crontimes (User "root") "/" $
"flock " ++ shellEscape lockfile ++ " sh -c " ++ shellEscape backupcmd
lockfile = "/var/lock/propellor-restic.lock"
backupcmd = intercalate " && " $
@@ -162,9 +163,8 @@ backup' dir repo crontimes extraargs kp = cronjob
, shellEscape (getPasswordFile repo)
]
++ map shellEscape extraargs ++
- [ "backup"
- , shellEscape dir
- ]
+ [ "backup" ]
+ ++ map shellEscape dirs
pruneCommand = unwords $
[ "restic"
, "-r"