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