From 6de0d6eebc80070c761ea24bf5ef2c0d5f8fcaa2 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 17 Feb 2022 13:48:54 +0100 Subject: vidhar: ... --- hosts/vidhar/borg/copy.py | 4 +++- hosts/vidhar/borg/default.nix | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'hosts') 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): sp.succeed(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})') else: print(f'Will process {entry["name"]} ({dateutil.parser.isoparse(entry["start"])}, cache_suffix={cache_suffix})', file=stderr) - with TemporaryDirectory(prefix=f'borg-mount_{entry["name"]}_') as tmpdir: + with TemporaryDirectory(prefix=f'borg-mount_{entry["name"]}_', dir=os.environ.get('RUNTIME_DIRECTORY')) as tmpdir: child = os.fork() if child == 0: # print('unshare/chroot', file=stderr) @@ -100,6 +100,8 @@ def copy_archive(src_repo_path, dst_repo_path, entry): work = pathlib.Path(tmpdir) / 'work' for path in [chroot,upper,work]: path.mkdir() + print(f'euid={os.getuid()}', file=stderr) + subprocess.run(['stat', '/', upper, work, chroot], check=True) subprocess.run(['mount', '-t', 'overlay', 'overlay', '-o', f'lowerdir=/,upperdir={upper},workdir={work}', chroot], check=True) bindMounts = ['nix', 'run', 'proc', 'dev', 'sys', pathlib.Path(os.path.expanduser('~')).relative_to('/')] 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 User = "borg"; Group = "borg"; StateDirectory = "borg"; + RuntimeDirectory = "copy-borg"; Environment = [ "BORG_RSH=\"${pkgs.openssh}/bin/ssh -F ${sshConfig}\"" "BORG_BASE_DIR=/var/lib/borg" -- cgit v1.2.3