1*24226c4fSGopichand Paturi#!/usr/bin/env bash
2*24226c4fSGopichand Paturi
3*24226c4fSGopichand Paturi# @brief fetch serial number
4*24226c4fSGopichand Paturi# @param serial number
5*24226c4fSGopichand Paturifunction fetch_serial_number() {
6*24226c4fSGopichand Paturi    serialNo=$(busctl get-property xyz.openbmc_project.Inventory.Manager \
7*24226c4fSGopichand Paturi            /xyz/openbmc_project/inventory/system xyz.openbmc_project.Inventory.Decorator.Asset \
8*24226c4fSGopichand Paturi        SerialNumber | cut -d " " -f 2 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
9*24226c4fSGopichand Paturi
10*24226c4fSGopichand Paturi    if [ -z "$serialNo" ]; then
11*24226c4fSGopichand Paturi        serialNo="0000000"
12*24226c4fSGopichand Paturi    fi
13*24226c4fSGopichand Paturi}
14*24226c4fSGopichand Paturi
15*24226c4fSGopichand Paturi# @brief Add BMC dump File Name
16*24226c4fSGopichand Paturi# @param BMC Dump File Name
17*24226c4fSGopichand Paturifunction get_bmc_dump_filename() {
18*24226c4fSGopichand Paturi    fetch_serial_number
19*24226c4fSGopichand Paturi    dump_id=$(printf %07d $dump_id)
20*24226c4fSGopichand Paturi    if [ $dump_type = "$TYPE_FAULTDATA" ]; then
21*24226c4fSGopichand Paturi        header_dump_name="FLTDUMP"
22*24226c4fSGopichand Paturi        name="NAGDUMP.${serialNo}.${dump_id}.${dDay}"
23*24226c4fSGopichand Paturi    else
24*24226c4fSGopichand Paturi        header_dump_name="BMCDUMP"
25*24226c4fSGopichand Paturi        name="BMCDUMP.${serialNo}.${dump_id}.${dDay}"
26*24226c4fSGopichand Paturi    fi
27*24226c4fSGopichand Paturi}
28