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