Commits

Michał Górny  committed e737832

Support calling kernel-install for prerm.

This basically adds Bootloader Specification compliance, gummiboot
support and possibly some more through prerm hooks.

Fixes: https://bitbucket.org/mgorny/eclean-kernel/issue/6/support-boot-loader-specification

  • Participants
  • Parent commits d46f6c8

Comments (0)

Files changed (1)

File ecleankernel/cli.py

 
 from __future__ import print_function
 
-import os, os.path, errno, shlex, time
+import os, os.path, errno, shlex, subprocess, time
 
 from optparse import OptionParser
 
 
 				for k, reason in removals:
 					print('- %s: %s' % (k.version, ', '.join(reason)))
+				if os.access('/usr/bin/kernel-install', os.X_OK):
+					print('kernel-install will be called to perform prerm tasks.')
 				if removals and hasattr(bootloader, 'postrm'):
 					print('Bootloader %s config will be updated.' % bootloader.name)
 			else:
 
 					if remove:
 						print('* Removing kernel %s (%s)' % (k.version, ', '.join(reason)))
+
+						if os.access('/usr/bin/kernel-install', os.X_OK):
+							p = subprocess.Popen(
+									['/usr/bin/kernel-install', 'remove',
+										k.real_kv, k.vmlinuz])
+							if p.wait() != 0:
+								print('* kernel-install exited with %d status' % p.returncode)
+
 						del kernels[k.version]
 						nremoved += 1