Commits

Michał Górny  committed 8f49412

Always preserve currently running kernel.

  • Participants
  • Parent commits b5b835d

Comments (0)

Files changed (1)

File ecleankernel/process.py

 # (c) 2010 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
+import os
+
 class RemovedKernelDict(dict):
 	def add(self, k, reason):
 		if k not in self:
 	out = RemovedKernelDict()
 	for k in remove_stray(kernels):
 		out.add(k, 'vmlinuz does not exist')
-	return out
+
+	current = os.uname()[2]
+
+	def not_current(kre):
+		if kre[0].version == current:
+			print('Preserving currently running kernel (%s)' % current)
+			return False
+		return True
+
+	return filter(not_current, out)