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