support: Exec hardware specific scripts from /etc/support.d

Allow particular boards or platforms install hardware specific scripts
in /etc/support.d, via the usual /usr/share/product logic, which are
then run by /sbin/support and included in the resulting bundle.

This lets us collect hardware specific information, e.g., SoC-specific
error counters, without /sbin/support needing to know about all the
nitty gritty details.
This commit is contained in:
Tobias Waldekranz
2025-12-16 14:26:46 +01:00
parent 2aeeadb045
commit 15aa98b7e3
+11
View File
@@ -383,6 +383,17 @@ cmd_collect()
collect system/netstat.txt ss -tunlp
fi
for script in $(find "/etc/support.d" -type f -executable 2>/dev/null | sort); do
echo "[$(date -Iseconds)] Running ${script}..." >> "${EXEC_LOG}" 2>&1
if "${script}" "${COLLECT_DIR}" >> "${EXEC_LOG}" 2>&1; then
echo "[$(date -Iseconds)] Success: ${script}" >> "${EXEC_LOG}" 2>&1
else
exit_code=$?
echo "[$(date -Iseconds)] Failed (exit ${exit_code}): ${script}" >> "${EXEC_LOG}" 2>&1
fi
done
# Completion timestamp in log
echo "" >> "${EXEC_LOG}"
echo "Completed: $(date -Iseconds)" >> "${EXEC_LOG}"