Commits

Michał Górny  committed 9b6ddc6

Support listing kernel files.

  • Participants
  • Parent commits 3505c9f

Comments (0)

Files changed (1)

File ecleankernel/cli.py

 	parser.add_option('-D', '--debug',
 			dest='debug', action='store_true', default=False,
 			help='Enable debugging output')
+	parser.add_option('-l', '--list-kernels',
+			dest='listkern', action='store_true', default=False,
+			help='List kernel files and exit')
 	parser.add_option('-n', '--num',
 			dest='num', type='int', default=0,
 			help='Leave only newest NUM kernels (by mtime)')
 	debug = ConsoleDebugger() if opts.debug else NullDebugger()
 
 	kernels = find_kernels()
+
+	if opts.listkern:
+		for k in kernels:
+			print('%s:' % k.version)
+			for key in ('vmlinuz', 'systemmap', 'config', 'modules', 'build'):
+				val = getattr(k, key)
+				if val is not None:
+					print('- %s: %s' % (key, val))
+		return 0
+
 	removals = get_removal_list(kernels,
 			limit = None if opts.all else opts.num,
 			bootloader = opts.bootloader,