From 526b8983b97ca5572b3f6088b3128c5c10eb42e0 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 20 Oct 2026 15:27:30 +0200 Subject: [PATCH] create symlink ~/box.cfg + improve logging in repo_sync.py --- install.py | 8 ++++++++ repo_sync.py | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/install.py b/install.py index be3a11b..0457b50 100755 --- a/install.py +++ b/install.py @@ -750,6 +750,14 @@ def handle_config(): print('replace host name %r by %r' % (box.hostname, newhostname)) show.dirty = True config = box.read_config() + cfgpath = Path(box.cfgfile) + cfglink = Path.home() / 'box.cfg' + if not cfglink.exists() or cfglink.resolve() != cfgpath: + print(f'ln -s {cfgpath} {cfglink}') + if doit: + cfglink.symlink_to(cfgpath) + else: + print(f'ln -s {cfgpath} {cfglink}') box.hostname = newhostname update_host_key(newhostname) if cfgfile is None: diff --git a/repo_sync.py b/repo_sync.py index 9e7b62f..1288761 100644 --- a/repo_sync.py +++ b/repo_sync.py @@ -39,7 +39,7 @@ def get_dirs(): def ssh(remote_cmd: str) -> subprocess.CompletedProcess: - print(remote_cmd) + log(f'> {remote_cmd}') return subprocess.run( SSH_OPTS.split() + [CENTRAL, remote_cmd], capture_output=True, text=True, @@ -71,6 +71,7 @@ def cmd_restore(): dorestore = f"{REMOTE_DIR}/do.restore" if ssh(f"ls {dorestore}").returncode == 0: if restore(): + log("restore done") ssh(f"rm {dorestore}") return True else: @@ -106,7 +107,7 @@ def cmd_backup() -> None: sys.exit("inotifywait exited, letting systemd restart us") changed.clear() if backup(): - last_backup = time.monotonic() + log('backup done') ssh(f'touch {REMOTE_DIR}/backup.done') changed.wait() else: