@@ -26,11 +26,13 @@ def main():
2626 {'flags' : ['--autodetect-root-luks' ], 'action' : 'store_true' , 'help' : 'autodetect LUKS volumes under the root partition' },
2727 {'flags' : ['--no-autodetect-root-luks' ], 'action' : 'store_false' , 'help' : 'do not autodetect root LUKS volumes' , 'dest' : 'autodetect_root_luks' },
2828 {'flags' : ['--print-config' ], 'action' : 'store_true' , 'help' : 'print the final config dict' },
29+ {'flags' : ['--print-init' ], 'action' : 'store_true' , 'help' : 'print the final init structure' },
2930 {'flags' : ['out_file' ], 'action' : 'store' , 'help' : 'set the output image location' , 'nargs' : '?' }]
3031
3132 args , logger = get_args_n_logger (package = __package__ , description = 'MicrogRAM disk initramfs generator' , arguments = arguments , drop_default = True )
3233 kwargs = get_kwargs_from_args (args , logger = logger )
3334 kwargs .pop ('print_config' , None ) # This is not a valid kwarg for InitramfsGenerator
35+ kwargs .pop ('print_init' , None ) # This is not a valid kwarg for InitramfsGenerator
3436
3537 logger .debug (f"Using the following kwargs: { kwargs } " )
3638 generator = InitramfsGenerator (** kwargs )
@@ -46,6 +48,14 @@ def main():
4648 if 'print_config' in args and args .print_config :
4749 print (generator .config_dict )
4850
51+ if 'print_init' in args and args .print_init :
52+ for runlevel in ['init_pre' , * generator .init_types , 'init_final' ]:
53+ if runlevel not in generator .imports :
54+ continue
55+ print ({runlevel } + ":" )
56+ for func in generator .imports [runlevel ]:
57+ print (f" { func .__name__ } " )
58+
4959
5060if __name__ == '__main__' :
5161 main ()
0 commit comments