On Tue, 29 Aug 2023 18:17:34 +1000 "Michael D. Setzer II via users" users@lists.fedoraproject.org wrote:
If someone knows of better way to accomplish the same. Seems there should be a better method, but it seems to work.
I don't know if it is better, but if you run rpm -qf [directory in either /lib/modules or /usr/src/kernels] it will tell you the name of the rpm package that owns it, or if there is no owner, [directory name] is not owned by any package. Maybe you can use that in some way to simplify the script.