diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-02-07 13:01:43 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-02-07 13:01:43 -0400 |
| commit | a4ce5d7aff72e874eda19a7ff9f1f59e91931457 (patch) | |
| tree | 1c1cd126c041eb4660a6952feb5cdb964d7ff9bd /src | |
| parent | 5901b4ede5abc75aa17762d86aff80eb2de4960b (diff) | |
force-lock fails when repo doesn't exist, so don't && it
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Obnam.hs | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/Propellor/Property/Obnam.hs b/src/Propellor/Property/Obnam.hs index 684c424e..9a391967 100644 --- a/src/Propellor/Property/Obnam.hs +++ b/src/Propellor/Property/Obnam.hs @@ -59,25 +59,29 @@ backup' dir crontimes params numclients = cronjob `describe` desc where desc = dir ++ " backed up by obnam" cronjob = Cron.niceJob ("obnam_backup" ++ dir) crontimes (User "root") "/" $ - intercalate "&&" $ catMaybes + unwords $ catMaybes [ if numclients == OnlyClient - then Just $ unwords $ - [ "obnam" - , "force-lock" - ] ++ map shellEscape params + -- forcelock fails if repo does not exist yet + then Just $ forcelock ++ " 2>/dev/null ;" else Nothing - , Just $ unwords $ - [ "obnam" - , "backup" - , shellEscape dir - ] ++ map shellEscape params + , Just backup , if any isKeepParam params - then Just $ unwords $ - [ "obnam" - , "forget" - ] ++ map shellEscape params + then Just $ "&& " ++ forget else Nothing ] + forcelock = unwords $ + [ "obnam" + , "force-lock" + ] ++ map shellEscape params + backup = unwords $ + [ "obnam" + , "backup" + , shellEscape dir + ] ++ map shellEscape params + forget = unwords $ + [ "obnam" + , "forget" + ] ++ map shellEscape params -- | Restores a directory from an obnam backup. -- |
