citadel-core/events/triggers/debug
2022-01-28 01:52:26 -05:00

27 lines
687 B
Bash
Executable File

#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
#
# 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