#!/usr/bin/env bash UMBREL_ROOT="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../..)" DEBUG_SCRIPT="${UMBREL_ROOT}/scripts/debug" cat < "${UMBREL_ROOT}/statuses/debug-status.json" {"status": "processing"} EOF json_encode () { jq --null-input --raw-input 'reduce inputs as $line (""; . += "\($line)\n")' } debug_json_string=$("${DEBUG_SCRIPT}" --dashboard | sed '/onion/d' | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | json_encode) dmesg_json_string=$(dmesg | json_encode) cat < "${UMBREL_ROOT}/statuses/debug-status.json" { "status": "success", "debug": ${debug_json_string}, "dmesg": ${dmesg_json_string} } EOF echo "Debug result file generated"