dreport: Enable dump collection based on types
Change-Id: I9babd0ce347a25aeed75c98ccc3686530efe38e2
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/tools/dreport b/tools/dreport
index 9f6afca..8af95b5 100755
--- a/tools/dreport
+++ b/tools/dreport
@@ -306,6 +306,29 @@
fi
}
+# @brief Initiate data collection based on the type.
+# @return 0 on success, error code otherwise
+function collect_data()
+{
+ case $dump_type in
+ $TYPE_USER)
+ runlevel_user
+ capture_data "${command_list[@]}"
+ ;;
+ $TYPE_CORE)
+ set_pid
+ runlevel_core
+ capture_data "${command_list[@]}"
+ ;;
+ $SUMMARY_DUMP)
+ #No data collection is required.
+ ;;
+ *) # unknown option
+ log_error "Skipping: Unknown dump type: $dump_type"
+ ;;
+ esac
+}
+
# @brief get pid from the file
# dreport "core" type user provides core file as optional file parameter.
# As per coredump source code systemd-coredump uses below format
@@ -544,7 +567,8 @@
#Initilize the summary log
init_summary
- #TODO Add Dump report generating script.
+ #collect data based on the type.
+ collect_data
package #package the dump
}