fix: report skipped rules in event-trigger run; add lm-sensors dep

- run now counts rules skipped because their check produced no number (or
  the line was unparseable) and reports both counts, so an all-skipped pass
  no longer reads as 'evaluated 0 rule(s)'.
- preinstall.sh installs lm-sensors — the sensor example rules in event.env
  need it; howto troubleshooting notes to check 'sensors -u' output for the
  real *_input key before adding a rule.
This commit is contained in:
Your Name
2026-08-09 17:31:59 +00:00
parent 030ec0b456
commit 577d49ac2d
4 changed files with 16 additions and 6 deletions
+9 -4
View File
@@ -64,14 +64,15 @@ set -- "${args[@]}"
# ── run ──────────────────────────────────────────────────────────
run_rules() {
eventer_read_rules
local n fired hash msg line
local n fired hash msg line skipped
n=0
skipped=0
for line in "${RULES[@]}"; do
case "$line" in
""|\#*) continue ;;
esac
eventer_parse_rule "$line" || { warn "skipping unparseable rule: $line"; continue; }
eventer_eval_check || { warn "check produced no number — $RULE_CMD"; continue; }
eventer_parse_rule "$line" || { warn "skipping unparseable rule: $line"; skipped=$((skipped + 1)); continue; }
eventer_eval_check || { warn "check produced no number — $RULE_CMD"; skipped=$((skipped + 1)); continue; }
n=$((n + 1))
if eventer_compare "$VALUE_NUM" "$RULE_OP" "$RULE_NUM"; then fired=1; else fired=0; fi
hash="$(eventer_hash "$line")"
@@ -95,7 +96,11 @@ run_rules() {
log "(dry-run) OK: $RULE_CMD = $VALUE_DISPLAY (no change)"
fi
done
log "evaluated $n rule(s)"
if [ "$skipped" -gt 0 ]; then
log "evaluated $n rule(s), skipped $skipped (no number / unparseable)"
else
log "evaluated $n rule(s)"
fi
}
# ── list ─────────────────────────────────────────────────────────