diff --git a/scripts/boot/blitz-watchdog.sh b/scripts/boot/blitz-watchdog.sh index dbbefec..758d521 100644 --- a/scripts/boot/blitz-watchdog.sh +++ b/scripts/boot/blitz-watchdog.sh @@ -344,7 +344,7 @@ watchdog_launch_incident() { local reason="$1" local unit_name="$2" - "${BOOT_SCRIPT_DIR}/blitz-incident-capture-launch.sh" \ + blitz_launch_incident_capture \ --source watchdog \ --reason "${reason}" \ --unit "${unit_name}" \ diff --git a/scripts/boot/common.sh b/scripts/boot/common.sh index 573b2de..61a2205 100644 --- a/scripts/boot/common.sh +++ b/scripts/boot/common.sh @@ -28,6 +28,8 @@ blitz_host_from_addr() { blitz_load_boot_env() { local env_file local default_time_server + local dev_run_root + local dev_runtime_dir if [[ "${BLITZ_BOOT_ENV_LOADED:-0}" == "1" ]]; then return 0 @@ -54,6 +56,25 @@ blitz_load_boot_env() { normalize_loaded_env_vars fi + dev_run_root="${OMNISOCKETGO_ROOT}/logs" + dev_runtime_dir="${dev_run_root}/runtime" + + if [[ -z "${BLITZ_RUN_ROOT:-}" || "${BLITZ_RUN_ROOT}" == "${dev_run_root}" ]]; then + export BLITZ_RUN_ROOT="/var/log/blitz-robot" + fi + if [[ -z "${BLITZ_RUNTIME_DIR:-}" || "${BLITZ_RUNTIME_DIR}" == "${dev_runtime_dir}" ]]; then + export BLITZ_RUNTIME_DIR="/run/blitz-robot" + fi + if [[ -z "${BLITZ_RUN_CONTEXT_FILE:-}" || "${BLITZ_RUN_CONTEXT_FILE}" == "${dev_runtime_dir}/run-context.env" ]]; then + export BLITZ_RUN_CONTEXT_FILE="${BLITZ_RUNTIME_DIR}/run-context.env" + fi + if [[ -z "${BLITZ_RUN_ID_FILE:-}" || "${BLITZ_RUN_ID_FILE}" == "${dev_runtime_dir}/run-id" ]]; then + export BLITZ_RUN_ID_FILE="${BLITZ_RUNTIME_DIR}/run-id" + fi + if [[ -z "${BLITZ_CURRENT_RUN_LINK:-}" || "${BLITZ_CURRENT_RUN_LINK}" == "${dev_run_root}/current" ]]; then + export BLITZ_CURRENT_RUN_LINK="${BLITZ_RUN_ROOT}/current" + fi + default_time_server="$(blitz_host_from_addr "${ROBOT_SIDE_OMNISOCKET_SERVER_ADDR:-}" || true)" export BLITZ_BOOT_DELAY_SEC="${BLITZ_BOOT_DELAY_SEC:-30}" @@ -636,5 +657,5 @@ blitz_launch_incident_capture() { if [[ ! -f "${launch_script}" ]]; then return 1 fi - "${launch_script}" "$@" >/dev/null 2>&1 || return 1 + /bin/bash "${launch_script}" "$@" >/dev/null 2>&1 || return 1 } diff --git a/scripts/boot/robot-boot.env b/scripts/boot/robot-boot.env index 727767c..02400c1 100644 --- a/scripts/boot/robot-boot.env +++ b/scripts/boot/robot-boot.env @@ -5,6 +5,9 @@ BLITZ_BOOT_DELAY_SEC="30" BLITZ_RUN_ROOT="/var/log/blitz-robot" BLITZ_LOG_FILE="/var/log/blitz-robot/startup.log" BLITZ_RUNTIME_DIR="/run/blitz-robot" +BLITZ_RUN_CONTEXT_FILE="${BLITZ_RUNTIME_DIR}/run-context.env" +BLITZ_RUN_ID_FILE="${BLITZ_RUNTIME_DIR}/run-id" +BLITZ_CURRENT_RUN_LINK="${BLITZ_RUN_ROOT}/current" BLITZ_5G_DIAL_DIR="${OMNISOCKETGO_ROOT}/scripts/boot" BLITZ_5G_SERIAL_PORT="/dev/ttyUSB2"