1#!/bin/bash
2#
3# config: 234 40
4# @brief: Collect GUARD record information.
5#
6
7# shellcheck disable=SC1091
8. "$DREPORT_INCLUDE"/functions
9
10desc="GUARD Records"
11source /etc/profile.d/power-target.sh
12
13guard_part_file="/var/lib/phosphor-software-manager/hostfw/running/GUARD"
14
15# Check file is present and not empty.
16if [ -e "$guard_part_file" ]; then
17    add_copy_file "$guard_part_file" "$desc"
18fi
19
20# collect guarded list
21guard_log_file=guard.log
22if [ -e "/usr/bin/guard" ]; then
23    desc="Guard list"
24    add_cmd_output "echo $'[$desc]'" "$guard_log_file" "$desc"
25    add_cmd_output "/usr/bin/guard -l" "$guard_log_file" "$desc"
26
27    desc="Guard resolved records"
28    add_cmd_output "echo $'\n[$desc]'" "$guard_log_file" "$desc"
29    add_cmd_output "/usr/bin/guard -a" "$guard_log_file" "$desc"
30
31    desc="Guard ephemeral records"
32    add_cmd_output "echo $'\n[$desc]'" "$guard_log_file" "$desc"
33    add_cmd_output "/usr/bin/guard -e" "$guard_log_file" "$desc"
34fi
35