From 84824aae02d13862d908b6f55a547a5e9d6a8bb1 Mon Sep 17 00:00:00 2001 From: Martin Puppe Date: Fri, 5 Mar 2021 14:56:29 +0100 Subject: [PATCH] Replace config option cache-home with cache-dir --- mpbackup | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/mpbackup b/mpbackup index aba9d47..4e70eb0 100644 --- a/mpbackup +++ b/mpbackup @@ -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)