diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-17 19:27:03 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-17 19:27:03 +0100 |
commit | dde33b0ebd3ddd1645c8e80529afef129a8dca86 (patch) | |
tree | b5e8c06096f0571eee26f3f598987e12fe8316bd /hosts/vidhar/borg/copy.py | |
parent | 09460426f5d24e62afd4fdad0ba9c2588f012f97 (diff) | |
download | nixos-dde33b0ebd3ddd1645c8e80529afef129a8dca86.tar nixos-dde33b0ebd3ddd1645c8e80529afef129a8dca86.tar.gz nixos-dde33b0ebd3ddd1645c8e80529afef129a8dca86.tar.bz2 nixos-dde33b0ebd3ddd1645c8e80529afef129a8dca86.tar.xz nixos-dde33b0ebd3ddd1645c8e80529afef129a8dca86.zip |
vidhar: ...
Diffstat (limited to 'hosts/vidhar/borg/copy.py')
-rwxr-xr-x | hosts/vidhar/borg/copy.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py index 578394cc..a1c40c98 100755 --- a/hosts/vidhar/borg/copy.py +++ b/hosts/vidhar/borg/copy.py | |||
@@ -103,16 +103,16 @@ def copy_archive(src_repo_path, dst_repo_path, entry): | |||
103 | subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True) | 103 | subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True) |
104 | bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')] | 104 | bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')] |
105 | if os.environ.get('BORG_BASE_DIR'): | 105 | if os.environ.get('BORG_BASE_DIR'): |
106 | bindMounts.append(os.environ['BORG_BASE_DIR']) | 106 | bindMounts.append(os.environ['BORG_BASE_DIR'].relative_to('/')) |
107 | if os.environ.get('CREDENTIALS_DIRECTORY'): | 107 | if os.environ.get('CREDENTIALS_DIRECTORY'): |
108 | bindMounts.append(os.environ['CREDENTIALS_DIRECTORY']) | 108 | bindMounts.append(os.environ['CREDENTIALS_DIRECTORY'].relative_to('/')) |
109 | if not ":" in src_repo_path: | 109 | if not ":" in src_repo_path: |
110 | bindMounts.append(pathlib.Path(src_repo_path).relative_to('/')) | 110 | bindMounts.append(pathlib.Path(src_repo_path).relative_to('/')) |
111 | if 'SSH_AUTH_SOCK' in os.environ: | 111 | if 'SSH_AUTH_SOCK' in os.environ: |
112 | bindMounts.append(pathlib.Path(os.environ['SSH_AUTH_SOCK']).parent.relative_to('/')) | 112 | bindMounts.append(pathlib.Path(os.environ['SSH_AUTH_SOCK']).parent.relative_to('/')) |
113 | for bindMount in bindMounts: | 113 | for bindMount in bindMounts: |
114 | (chroot / bindMount).mkdir(parents=True,exist_ok=True) | 114 | (chroot / bindMount).mkdir(parents=True,exist_ok=True) |
115 | print(*['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], file=stderr) | 115 | # print(*['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], file=stderr) |
116 | subprocess.run(['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], check=True) | 116 | subprocess.run(['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], check=True) |
117 | os.chroot(chroot) | 117 | os.chroot(chroot) |
118 | os.chdir('/') | 118 | os.chdir('/') |