1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +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";
Group = "panoptikon";
WorkingDirectory = "/var/lib/panoptikon";
RestartSec = "60";
RestartSec = toString (60 * 60);
Restart = "on-failure";
LoadCredential = watcherOptions.loadCredential;
};
@@ -124,16 +124,16 @@
${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: ''
${pkgs.git}/bin/git diff HEAD^ -- ${watcherName} | ${reporter}
'')
watcherOptions.reporters}
echo "$diff_output" | ${reporter}
'') watcherOptions.reporters}
:
fi
${pkgs.git}/bin/git add ${watcherName}
${pkgs.git}/bin/git commit --message "${watcherName} / $(${pkgs.coreutils}/bin/date -Is)" || :
mv ${watcherName} ${watcherName}.old
'';
})
cfg.watchers;