summaryrefslogtreecommitdiff
path: root/hosts/vidhar/borg/copy.py
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/vidhar/borg/copy.py')
-rwxr-xr-xhosts/vidhar/borg/copy.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py
index 38502a28..0d0104ff 100755
--- a/hosts/vidhar/borg/copy.py
+++ b/hosts/vidhar/borg/copy.py
@@ -81,7 +81,7 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
81 sp.succeed(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})') 81 sp.succeed(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})')
82 else: 82 else:
83 print(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})', file=stderr) 83 print(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})', file=stderr)
84 with TemporaryDirectory(prefix=f'borg-mount_{entry["name"]}_') as tmpdir: 84 with TemporaryDirectory(prefix=f'borg-mount_{entry["name"]}_', dir=os.environ.get('RUNTIME_DIRECTORY')) as tmpdir:
85 child = os.fork() 85 child = os.fork()
86 if child == 0: 86 if child == 0:
87 # print('unshare/chroot', file=stderr) 87 # print('unshare/chroot', file=stderr)
@@ -100,6 +100,8 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
100 work = pathlib.Path(tmpdir) / 'work' 100 work = pathlib.Path(tmpdir) / 'work'
101 for path in [chroot,upper,work]: 101 for path in [chroot,upper,work]:
102 path.mkdir() 102 path.mkdir()
103 print(f'euid={os.getuid()}', file=stderr)
104 subprocess.run(['stat', '/', upper, work, chroot], check=True)
103 subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True) 105 subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True)
104 bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')] 106 bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')]
105 if not ":" in src_repo_path: 107 if not ":" in src_repo_path: