On 29 Aug 2023 at 8:41, stan wrote:
Date sent: Tue, 29 Aug 2023 08:41:58 -0700 From: stan upaitag@zoho.com To: users@lists.fedoraproject.org Copies to: mikes@guam.net Subject: Re: /usr/src/kernels Organization: zohofree
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.
Thanks for the quick reply.. Will do that after next kernel update that has the orphaned sub directory. Only happens to me on machines that have the extra custom module that needs to be built for USB wifi adapter. Seems update doesn't handle there directores link to that.
Have modified script a little after running shelldir on script. Latest is: #!/bin/bash find ./*x86_64 -maxdepth 0 >x1 y=$(find /boot/vmlinuz*x86_64 | cut -b15-100) for a in $y; do sed -i "/$a/d" x1; done while read -r line; do echo "$line"; rm -rf ./"$line"/; done <x1 rm x1
It didn't like the ls and grep and recommended read and the sed improved the processing.
Seems to work for me, but don't know all the variations that people might have. So would recommend commenting out the rm line or putting an echo in front to see what it would do first.
Interesting...
+------------------------------------------------------------+ Michael D. Setzer II - Computer Science Instructor (Retired) mailto:mikes@guam.net mailto:msetzerii@gmail.com Guam - Where America's Day Begins G4L Disk Imaging Project maintainer http://sourceforge.net/projects/g4l/ +------------------------------------------------------------+