summaryrefslogtreecommitdiff
path: root/hosts/vidhar/borg/copy.py
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-02-17 16:56:51 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-02-17 16:56:51 +0100
commit364db19d143c2f9fc6d2f346afa9c6d9cf6f719d (patch)
tree3af47baf2851fd6c25b400b4c8a2bf22fdc166bd /hosts/vidhar/borg/copy.py
parent4d6e8a8290e79bfa8c24d4e477e03bbb00a3eacf (diff)
downloadnixos-364db19d143c2f9fc6d2f346afa9c6d9cf6f719d.tar
nixos-364db19d143c2f9fc6d2f346afa9c6d9cf6f719d.tar.gz
nixos-364db19d143c2f9fc6d2f346afa9c6d9cf6f719d.tar.bz2
nixos-364db19d143c2f9fc6d2f346afa9c6d9cf6f719d.tar.xz
nixos-364db19d143c2f9fc6d2f346afa9c6d9cf6f719d.zip
vidhar: ...
Diffstat (limited to 'hosts/vidhar/borg/copy.py')
-rwxr-xr-xhosts/vidhar/borg/copy.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py
index 8cfcbd56..de62dfa5 100755
--- a/hosts/vidhar/borg/copy.py
+++ b/hosts/vidhar/borg/copy.py
@@ -110,14 +110,15 @@ 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 upper = pathlib.Path(tmpdir) / 'upper' 113 chroot.mkdir()
114 work = pathlib.Path(tmpdir) / 'work' 114 # upper = pathlib.Path(tmpdir) / 'upper'
115 for path in [chroot,upper,work]: 115 # work = pathlib.Path(tmpdir) / 'work'
116 path.mkdir() 116 # for path in [chroot,upper,work]:
117 print(f'euid={os.getuid()}', file=stderr) 117 # path.mkdir()
118 subprocess.run(['stat', '/', upper, work, chroot], check=True) 118 # print(f'euid={os.getuid()}', file=stderr)
119 subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True) 119 # subprocess.run(['stat', '/', upper, work, chroot], check=True)
120 bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')] 120 # subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True)
121 bindMounts = ['etc', 'nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')]
121 if not ":" in src_repo_path: 122 if not ":" in src_repo_path:
122 bindMounts.append(pathlib.Path(src_repo_path).relative_to('/')) 123 bindMounts.append(pathlib.Path(src_repo_path).relative_to('/'))
123 if 'SSH_AUTH_SOCK' in os.environ: 124 if 'SSH_AUTH_SOCK' in os.environ: