From 7e78611ed422f11239be6537980f7aa551629fcd Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin@piware.de>
Date: Sat, 7 Jan 2023 19:04:40 +0100
Subject: [PATCH] backup: Run check through ssh

This is much faster and more efficient, as it doesn't need to transfer
the files. It requires transfering the passphrase though.
---
 backup | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/backup b/backup
index bbca65e..421fde9 100755
--- a/backup
+++ b/backup
@@ -40,5 +40,9 @@ $RESTIC backup --exclude-file=$HOME/.config/backup-ignore $HOME || fail
 # TODO: forget --prune policy: https://restic.readthedocs.io/en/stable/060_forget.html
 notify-send "Backup finished successfully"
 
-$RESTIC check || fail "BACKUP CHECK FAILED!"
+scp .config/backup-passphrase piware.de:.cache/
+ssh piware.de chmod u+w .cache/backup-passphrase
+trap "ssh piware.de shred -u .cache/backup-passphrase" EXIT INT QUIT PIPE
+ssh piware.de restic --password-file .cache/backup-passphrase --repo backup/restic check || fail "BACKUP CHECK FAILED!"
+
 notify-send "Backup checked successfully"
-- 
2.39.5