[kexec-tools] Update to use systemctl instead of sysv chkconfig

Dave Young yangrr at fedoraproject.org
Thu Aug 9 02:47:56 UTC 2012


commit f1638fbe8aa66aa9b805b32dc569ea159eca2789
Author: Dave Young <dyoung at redhat.com>
Date:   Thu Aug 9 10:22:48 2012 +0800

    Update to use systemctl instead of sysv chkconfig
    
    use systemctl to check/set the service enable/disable status
    
    Signed-off-by: Dave Young <dyoung at redhat.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>

 firstboot_kdump.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/firstboot_kdump.py b/firstboot_kdump.py
index beaf005..3d431f1 100755
--- a/firstboot_kdump.py
+++ b/firstboot_kdump.py
@@ -150,8 +150,8 @@ class moduleClass(Module):
 		self.kdumpOffset = 0
 		self.origCrashKernel = ""
 		self.kdumpEnabled = False
-		chkConfigStatus=commands.getoutput('/sbin/chkconfig --list kdump')
-		if chkConfigStatus.find("on") > -1:
+		chkConfigStatus=commands.getoutput('/bin/systemctl is-enabled kdump.service')
+		if chkConfigStatus.find("enabled") > -1:
 			self.kdumpEnabled = True
 		self.kdumpMemInitial = 0
 		if cmdLine.find("crashkernel") > -1:
@@ -356,18 +356,18 @@ class moduleClass(Module):
 				if self.kdumpEnabled:
 					grubbyCmd = "/sbin/grubby --%s --update-kernel=/boot/vmlinuz-%s --args=crashkernel=%iM" \
 								% (self.bootloader, self.runningKernel, reservedMem)
-					chkconfigStatus = "on"
+					chkconfigStatus = "enable"
 				else:
 					grubbyCmd = "/sbin/grubby --%s --update-kernel=/boot/vmlinuz-%s --remove-args=crashkernel=%s" \
 								% (self.bootloader, self.runningKernel, self.origCrashKernel)
-					chkconfigStatus = "off" 
+					chkconfigStatus = "disable"
 
 				if self.doDebug:
 					print "Using %s bootloader with %iM offset" % (self.bootloader, self.offset)
 					print "Grubby command would be:\n	%s" % grubbyCmd
 				else:
 					os.system(grubbyCmd)
-					os.system("/sbin/chkconfig kdump %s" % chkconfigStatus)
+					os.system("/bin/systemctl %s kdump.service" % (chkconfigStatus))
 					if self.bootloader == 'yaboot':
 						os.system('/sbin/ybin')
 		else:


More information about the scm-commits mailing list