xref: /freebsd/sys/contrib/openzfs/cmd/zed/zed.d/all-debug.sh (revision a18b956b73cee784e5c422d20fd0e4dabebd7eee)
1#!/bin/sh
2# shellcheck disable=SC2154
3#
4# Log all environment variables to ZED_DEBUG_LOG.
5#
6# This can be a useful aid when developing/debugging ZEDLETs since it shows the
7# environment variables defined for each zevent.
8
9[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
10. "${ZED_ZEDLET_DIR}/zed-functions.sh"
11
12: "${ZED_DEBUG_LOG:="${TMPDIR:="/tmp"}/zed.debug.log"}"
13
14zed_exit_if_ignoring_this_event
15
16zed_lock "${ZED_DEBUG_LOG}"
17{
18	env | sort
19	echo
20} 1>&"${ZED_FLOCK_FD}"
21zed_unlock "${ZED_DEBUG_LOG}"
22
23exit 0
24