xref: /openbmc/openpower-debug-collector/dump/tools/bmcdump/plugins/dumpfilelist (revision 24226c4f3fbd0c0b3aa4319527ffc1f88ce7dc43)
1*24226c4fSGopichand Paturi#!/usr/bin/env bash
2*24226c4fSGopichand Paturi#
3*24226c4fSGopichand Paturi# config: 2 30
4*24226c4fSGopichand Paturi# @brief: Get the dump and core file information
5*24226c4fSGopichand Paturi#
6*24226c4fSGopichand Paturi
7*24226c4fSGopichand Paturi# shellcheck disable=SC1091
8*24226c4fSGopichand Paturi. "$DREPORT_INCLUDE"/functions
9*24226c4fSGopichand Paturi
10*24226c4fSGopichand Paturi#core files
11*24226c4fSGopichand Paturifile_name="dumplist.log"
12*24226c4fSGopichand Paturidesc="Dumps"
13*24226c4fSGopichand Paturicommand="busctl call --verbose --no-pager \
14*24226c4fSGopichand Paturi                xyz.openbmc_project.Dump.Manager \
15*24226c4fSGopichand Paturi                /xyz/openbmc_project/dump \
16*24226c4fSGopichand Paturi                org.freedesktop.DBus.ObjectManager \
17*24226c4fSGopichand Paturi                GetManagedObjects"
18*24226c4fSGopichand Paturiif ! add_cmd_output "$command" "$file_name" "$desc";
19*24226c4fSGopichand Paturithen
20*24226c4fSGopichand Paturi    #bmc dumps
21*24226c4fSGopichand Paturi    dir="/var/lib/phosphor-debug-collector/dumps/"
22*24226c4fSGopichand Paturi    desc="BMC dumps"
23*24226c4fSGopichand Paturi    if [ -d "$dir" ] && [ -n "$(ls -A $dir/)" ]; then
24*24226c4fSGopichand Paturi        add_cmd_output "echo $'[$desc]'" "$file_name" "$desc"
25*24226c4fSGopichand Paturi        add_cmd_output "ls -AX $dir/*/*" "$file_name" "$desc"
26*24226c4fSGopichand Paturi    else
27*24226c4fSGopichand Paturi        log_info "$desc directory is empty"
28*24226c4fSGopichand Paturi    fi
29*24226c4fSGopichand Paturi
30*24226c4fSGopichand Paturi    #hardware dumps
31*24226c4fSGopichand Paturi    dir="/var/lib/phosphor-debug-collector/hardwaredump/"
32*24226c4fSGopichand Paturi    desc="Hardware dumps"
33*24226c4fSGopichand Paturi    if [ -d "$dir" ] && [ -n "$(ls -A $dir/)" ]; then
34*24226c4fSGopichand Paturi        add_cmd_output "echo $'\n[$desc]'" "$file_name" "$desc"
35*24226c4fSGopichand Paturi        add_cmd_output "ls -AX $dir/*/*" "$file_name" "$desc"
36*24226c4fSGopichand Paturi    else
37*24226c4fSGopichand Paturi        log_info "$desc directory is empty"
38*24226c4fSGopichand Paturi    fi
39*24226c4fSGopichand Paturi
40*24226c4fSGopichand Paturi
41*24226c4fSGopichand Paturi    #hostboot dumps
42*24226c4fSGopichand Paturi    dir="/var/lib/phosphor-debug-collector/hostbootdump/"
43*24226c4fSGopichand Paturi    desc="Hostboot dumps"
44*24226c4fSGopichand Paturi    if [ -d "$dir" ] && [ -n "$(ls -A $dir/)" ]; then
45*24226c4fSGopichand Paturi        add_cmd_output "echo $'\n[$desc]'" "$file_name" "$desc"
46*24226c4fSGopichand Paturi        add_cmd_output "ls -AX $dir/*/*" "$file_name" "$desc"
47*24226c4fSGopichand Paturi    else
48*24226c4fSGopichand Paturi        log_info "$desc directory is empty"
49*24226c4fSGopichand Paturi    fi
50*24226c4fSGopichand Paturi
51*24226c4fSGopichand Paturi
52*24226c4fSGopichand Paturi    #sbe dumps
53*24226c4fSGopichand Paturi    dir="/var/lib/phosphor-debug-collector/sbedump/"
54*24226c4fSGopichand Paturi    desc="SBE dumps"
55*24226c4fSGopichand Paturi    if [ -d "$dir" ] && [ -n "$(ls -A $dir/)" ]; then
56*24226c4fSGopichand Paturi        add_cmd_output "echo $'\n[$desc]'" "$file_name" "$desc"
57*24226c4fSGopichand Paturi        add_cmd_output "ls -AX $dir/*/*" "$file_name" "$desc"
58*24226c4fSGopichand Paturi    else
59*24226c4fSGopichand Paturi        log_info "$desc directory is empty"
60*24226c4fSGopichand Paturi    fi
61*24226c4fSGopichand Paturifi
62*24226c4fSGopichand Paturi
63*24226c4fSGopichand Paturi#capture core file list
64*24226c4fSGopichand Paturidir="/var/lib/systemd/coredump/"
65*24226c4fSGopichand Paturidesc="core files"
66*24226c4fSGopichand Paturiif [ -d "$dir" ] && [ -n "$(ls -A $dir/)" ] && [ -n "$(ls -A $dir/core*)" ]; then
67*24226c4fSGopichand Paturi    add_cmd_output "echo $'[$desc]'" "$file_name" "$desc"
68*24226c4fSGopichand Paturi    add_cmd_output "ls -AX $dir/core*" "$file_name" "$desc"
69*24226c4fSGopichand Paturielse
70*24226c4fSGopichand Paturi    log_info "$desc directory is empty"
71*24226c4fSGopichand Paturifi
72*24226c4fSGopichand Paturi
73