1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 18:21:07 +01:00

panoptikon: use plain diff and do not store git state

This commit is contained in:
2024-05-08 06:37:53 +02:00
parent d51ffe9735
commit ad1d36cd0b

View File

@@ -109,7 +109,7 @@
User = "panoptikon"; User = "panoptikon";
Group = "panoptikon"; Group = "panoptikon";
WorkingDirectory = "/var/lib/panoptikon"; WorkingDirectory = "/var/lib/panoptikon";
RestartSec = "60"; RestartSec = toString (60 * 60);
Restart = "on-failure"; Restart = "on-failure";
LoadCredential = watcherOptions.loadCredential; LoadCredential = watcherOptions.loadCredential;
}; };
@@ -124,16 +124,16 @@
${watcherOptions.script} > ${watcherName} ${watcherOptions.script} > ${watcherName}
if [ -n "$(${pkgs.git}/bin/git diff -- ${watcherName})" ]; then diff_output=$(${pkgs.diffutils}/bin/diff --new-file ${watcherName}.old ${watcherName})
if [ -n "$diff_output" ]; then
${lib.strings.concatMapStringsSep "\n" (reporter: '' ${lib.strings.concatMapStringsSep "\n" (reporter: ''
${pkgs.git}/bin/git diff HEAD^ -- ${watcherName} | ${reporter} echo "$diff_output" | ${reporter}
'') '') watcherOptions.reporters}
watcherOptions.reporters}
: :
fi fi
${pkgs.git}/bin/git add ${watcherName} mv ${watcherName} ${watcherName}.old
${pkgs.git}/bin/git commit --message "${watcherName} / $(${pkgs.coreutils}/bin/date -Is)" || :
''; '';
}) })
cfg.watchers; cfg.watchers;