mirror of
https://codeberg.org/puppe/mpbackup.git
synced 2025-12-19 21:42:17 +01:00
Add support for more restic flags
This commit is contained in:
parent
22e8c358c6
commit
0f3797eb32
1 changed files with 3 additions and 1 deletions
4
mpbackup
4
mpbackup
|
|
@ -62,9 +62,11 @@ end
|
||||||
def backup(config)
|
def backup(config)
|
||||||
puts "Backing up with restic …"
|
puts "Backing up with restic …"
|
||||||
# https://restic.readthedocs.io/en/latest/040_backup.html#including-and-excluding-files
|
# https://restic.readthedocs.io/en/latest/040_backup.html#including-and-excluding-files
|
||||||
|
flags = config['backup'].select{|k,v| k != 'exclude' && k != 'paths'}
|
||||||
|
flags = flags.map{|k,v| "--#{k}=#{v.to_s}"}
|
||||||
exclude = config.dig('backup', 'exclude')&.flat_map{|e| ['--exclude', e]} || []
|
exclude = config.dig('backup', 'exclude')&.flat_map{|e| ['--exclude', e]} || []
|
||||||
paths = config.dig('backup', 'paths') || []
|
paths = config.dig('backup', 'paths') || []
|
||||||
backup_command = ['restic', 'backup', *exclude, *paths]
|
backup_command = ['restic', 'backup', *exclude, *paths, *flags]
|
||||||
puts("Command: #{backup_command.join(' ')}")
|
puts("Command: #{backup_command.join(' ')}")
|
||||||
system(*backup_command)
|
system(*backup_command)
|
||||||
if $?.exitstatus > 0
|
if $?.exitstatus > 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue