mirror of https://github.com/borgbackup/borg.git
Merge pull request #702 from manwegit/feature/disable_remote_mkdirs
Remote end does not need cache nor keys directories, do not make them.
This commit is contained in:
commit
80cd1d6849
|
@ -17,7 +17,7 @@ import traceback
|
||||||
from . import __version__
|
from . import __version__
|
||||||
from .helpers import Error, location_validator, archivename_validator, format_line, format_time, format_file_size, \
|
from .helpers import Error, location_validator, archivename_validator, format_line, format_time, format_file_size, \
|
||||||
parse_pattern, PathPrefixPattern, to_localtime, timestamp, safe_timestamp, \
|
parse_pattern, PathPrefixPattern, to_localtime, timestamp, safe_timestamp, \
|
||||||
get_cache_dir, get_keys_dir, prune_within, prune_split, \
|
get_cache_dir, prune_within, prune_split, \
|
||||||
Manifest, remove_surrogates, update_excludes, format_archive, check_extension_modules, Statistics, \
|
Manifest, remove_surrogates, update_excludes, format_archive, check_extension_modules, Statistics, \
|
||||||
dir_is_tagged, bigint_to_int, ChunkerParams, CompressionSpec, is_slow_msgpack, yes, sysinfo, \
|
dir_is_tagged, bigint_to_int, ChunkerParams, CompressionSpec, is_slow_msgpack, yes, sysinfo, \
|
||||||
EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR, log_multi, PatternMatcher
|
EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR, log_multi, PatternMatcher
|
||||||
|
@ -1415,21 +1415,6 @@ class Archiver:
|
||||||
self.lock_wait = args.lock_wait
|
self.lock_wait = args.lock_wait
|
||||||
setup_logging(level=args.log_level, is_serve=args.func == self.do_serve) # do not use loggers before this!
|
setup_logging(level=args.log_level, is_serve=args.func == self.do_serve) # do not use loggers before this!
|
||||||
check_extension_modules()
|
check_extension_modules()
|
||||||
keys_dir = get_keys_dir()
|
|
||||||
if not os.path.exists(keys_dir):
|
|
||||||
os.makedirs(keys_dir)
|
|
||||||
os.chmod(keys_dir, stat.S_IRWXU)
|
|
||||||
cache_dir = get_cache_dir()
|
|
||||||
if not os.path.exists(cache_dir):
|
|
||||||
os.makedirs(cache_dir)
|
|
||||||
os.chmod(cache_dir, stat.S_IRWXU)
|
|
||||||
with open(os.path.join(cache_dir, 'CACHEDIR.TAG'), 'w') as fd:
|
|
||||||
fd.write(textwrap.dedent("""
|
|
||||||
Signature: 8a477f597d28d172789f06886806bc55
|
|
||||||
# This file is a cache directory tag created by Borg.
|
|
||||||
# For information about cache directory tags, see:
|
|
||||||
# http://www.brynosaurus.com/cachedir/
|
|
||||||
""").lstrip())
|
|
||||||
if is_slow_msgpack():
|
if is_slow_msgpack():
|
||||||
logger.warning("Using a pure-python msgpack! This will result in lower performance.")
|
logger.warning("Using a pure-python msgpack! This will result in lower performance.")
|
||||||
return args.func(args)
|
return args.func(args)
|
||||||
|
|
|
@ -3,6 +3,8 @@ from collections import namedtuple
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
import grp
|
import grp
|
||||||
import os
|
import os
|
||||||
|
import stat
|
||||||
|
import textwrap
|
||||||
import pwd
|
import pwd
|
||||||
import re
|
import re
|
||||||
from shutil import get_terminal_size
|
from shutil import get_terminal_size
|
||||||
|
@ -211,13 +213,28 @@ class Statistics:
|
||||||
def get_keys_dir():
|
def get_keys_dir():
|
||||||
"""Determine where to repository keys and cache"""
|
"""Determine where to repository keys and cache"""
|
||||||
xdg_config = os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config'))
|
xdg_config = os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config'))
|
||||||
return os.environ.get('BORG_KEYS_DIR', os.path.join(xdg_config, 'borg', 'keys'))
|
keys_dir = os.environ.get('BORG_KEYS_DIR', os.path.join(xdg_config, 'borg', 'keys'))
|
||||||
|
if not os.path.exists(keys_dir):
|
||||||
|
os.makedirs(keys_dir)
|
||||||
|
os.chmod(keys_dir, stat.S_IRWXU)
|
||||||
|
return keys_dir
|
||||||
|
|
||||||
|
|
||||||
def get_cache_dir():
|
def get_cache_dir():
|
||||||
"""Determine where to repository keys and cache"""
|
"""Determine where to repository keys and cache"""
|
||||||
xdg_cache = os.environ.get('XDG_CACHE_HOME', os.path.join(os.path.expanduser('~'), '.cache'))
|
xdg_cache = os.environ.get('XDG_CACHE_HOME', os.path.join(os.path.expanduser('~'), '.cache'))
|
||||||
return os.environ.get('BORG_CACHE_DIR', os.path.join(xdg_cache, 'borg'))
|
cache_dir = os.environ.get('BORG_CACHE_DIR', os.path.join(xdg_cache, 'borg'))
|
||||||
|
if not os.path.exists(cache_dir):
|
||||||
|
os.makedirs(cache_dir)
|
||||||
|
os.chmod(cache_dir, stat.S_IRWXU)
|
||||||
|
with open(os.path.join(cache_dir, 'CACHEDIR.TAG'), 'w') as fd:
|
||||||
|
fd.write(textwrap.dedent("""
|
||||||
|
Signature: 8a477f597d28d172789f06886806bc55
|
||||||
|
# This file is a cache directory tag created by Borg.
|
||||||
|
# For information about cache directory tags, see:
|
||||||
|
# http://www.brynosaurus.com/cachedir/
|
||||||
|
""").lstrip())
|
||||||
|
return cache_dir
|
||||||
|
|
||||||
|
|
||||||
def to_localtime(ts):
|
def to_localtime(ts):
|
||||||
|
|
Loading…
Reference in New Issue