#!/usr/bin/env bash # SPDX-FileCopyrightText: 2021 Aaron Dewes # # 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 < "${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 < "${RESULT_FILE}" { "status": "success", "debug": ${debug_json_string}, "dmesg": ${dmesg_json_string} } EOF