diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-18 13:05:20 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-18 13:05:20 +0100 |
commit | c91403c61c287c7d1250b3308d0e6690d39e60d2 (patch) | |
tree | 9a9e155e3c9abf17aaacc1a1eaf3fde20ec5e32e | |
parent | 53bb5d4d17e2a1563900c63b31213395543e0e55 (diff) | |
download | nixos-c91403c61c287c7d1250b3308d0e6690d39e60d2.tar nixos-c91403c61c287c7d1250b3308d0e6690d39e60d2.tar.gz nixos-c91403c61c287c7d1250b3308d0e6690d39e60d2.tar.bz2 nixos-c91403c61c287c7d1250b3308d0e6690d39e60d2.tar.xz nixos-c91403c61c287c7d1250b3308d0e6690d39e60d2.zip |
vidhar: ...
-rwxr-xr-x | hosts/vidhar/borg/copy.py | 5 |
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) |