From b3f251cfd000789ac7b24aae9167e83e9752b4b9 Mon Sep 17 00:00:00 2001
From: Neil Horman <nhorman@fedoraproject.org>
Date: Mon, 23 Nov 2009 16:17:42 +0000
Subject: [PATCH] Resolves: bz539812

---
 firstboot_kdump.py | 26 +++++++++++++++++---------
 kexec-tools.spec   |  5 ++++-
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/firstboot_kdump.py b/firstboot_kdump.py
index 4060608..b78eea6 100755
--- a/firstboot_kdump.py
+++ b/firstboot_kdump.py
@@ -48,12 +48,13 @@ class moduleClass(Module):
 		self.priority = 100
 		self.sidebarTitle = N_("Kdump")
 		self.title = N_("Kdump")
+		self.reboot = False
 
 	# runPriority determines the order in which this module runs in firstboot
 	runPriority = 70
 	moduleName = _("Kdump")
 	windowName = moduleName
-	needsReboot = False
+	reboot = False
 
 	# possible bootloaders we'll need to adjust
 	#			 bootloader : (config file, kdump offset)
@@ -70,6 +71,9 @@ class moduleClass(Module):
 	kernelKdumpArches = [ "ppc64" ]
 	kernelKdumpInstalled = False
 
+	def needsReboot(self):
+		return self.reboot
+
 	# toggle sensitivity of kdump config bits
 	def showHide(self, status):
 		self.totalMem.set_sensitive(status)
@@ -139,6 +143,7 @@ class moduleClass(Module):
 		self.kdumpMem = 0
 		self.kdumpOffset = 0
 		self.origCrashKernel = ""
+		self.kdumpEnabled = False
 		chkConfigStatus=commands.getoutput('/sbin/chkconfig --list kdump')
 		if chkConfigStatus.find("on") > -1:
 			self.kdumpEnabled = True
@@ -148,13 +153,16 @@ class moduleClass(Module):
 					 cmdLine.split())[0].split("=")[1]
 			if self.doDebug:
 				print "crashString is %s" % crashString
-			(self.kdumpMem, self.kdumpOffset) = [int(m[:-1]) for m in crashString.split("@")]
+			if crashString.find("@") != -1:
+				(self.kdumpMem, self.kdumpOffset) = [int(m[:-1]) for m in crashString.split("@")]
+			else:
+				self.kdumpMem = int(crashString[:-1])
+				self.kdumpOffset = 0
 			self.availMem += self.kdumpMem
-			self.origCrashKernel = "%dM@%dM" % (self.kdumpMem, self.kdumpOffset)
+			self.origCrashKernel = "%dM" % (self.kdumpMem)
 			self.kdumpMemInitial = self.kdumpMem
 		else:
 			self.kdumpEnabled = False
-			self.kdumpMemInitial = 0
 		self.initialState = self.kdumpEnabled
 
 		# Do some sanity-checking and try to present only sane options.
@@ -325,10 +333,10 @@ class moduleClass(Module):
 			dlg.destroy()
 
 			if rc == gtk.RESPONSE_NO:
-				self.needsReboot = False
+				self.reboot = False
 				return RESULT_SUCCESS 
 			else:
-				self.needsReboot = True
+				self.reboot = True
 
 				# Find bootloader if it exists, and update accordingly
 				if self.getBootloader() == None:
@@ -341,8 +349,8 @@ class moduleClass(Module):
 
 				# Are we adding or removing the crashkernel param?
 				if self.kdumpEnabled:
-					grubbyCmd = "/sbin/grubby --%s --update-kernel=/boot/vmlinuz-%s --args=crashkernel=%iM@%iM" \
-								% (self.bootloader, self.runningKernel, reservedMem, self.offset)
+					grubbyCmd = "/sbin/grubby --%s --update-kernel=/boot/vmlinuz-%s --args=crashkernel=%iM" \
+								% (self.bootloader, self.runningKernel, reservedMem)
 					chkconfigStatus = "on"
 				else:
 					grubbyCmd = "/sbin/grubby --%s --update-kernel=/boot/vmlinuz-%s --remove-args=crashkernel=%s" \
@@ -358,7 +366,7 @@ class moduleClass(Module):
 					if self.bootloader == 'yaboot':
 						os.system('/sbin/ybin')
 		else:
-			self.needsReboot = False
+			self.reboot = False
 
 
 		return RESULT_SUCCESS
diff --git a/kexec-tools.spec b/kexec-tools.spec
index c19eca5..c29eed5 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -1,6 +1,6 @@
 Name: kexec-tools
 Version: 2.0.0 
-Release: 28%{?dist}
+Release: 29%{?dist}
 License: GPLv2
 Group: Applications/System
 Summary: The kexec/kdump userspace component.
@@ -264,6 +264,9 @@ done
 
 
 %changelog
+* Mon Nov 23 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-29
+- Updating firstboot script to RHEL-6 version (bz 539812)
+
 * Fri Nov 06 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-28
 - Added abrt infrastructure to kdump init script (bz 533370)