mirror of
https://codeberg.org/puppe/mpbackup.git
synced 2025-12-20 05:52:18 +01:00
Add config option for cache home directory
This commit is contained in:
parent
43fff22a2a
commit
e4ddf36695
1 changed files with 11 additions and 0 deletions
11
mpbackup
11
mpbackup
|
|
@ -8,6 +8,8 @@ DEFAULT_CONFIG_FILE = Pathname.new('/etc/mpbackup/config.yaml')
|
||||||
NAME = 'mpbackup'
|
NAME = 'mpbackup'
|
||||||
VERSION = '0.4.0'
|
VERSION = '0.4.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']} …"
|
||||||
|
|
@ -23,6 +25,10 @@ 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']
|
||||||
|
puts "Setting XDG_CACHE_HOME to #{config['cache-home']} …"
|
||||||
|
ENV['XDG_CACHE_HOME'] = config['cache-home']
|
||||||
|
end
|
||||||
|
|
||||||
ENV['RESTIC_REPOSITORY'] = repo
|
ENV['RESTIC_REPOSITORY'] = repo
|
||||||
ENV['RESTIC_PASSWORD'] = password
|
ENV['RESTIC_PASSWORD'] = password
|
||||||
|
|
@ -31,6 +37,11 @@ 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['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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue