summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Restic.hs
diff options
context:
space:
mode:
authorFélix Sipma2017-04-28 00:19:46 +0200
committerFélix Sipma2017-04-28 00:19:46 +0200
commitb06edbda0478ed57954d716f64f6870d7ae68f63 (patch)
tree11b3864e450c137be2b0416af29e71d162065eaf /src/Propellor/Property/Restic.hs
parentf6b2ab29f24c7399ed7ab718c541eb46bc0f24f7 (diff)
Restic: fix bug in shell escaping
Diffstat (limited to 'src/Propellor/Property/Restic.hs')
-rw-r--r--src/Propellor/Property/Restic.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Propellor/Property/Restic.hs b/src/Propellor/Property/Restic.hs
index 668843bb..02b2ead0 100644
--- a/src/Propellor/Property/Restic.hs
+++ b/src/Propellor/Property/Restic.hs
@@ -149,17 +149,17 @@ backup' dir repo crontimes extraargs kp = cronjob
where
desc = val repo ++ " restic backup"
cronjob = Cron.niceJob ("restic_backup" ++ dir) crontimes (User "root") "/" $
- "flock " ++ shellEscape lockfile ++ " sh -c " ++ backupcmd
+ "flock " ++ shellEscape lockfile ++ " sh -c " ++ shellEscape backupcmd
lockfile = "/var/lock/propellor-restic.lock"
- backupcmd = intercalate ";" $
+ backupcmd = intercalate " && " $
createCommand
: if null kp then [] else [pruneCommand]
createCommand = unwords $
[ "restic"
, "-r"
- , val repo
+ , shellEscape (val repo)
, "--password-file"
- , getPasswordFile repo
+ , shellEscape (getPasswordFile repo)
]
++ map shellEscape extraargs ++
[ "backup"
@@ -168,9 +168,9 @@ backup' dir repo crontimes extraargs kp = cronjob
pruneCommand = unwords $
[ "restic"
, "-r"
- , val repo
+ , shellEscape (val repo)
, "--password-file"
- , getPasswordFile repo
+ , shellEscape (getPasswordFile repo)
, "forget"
, "--prune"
]