summaryrefslogtreecommitdiff
path: root/hosts/vidhar
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/vidhar')
-rwxr-xr-xhosts/vidhar/borg/copy.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py
index d8d19a86..f6d100be 100755
--- a/hosts/vidhar/borg/copy.py
+++ b/hosts/vidhar/borg/copy.py
@@ -131,14 +131,15 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
131 (chroot / bindMount).mkdir(parents=True,exist_ok=True) 131 (chroot / bindMount).mkdir(parents=True,exist_ok=True)
132 # print(*['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], file=stderr) 132 # print(*['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], file=stderr)
133 subprocess.run(['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], check=True) 133 subprocess.run(['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], check=True)
134 os.chroot(chroot)
135 os.chdir('/')
134 try: 136 try:
135 os.unlink('/etc/fuse.conf') 137 os.unlink('/etc/fuse.conf')
136 except FileNotFoundError: 138 except FileNotFoundError:
137 pass 139 pass
140 pathlib.Path('/etc/fuse.conf').parent.mkdir(parents=True,exist_ok=True)
138 with open('/etc/fuse.conf', 'w') as fuse_conf: 141 with open('/etc/fuse.conf', 'w') as fuse_conf:
139 fuse_conf.write('user_allow_other\nmount_max = 1000\n') 142 fuse_conf.write('user_allow_other\nmount_max = 1000\n')
140 os.chroot(chroot)
141 os.chdir('/')
142 dir = pathlib.Path('/borg') 143 dir = pathlib.Path('/borg')
143 dir.mkdir(parents=True,exist_ok=True,mode=0o0750) 144 dir.mkdir(parents=True,exist_ok=True,mode=0o0750)
144 os.chown(dir, borg_pwd.pw_uid, borg_pwd.pw_gid) 145 os.chown(dir, borg_pwd.pw_uid, borg_pwd.pw_gid)