citadel-core/events/triggers/debug
2021-10-22 16:56:27 +01:00

27 lines
699 B
Bash
Executable File

#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@protonmail.com>
#
# SPDX-License-Identifier: AGPL-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