From 53bb5d4d17e2a1563900c63b31213395543e0e55 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 18 Feb 2022 13:03:58 +0100 Subject: vidhar: ... --- hosts/vidhar/borg/copy.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'hosts/vidhar') diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py index 38e719cf..d8d19a86 100755 --- a/hosts/vidhar/borg/copy.py +++ b/hosts/vidhar/borg/copy.py @@ -131,6 +131,12 @@ def copy_archive(src_repo_path, dst_repo_path, entry): (chroot / bindMount).mkdir(parents=True,exist_ok=True) # print(*['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], file=stderr) subprocess.run(['mount', '--bind', pathlib.Path('/') / bindMount, chroot / bindMount], check=True) + try: + os.unlink('/etc/fuse.conf') + except FileNotFoundError: + pass + with open('/etc/fuse.conf', 'w') as fuse_conf: + fuse_conf.write('user_allow_other\nmount_max = 1000\n') os.chroot(chroot) os.chdir('/') dir = pathlib.Path('/borg') @@ -150,12 +156,11 @@ def copy_archive(src_repo_path, dst_repo_path, entry): else: print(f'{total_files} files, {naturalsize(total_size, binary=True)}', file=stderr) # print(f'Mounting to {dir}', file=stderr) - with subprocess.Popen(['borg', 'mount', '--foreground', '--progress', '--lock-wait=600', f'{src_repo_path}::{entry["name"]}', dir], preexec_fn=lambda: as_borg()) as mount_proc: + with subprocess.Popen(['borg', 'mount', '-o', 'allow_other', '--foreground', '--progress', '--lock-wait=600', f'{src_repo_path}::{entry["name"]}', dir], preexec_fn=lambda: as_borg()) as mount_proc: with Halo(text='Waiting for mount', **halo_args) as sp: wait_start = datetime.now() while True: - ret = subprocess.run(['mountpoint', '-q', dir], preexec_fn=lambda: as_borg()) - if ret.returncode == 0: + if os.path.ismount(dir): break elif datetime.now() - wait_start > timedelta(minutes=15): ret.check_returncode() -- cgit v1.2.3