File kdump-save-log of Package kdump

From: Jeff Mahoney <jeffm@suse.com>
Subject: kdump: Save dmesg during dump

 makedumpfile added a --dump-dmesg option in version 1.4.0. This allows
 users to capture just the log messages rather than setting up a full
 development environment to generate it.

 It will also work on the generated vmcore, but just dumping in in
 $DIR/$TIMESTAMP/dmesg.txt and asking users to attach that file to bug
 reports is a lot easier for everyone involved.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 kdumptool/savedump.cc |    9 +++++++++
 sysconfig.kdump       |    5 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)

--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -302,6 +302,14 @@ void SaveDump::saveDump()
         m_useMakedumpfile = true;
     }
 
+    // Save a copy of dmesg
+    DataProvider *logProvider;
+    string logDirectCmdline = "makedumpfile --dump-dmesg " + m_dump;
+    string logPipeCmdline = "makedumpfile --dump-dmesg -F " + m_dump;
+
+    logProvider = new ProcessDataProvider(logPipeCmdline.c_str(),
+                                          logDirectCmdline.c_str());
+
     try {
         Terminal terminal;
         if (m_useMakedumpfile) {
@@ -314,6 +322,7 @@ void SaveDump::saveDump()
         else
             cout << "Saving dump ..." << endl;
         m_transfer->perform(provider, "vmcore", &m_usedDirectSave);
+        m_transfer->perform(logProvider, "dmesg.txt", NULL);
         if (m_useMakedumpfile)
             terminal.printLine();
     } catch (...) {