summaryrefslogtreecommitdiff
path: root/hosts/vidhar/borg/copy.py
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-02-17 16:16:46 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-02-17 16:16:46 +0100
commit32c87dc2a17e8d5c78a7ffae553be59d214a04fa (patch)
tree33fbcfae08222d2378b48fc28365a25dbbcedeec /hosts/vidhar/borg/copy.py
parente0038544b9d990900d423c002e75b9da80481d41 (diff)
downloadnixos-32c87dc2a17e8d5c78a7ffae553be59d214a04fa.tar
nixos-32c87dc2a17e8d5c78a7ffae553be59d214a04fa.tar.gz
nixos-32c87dc2a17e8d5c78a7ffae553be59d214a04fa.tar.bz2
nixos-32c87dc2a17e8d5c78a7ffae553be59d214a04fa.tar.xz
nixos-32c87dc2a17e8d5c78a7ffae553be59d214a04fa.zip
vidhar: ...
Diffstat (limited to 'hosts/vidhar/borg/copy.py')
-rwxr-xr-xhosts/vidhar/borg/copy.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py
index fb0414d5..41b0ae74 100755
--- a/hosts/vidhar/borg/copy.py
+++ b/hosts/vidhar/borg/copy.py
@@ -110,14 +110,14 @@ def copy_archive(src_repo_path, dst_repo_path, entry):
110 gid_map.write(f'0 {gid} 1') 110 gid_map.write(f'0 {gid} 1')
111 subprocess.run(['mount', '--make-rprivate', '/'], check=True) 111 subprocess.run(['mount', '--make-rprivate', '/'], check=True)
112 chroot = pathlib.Path(tmpdir) / 'chroot' 112 chroot = pathlib.Path(tmpdir) / 'chroot'
113 chroot2 = pathlib.Path(tmpdir) / 'chroot2'
113 upper = pathlib.Path(tmpdir) / 'upper' 114 upper = pathlib.Path(tmpdir) / 'upper'
114 work = pathlib.Path(tmpdir) / 'work' 115 work = pathlib.Path(tmpdir) / 'work'
115 for path in [chroot,upper,work]: 116 for path in [chroot,chroot2,upper,work]:
116 path.mkdir() 117 path.mkdir()
117 print(f'euid={os.getuid()}', file=stderr) 118 print(f'euid={os.getuid()}', file=stderr)
118 subprocess.run(['stat', '/', upper, work, chroot], check=True) 119 subprocess.run(['stat', '/', upper, work, chroot], check=True)
119 subprocess.run(['mount', '-t', 'tmpfs', 'tmpfs', chroot], check=True) 120 subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir={chroot2},upperdir={upper},workdir={work}', chroot], check=True)
120 subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True)
121 bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')] 121 bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')]
122 if not ":" in src_repo_path: 122 if not ":" in src_repo_path:
123 bindMounts.append(pathlib.Path(src_repo_path).relative_to('/')) 123 bindMounts.append(pathlib.Path(src_repo_path).relative_to('/'))