From 8944cccd59a7d430d7416b20fc7a0952a65d6a39 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 17 Feb 2022 16:20:54 +0100 Subject: vidhar: ... --- hosts/vidhar/borg/copy.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'hosts/vidhar/borg/copy.py') diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py index 41b0ae74..b68fdf8d 100755 --- a/hosts/vidhar/borg/copy.py +++ b/hosts/vidhar/borg/copy.py @@ -105,19 +105,18 @@ def copy_archive(src_repo_path, dst_repo_path, entry): with open('/proc/self/setgroups', 'w') as setgroups: setgroups.write('deny') with open('/proc/self/uid_map', 'w') as uid_map: - uid_map.write(f'0 {uid} 1') + uid_map.write(f'{uid} {uid} 1') with open('/proc/self/gid_map', 'w') as gid_map: - gid_map.write(f'0 {gid} 1') + gid_map.write(f'{gid} {gid} 1') subprocess.run(['mount', '--make-rprivate', '/'], check=True) chroot = pathlib.Path(tmpdir) / 'chroot' - chroot2 = pathlib.Path(tmpdir) / 'chroot2' upper = pathlib.Path(tmpdir) / 'upper' work = pathlib.Path(tmpdir) / 'work' - for path in [chroot,chroot2,upper,work]: + for path in [chroot,upper,work]: path.mkdir() print(f'euid={os.getuid()}', file=stderr) subprocess.run(['stat', '/', upper, work, chroot], check=True) - subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir={chroot2},upperdir={upper},workdir={work}', chroot], check=True) + subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True) bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')] if not ":" in src_repo_path: bindMounts.append(pathlib.Path(src_repo_path).relative_to('/')) -- cgit v1.2.3