diff options
-rwxr-xr-x | hosts/vidhar/borg/copy.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py index fa698029..8eea7794 100755 --- a/hosts/vidhar/borg/copy.py +++ b/hosts/vidhar/borg/copy.py | |||
@@ -98,17 +98,13 @@ def copy_archive(src_repo_path, dst_repo_path, entry): | |||
98 | unshare.unshare(unshare.CLONE_NEWNS | unshare.CLONE_NEWUSER) | 98 | unshare.unshare(unshare.CLONE_NEWNS | unshare.CLONE_NEWUSER) |
99 | with open('/proc/self/setgroups', 'w') as setgroups: | 99 | with open('/proc/self/setgroups', 'w') as setgroups: |
100 | setgroups.write('deny') | 100 | setgroups.write('deny') |
101 | # with open('/proc/self/uid_map', 'w') as uid_map: | 101 | with open('/proc/self/uid_map', 'w') as uid_map: |
102 | # uid_map.write(f'0 {uid} 1') | 102 | uid_map.write(f'0 0 4294967295') |
103 | # with open('/proc/self/gid_map', 'w') as gid_map: | 103 | with open('/proc/self/gid_map', 'w') as gid_map: |
104 | # gid_map.write(f'0 {gid} 1') | 104 | gid_map.write(f'0 0 4294967295') |
105 | pyprctl.cap_permitted.sys_admin = True | 105 | pyprctl.cap_permitted.sys_admin = True |
106 | pyprctl.cap_inheritable.sys_admin = True | 106 | pyprctl.cap_inheritable.sys_admin = True |
107 | pyprctl.cap_ambient.sys_admin = True | 107 | pyprctl.cap_ambient.sys_admin = True |
108 | with open('/proc/self/uid_map', 'w') as uid_map: | ||
109 | uid_map.write(f'0 0 1\n{uid} {uid} 1') | ||
110 | with open('/proc/self/gid_map', 'w') as gid_map: | ||
111 | gid_map.write(f'0 0 1\n{gid} {gid} 1') | ||
112 | subprocess.run(['mount', '--make-rprivate', '/'], check=True) | 108 | subprocess.run(['mount', '--make-rprivate', '/'], check=True) |
113 | chroot = pathlib.Path(tmpdir) / 'chroot' | 109 | chroot = pathlib.Path(tmpdir) / 'chroot' |
114 | upper = pathlib.Path(tmpdir) / 'upper' | 110 | upper = pathlib.Path(tmpdir) / 'upper' |