dreport: fix capturing guard data in BMC dump

At present using mount path to copy the guard partition to the
BMC dump same is changed to /var/lib path as mount path is no
longer used.

Export device tree environment variables as the guard tool needs
it to parse the guard records from the guard partition.

Tested:
[Guard list]
ID | ERROR | Type | Path
00000001 | 00000000 | manual | physical:sys-0/node-0/proc-1

Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Change-Id: I74b1720ce8c7140a59e00d35ac45ac8a7c020e53
diff --git a/tools/dreport.d/openpower.d/plugins.d/guardlist b/tools/dreport.d/openpower.d/plugins.d/guardlist
index f99d78c..919a9d1 100644
--- a/tools/dreport.d/openpower.d/plugins.d/guardlist
+++ b/tools/dreport.d/openpower.d/plugins.d/guardlist
@@ -4,25 +4,31 @@
 # @brief: Collect GUARD record information.
 #
 
-. $DREPORT_INCLUDE/functions
+# shellcheck disable=SC1091
+. "$DREPORT_INCLUDE"/functions
 
 desc="GUARD Records"
-guard_part_file="/media/hostfw/running/GUARD"
+source /etc/profile.d/power-target.sh
+
+guard_part_file="/var/lib/phosphor-software-manager/hostfw/running/GUARD"
 
 # Check file is present and not empty.
 if [ -e "$guard_part_file" ]; then
-    add_copy_file "$guard_part_file" "GUARD partition"
+    add_copy_file "$guard_part_file" "$desc"
 fi
 
 # collect guarded list
 guard_log_file=guard.log
 if [ -e "/usr/bin/guard" ]; then
-    add_cmd_output "echo $'\n[Guard List]'" "$guard_log_file" "guard"
-    add_cmd_output "/usr/bin/guard -l" "$guard_log_file" "guard -l"
+    desc="Guard list"
+    add_cmd_output "echo $'[$desc]'" "$guard_log_file" "$desc"
+    add_cmd_output "/usr/bin/guard -l" "$guard_log_file" "$desc"
 
-    add_cmd_output "echo $'\n[Guard resolved records]'" "$guard_log_file" "guard"
-    add_cmd_output "/usr/bin/guard -a" "$guard_log_file" "guard -a"
+    desc="Guard resolved records"
+    add_cmd_output "echo $'\n[$desc]'" "$guard_log_file" "$desc"
+    add_cmd_output "/usr/bin/guard -a" "$guard_log_file" "$desc"
 
-    add_cmd_output "echo $'\n[Guard ephemeral records]'" "$guard_log_file" "guard"
-    add_cmd_output "/usr/bin/guard -e" "$guard_log_file" "guard -e"
+    desc="Guard ephemeral records"
+    add_cmd_output "echo $'\n[$desc]'" "$guard_log_file" "$desc"
+    add_cmd_output "/usr/bin/guard -e" "$guard_log_file" "$desc"
 fi