Replace config option cache-home with cache-dir

This commit is contained in:
Martin Puppe 2021-03-05 14:56:29 +01:00
parent 0d98802d8a
commit 84824aae02

View file

@ -8,8 +8,6 @@ DEFAULT_CONFIG_FILE = Pathname.new('/etc/mpbackup/config.yaml')
NAME = 'mpbackup'
VERSION = '0.5.0'
$original_cache_home = ENV['XDG_CACHE_HOME']
def set_restic_vars(config)
if config['repository-file']
puts "Reading repository from file #{config['repository-file']} …"
@ -25,9 +23,9 @@ def set_restic_vars(config)
else
password = STDIN.getpass('Please put in your restic password: ')
end
if config['cache-home']
puts "Setting XDG_CACHE_HOME to #{config['cache-home']} …"
ENV['XDG_CACHE_HOME'] = config['cache-home']
if config['cache-dir']
puts "Setting RESTIC_CACHE_DIR to #{config['cache-dir']} …"
ENV['RESTIC_CACHE_DIR'] = config['cache-dir']
end
ENV['RESTIC_REPOSITORY'] = repo
@ -37,11 +35,7 @@ end
def unset_restic_vars
ENV.delete('RESTIC_REPOSITORY')
ENV.delete('RESTIC_PASSWORD')
if $original_cache_home
ENV['XDG_CACHE_HOME'] = $original_cache_home
else
ENV.delete('XDG_CACHE_HOME')
end
ENV.delete('RESTIC_CACHE_DIR')
end
def error(exit_status, message)