From dc52f123745748ee61e894fe36eeca1788fc4ed8 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 12 Oct 2023 18:58:49 +0200 Subject: targets:TargetSSHLVM: add strip_mountpoint option --- lbup/targets.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lbup') diff --git a/lbup/targets.py b/lbup/targets.py index 55702ee..37a58f0 100644 --- a/lbup/targets.py +++ b/lbup/targets.py @@ -246,9 +246,13 @@ class TargetSSHLVM(TargetSSH): """ _mntns_pid = None + _strip_mountpoint = None + def __init__(self, name, dirs, excludes = None, logger = None, - remote = None, remote_bupdir = None, snapshot_size = '20G'): + remote = None, remote_bupdir = None, snapshot_size = '20G', + strip_mountpoint = False): self._snapshot_size = snapshot_size + self._strip_mountpoint = strip_mountpoint super().__init__(name, dirs, excludes, logger, remote, remote_bupdir) @@ -377,7 +381,7 @@ class TargetSSHLVM(TargetSSH): bup_exec = ['bup', 'on', '%s@%s' % (self._remote.username, self._remote.host), '-d', str(bupdir)] - save_opts = ['--graft=%s=%s' % (snapshot_mount, mountpoint)] + save_opts = ['--graft=%s=%s' % (snapshot_mount, '/' if self._strip_mountpoint else mountpoint)] index_opts = ['--no-check-device'] reparent = (mountpoint, AbsPath(snapshot_mount)) dirs = [str(d.reparent(*reparent)) for d in dirs] -- cgit v1.2.3