From 05403dbd9bdbc6cc855778115153f428e3c3ecb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Thu, 5 Mar 2026 11:27:45 +0100 Subject: [PATCH] More robust gitea dump override --- m/tent/gitea.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/m/tent/gitea.nix b/m/tent/gitea.nix index 2c5b11f1..a3cc95b4 100644 --- a/m/tent/gitea.nix +++ b/m/tent/gitea.nix @@ -54,9 +54,19 @@ WorkingDirectory = cfg.dump.backupDir; }; - # gitea dump does not allow overriding files. Instead dump to stdout with - script = '' - ${exe} dump --type ${cfg.dump.type} --file - >"gitea-dump-$(date +%a).${cfg.dump.type}" + output="gitea-dump-$(date +%a).${cfg.dump.type}" + + if ${exe} dump --type ${cfg.dump.type} --file - >"temp.zip" ; then + if [ -s "temp.zip" ] ; then + mv temp.zip "$output" + echo "INFO: Backup saved at $output" + exit 0 + fi + echo "ERROR: dump command exited correctly, but temp.zip is empty" + fi + echo "ERROR: dump failed" + exit 1 ''; };