diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-17 13:48:54 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-17 13:48:54 +0100 |
commit | 6de0d6eebc80070c761ea24bf5ef2c0d5f8fcaa2 (patch) | |
tree | f6b11cd13e1669361fd71271593b58111fa9ba1b /hosts/vidhar/borg | |
parent | a6589c75e19a1882a5d7e87e14200ce921c10da2 (diff) | |
download | nixos-6de0d6eebc80070c761ea24bf5ef2c0d5f8fcaa2.tar nixos-6de0d6eebc80070c761ea24bf5ef2c0d5f8fcaa2.tar.gz nixos-6de0d6eebc80070c761ea24bf5ef2c0d5f8fcaa2.tar.bz2 nixos-6de0d6eebc80070c761ea24bf5ef2c0d5f8fcaa2.tar.xz nixos-6de0d6eebc80070c761ea24bf5ef2c0d5f8fcaa2.zip |
vidhar: ...
Diffstat (limited to 'hosts/vidhar/borg')
-rwxr-xr-x | hosts/vidhar/borg/copy.py | 4 | ||||
-rw-r--r-- | hosts/vidhar/borg/default.nix | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py index 38502a28..0d0104ff 100755 --- a/hosts/vidhar/borg/copy.py +++ b/hosts/vidhar/borg/copy.py | |||
@@ -81,7 +81,7 @@ def copy_archive(src_repo_path, dst_repo_path, entry): | |||
81 | sp.succeed(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})') | 81 | sp.succeed(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})') |
82 | else: | 82 | else: |
83 | print(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})', file=stderr) | 83 | print(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})', file=stderr) |
84 | with TemporaryDirectory(prefix=f'borg-mount_{entry["name"]}_') as tmpdir: | 84 | with TemporaryDirectory(prefix=f'borg-mount_{entry["name"]}_', dir=os.environ.get('RUNTIME_DIRECTORY')) as tmpdir: |
85 | child = os.fork() | 85 | child = os.fork() |
86 | if child == 0: | 86 | if child == 0: |
87 | # print('unshare/chroot', file=stderr) | 87 | # print('unshare/chroot', file=stderr) |
@@ -100,6 +100,8 @@ def copy_archive(src_repo_path, dst_repo_path, entry): | |||
100 | work = pathlib.Path(tmpdir) / 'work' | 100 | work = pathlib.Path(tmpdir) / 'work' |
101 | for path in [chroot,upper,work]: | 101 | for path in [chroot,upper,work]: |
102 | path.mkdir() | 102 | path.mkdir() |
103 | print(f'euid={os.getuid()}', file=stderr) | ||
104 | subprocess.run(['stat', '/', upper, work, chroot], check=True) | ||
103 | subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True) | 105 | 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('/')] | 106 | bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')] |
105 | if not ":" in src_repo_path: | 107 | if not ":" in src_repo_path: |
diff --git a/hosts/vidhar/borg/default.nix b/hosts/vidhar/borg/default.nix index cdb94e26..170ef65d 100644 --- a/hosts/vidhar/borg/default.nix +++ b/hosts/vidhar/borg/default.nix | |||
@@ -25,6 +25,7 @@ let | |||
25 | User = "borg"; | 25 | User = "borg"; |
26 | Group = "borg"; | 26 | Group = "borg"; |
27 | StateDirectory = "borg"; | 27 | StateDirectory = "borg"; |
28 | RuntimeDirectory = "copy-borg"; | ||
28 | Environment = [ | 29 | Environment = [ |
29 | "BORG_RSH=\"${pkgs.openssh}/bin/ssh -F ${sshConfig}\"" | 30 | "BORG_RSH=\"${pkgs.openssh}/bin/ssh -F ${sshConfig}\"" |
30 | "BORG_BASE_DIR=/var/lib/borg" | 31 | "BORG_BASE_DIR=/var/lib/borg" |