summaryrefslogtreecommitdiff
path: root/hosts/vidhar
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-02-17 15:33:51 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-02-17 15:33:51 +0100
commit82da13295e93983aaf2fe88766fa82243aa265aa (patch)
treebac83de3b701ae2967996555ca172fcdd3b17e11 /hosts/vidhar
parent93e1777707c03b3f4d7d42ee12d427222aa91191 (diff)
downloadnixos-82da13295e93983aaf2fe88766fa82243aa265aa.tar
nixos-82da13295e93983aaf2fe88766fa82243aa265aa.tar.gz
nixos-82da13295e93983aaf2fe88766fa82243aa265aa.tar.bz2
nixos-82da13295e93983aaf2fe88766fa82243aa265aa.tar.xz
nixos-82da13295e93983aaf2fe88766fa82243aa265aa.zip
vidhar: ...
Diffstat (limited to 'hosts/vidhar')
-rwxr-xr-xhosts/vidhar/borg/copy.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py
index 9ced3a57..66846394 100755
--- a/hosts/vidhar/borg/copy.py
+++ b/hosts/vidhar/borg/copy.py
@@ -96,19 +96,19 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
96 # print('unshare/chroot', file=stderr) 96 # print('unshare/chroot', file=stderr)
97 uid, gid = os.getuid(), os.getgid() 97 uid, gid = os.getuid(), os.getgid()
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 {uid} 1')
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 {gid} 1')
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: 108 # with open('/proc/self/uid_map', 'w') as uid_map:
109 uid_map.write(f'{uid} {uid} 1') 109 # uid_map.write(f'{uid} {uid} 1')
110 with open('/proc/self/gid_map', 'w') as gid_map: 110 # with open('/proc/self/gid_map', 'w') as gid_map:
111 gid_map.write(f'{gid} {gid} 1') 111 # gid_map.write(f'{gid} {gid} 1')
112 subprocess.run(['mount', '--make-rprivate', '/'], check=True) 112 subprocess.run(['mount', '--make-rprivate', '/'], check=True)
113 chroot = pathlib.Path(tmpdir) / 'chroot' 113 chroot = pathlib.Path(tmpdir) / 'chroot'
114 upper = pathlib.Path(tmpdir) / 'upper' 114 upper = pathlib.Path(tmpdir) / 'upper'