blob: 5b6acda7cabc6059e8bb7bd9e64a2ba6523d5b7d [file] [log] [blame]
Gopichand Paturi24226c42024-05-16 14:51:22 -05001#!/usr/bin/env bash
2
Gopichand Paturi0d723812024-10-24 04:04:07 -05003declare -rx TYPE_FAULTDATA="faultdata"
4
Gopichand Paturi24226c42024-05-16 14:51:22 -05005# @brief fetch serial number
6# @param serial number
7function fetch_serial_number() {
8 serialNo=$(busctl get-property xyz.openbmc_project.Inventory.Manager \
9 /xyz/openbmc_project/inventory/system xyz.openbmc_project.Inventory.Decorator.Asset \
10 SerialNumber | cut -d " " -f 2 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
11
12 if [ -z "$serialNo" ]; then
13 serialNo="0000000"
14 fi
15}
16
17# @brief Add BMC dump File Name
18# @param BMC Dump File Name
19function get_bmc_dump_filename() {
20 fetch_serial_number
SwethaParasa9a39f432024-10-18 02:00:33 -050021 dump_id=$(printf %08d $dump_id)
Gopichand Paturi24226c42024-05-16 14:51:22 -050022 if [ $dump_type = "$TYPE_FAULTDATA" ]; then
23 header_dump_name="FLTDUMP"
24 name="NAGDUMP.${serialNo}.${dump_id}.${dDay}"
25 else
26 header_dump_name="BMCDUMP"
27 name="BMCDUMP.${serialNo}.${dump_id}.${dDay}"
28 fi
29}