summaryrefslogtreecommitdiffstats
path: root/krops.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-01 03:26:27 +0000
committertv <tv@krebsco.de>2026-12-01 03:26:27 +0000
commitbc9b11b3b67671a014779d90998ebd66073eb063 (patch)
treecc971ffa234d7010edb24565faaaec8edfdb15b3 /krops.nix
parent7ac7990c9b76aa9e9aba6a15974c22e37c024a00 (diff)
krops.nix: put enstate submissions in place in one step
From /run to /var/lib/enstate, mv copies, so a submission was briefly half there in the incoming directory. Now each is copied under a dot name, which enstate skips, and renamed.
Diffstat (limited to 'krops.nix')
-rw-r--r--krops.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/krops.nix b/krops.nix
index 88f8eee8..aa4e511d 100644
--- a/krops.nix
+++ b/krops.nix
@@ -203,9 +203,15 @@ rec {
forgetPending = /* sh */ ''
trap 'rm -fR ${pending}' EXIT
'';
+ # Copied under a dot name, which enstate skips, and renamed: from memory
+ # to disk, mv would copy, and enstate could see half a submission.
movePending = /* sh */ ''
mkdir -p -m 0700 ${stateDir} ${stateDir}/incoming
- find ${pending} -mindepth 1 -maxdepth 1 -exec mv -t ${stateDir}/incoming {} +
+ find ${pending} -mindepth 1 -maxdepth 1 -printf '%f\n' |
+ while read -r submission; do
+ cp -a ${pending}/"$submission" ${stateDir}/incoming/."$submission"
+ mv ${stateDir}/incoming/."$submission" ${stateDir}/incoming/"$submission"
+ done
'';
};