citadel-core/events/triggers/debug

27 lines
687 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env bash
2022-01-28 06:52:26 +00:00
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
#
2022-01-21 20:37:48 +00:00
# SPDX-License-Identifier: GPL-3.0-or-later
NODE_ROOT="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../..)"
RESULT_FILE="${NODE_ROOT}/statuses/debug-status.json"
cat <<EOF > "${RESULT_FILE}"
{"status": "processing"}
EOF
escape_for_json () {
jq --null-input --raw-input 'reduce inputs as $line (""; . += "\($line)\n")'
}
debug_json_string=$("${NODE_ROOT}/scripts/debug" --no-colors --no-instructions --filter | escape_for_json)
dmesg_json_string=$(dmesg | escape_for_json)
cat <<EOF > "${RESULT_FILE}"
{
"status": "success",
"debug": ${debug_json_string},
"dmesg": ${dmesg_json_string}
}
EOF