mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 17:27:31 +00:00
Added new option "--do-not-cross-mountpoints"
This commit is contained in:
parent
b755a4f2b9
commit
c4e022a7fc
1 changed files with 17 additions and 3 deletions
|
@ -88,7 +88,15 @@ def do_create(self, args):
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
for path in args.paths:
|
for path in args.paths:
|
||||||
self._process(archive, cache, args.patterns, skip_inodes, path)
|
if args.dontcross:
|
||||||
|
try:
|
||||||
|
restrict_dev = os.lstat(path).st_dev
|
||||||
|
except OSError, e:
|
||||||
|
self.print_error('%s: %s', path, e)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
restrict_dev = None
|
||||||
|
self._process(archive, cache, args.patterns, skip_inodes, path, restrict_dev)
|
||||||
archive.save()
|
archive.save()
|
||||||
if args.stats:
|
if args.stats:
|
||||||
t = datetime.now()
|
t = datetime.now()
|
||||||
|
@ -103,7 +111,7 @@ def do_create(self, args):
|
||||||
print '-' * 40
|
print '-' * 40
|
||||||
return self.exit_code
|
return self.exit_code
|
||||||
|
|
||||||
def _process(self, archive, cache, patterns, skip_inodes, path):
|
def _process(self, archive, cache, patterns, skip_inodes, path, restrict_dev):
|
||||||
if exclude_path(path, patterns):
|
if exclude_path(path, patterns):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
@ -113,6 +121,9 @@ def _process(self, archive, cache, patterns, skip_inodes, path):
|
||||||
return
|
return
|
||||||
if (st.st_ino, st.st_dev) in skip_inodes:
|
if (st.st_ino, st.st_dev) in skip_inodes:
|
||||||
return
|
return
|
||||||
|
# Entering a new filesystem?
|
||||||
|
if restrict_dev and st.st_dev != restrict_dev:
|
||||||
|
return
|
||||||
# Ignore unix sockets
|
# Ignore unix sockets
|
||||||
if stat.S_ISSOCK(st.st_mode):
|
if stat.S_ISSOCK(st.st_mode):
|
||||||
return
|
return
|
||||||
|
@ -126,7 +137,7 @@ def _process(self, archive, cache, patterns, skip_inodes, path):
|
||||||
else:
|
else:
|
||||||
for filename in sorted(entries):
|
for filename in sorted(entries):
|
||||||
self._process(archive, cache, patterns, skip_inodes,
|
self._process(archive, cache, patterns, skip_inodes,
|
||||||
os.path.join(path, filename))
|
os.path.join(path, filename), restrict_dev)
|
||||||
elif stat.S_ISLNK(st.st_mode):
|
elif stat.S_ISLNK(st.st_mode):
|
||||||
archive.process_symlink(path, st)
|
archive.process_symlink(path, st)
|
||||||
elif stat.S_ISFIFO(st.st_mode):
|
elif stat.S_ISFIFO(st.st_mode):
|
||||||
|
@ -333,6 +344,9 @@ def run(self, args=None):
|
||||||
subparser.add_argument('-c', '--checkpoint-interval', dest='checkpoint_interval',
|
subparser.add_argument('-c', '--checkpoint-interval', dest='checkpoint_interval',
|
||||||
type=int, default=300, metavar='SECONDS',
|
type=int, default=300, metavar='SECONDS',
|
||||||
help='Write checkpointe ever SECONDS seconds (Default: 300)')
|
help='Write checkpointe ever SECONDS seconds (Default: 300)')
|
||||||
|
subparser.add_argument('--do-not-cross-mountpoints', dest='dontcross',
|
||||||
|
action='store_true', default=False,
|
||||||
|
help='Do not cross mount points')
|
||||||
subparser.add_argument('archive', metavar='ARCHIVE',
|
subparser.add_argument('archive', metavar='ARCHIVE',
|
||||||
type=location_validator(archive=True),
|
type=location_validator(archive=True),
|
||||||
help='Archive to create')
|
help='Archive to create')
|
||||||
|
|
Loading…
Reference in a new issue