Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f14e5c6b authored by Steve Fung's avatar Steve Fung Committed by Android Git Automerger
Browse files

am 2218720d: Merge "crash_reporter: Use os-release.d to store the crash server url"

* commit '2218720d':
  crash_reporter: Use os-release.d to store the crash server url
parents b7ccd83f 2218720d
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ LOCAL_C_INCLUDES := $(crash_reporter_includes)
LOCAL_REQUIRED_MODULES := core2md \
    crash_reporter_logs.conf \
    crash_sender \
    crash_server \
    dbus-send
LOCAL_INIT_RC := crash_reporter.rc
LOCAL_RTTI_FLAG := -frtti
@@ -92,6 +93,22 @@ LOCAL_SHARED_LIBRARIES := libmetrics
LOCAL_SRC_FILES := $(warn_collector_src)
include $(BUILD_EXECUTABLE)

# /etc/os-release.d/crash_server configuration file.
# ========================================================
ifdef OSRELEASED_DIRECTORY
include $(CLEAR_VARS)
LOCAL_MODULE := crash_server
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
include $(BUILD_SYSTEM)/base_rules.mk

# If the crash server isn't set, use a blank value.  crash_sender
# will log it as a configuration error.
$(LOCAL_BUILT_MODULE): BRILLO_CRASH_SERVER ?= ""
$(LOCAL_BUILT_MODULE):
	echo $(BRILLO_CRASH_SERVER) > $@
endif

# Crash reporter logs conf file.
# ========================================================
include $(CLEAR_VARS)
+10 −2
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@ DEVCOREDUMP_UPLOAD_FLAG_FILE="${CRASH_STATE_DIR}/device_coredump_upload_allowed"
# The weave configuration file.
WEAVE_CONF_FILE="/etc/weaved/weaved.conf"

# The os-release.d folder.
OSRELEASED_FOLDER="/etc/os-release.d"

# The syslog tag for all logging we emit.
TAG="$(basename $0)[$$]"

@@ -256,7 +259,12 @@ get_kind() {
get_key_value() {
  local file="$1" key="$2" value

  if [ -f "${file}" ]; then
  if [ -f "${file}/${key}" ]; then
    # Get the value from a folder where each key is its own file.  The key
    # file's entire contents is the value.
    value=$(cat "${file}/${key}")
  elif [ -f "${file}" ]; then
    # Get the value from a file that has multiple key=value combinations.
    # Return the first entry.  There shouldn't be more than one anyways.
    # Substr at length($1) + 2 skips past the key and following = sign (awk
    # uses 1-based indexes), but preserves embedded = characters.
@@ -291,7 +299,7 @@ send_crash() {
  local report_payload="$(get_key_value "${meta_path}" "payload")"
  local kind="$(get_kind "${meta_path}")"
  local exec_name="$(get_key_value "${meta_path}" "exec_name")"
  local url="$(getprop crash_reporter.server)"
  local url="$(get_key_value "${OSRELEASED_FOLDER}" "crash_server")"
  local bdk_version="$(get_key_value "${meta_path}" "bdk_version")"
  local hwclass="$(get_hardware_class)"
  local write_payload_size="$(get_key_value "${meta_path}" "payload_size")"