On 28 Aug 2023 at 23:35, ToddAndMargo via users wrote:

Date sent:              Mon, 28 Aug 2023 23:35:29 -0700
To:                     Community support for Fedora users 
<users@lists.fedoraproject.org>
Subject:                /usr/src/kernels
Send reply to:          Community support for Fedora users 
<users@lists.fedoraproject.org>
From:                   ToddAndMargo via users 
<users@lists.fedoraproject.org>
Copies to:              ToddAndMargo <toddandma...@zoho.com>

> Hi All,
> 
> Can I get rid on any of these?  All the non fc38
> ones?  All of them?
> 
> # ls -al /usr/src/kernels
> total 44
> drwxr-xr-x. 11 root root 4096 Aug 26 16:05 .
> drwxr-xr-x.  5 root root 4096 Jan 18  2023 ..
> drwxr-xr-x. 23 root root 4096 Dec 10  2022 5.18.10-200.fc36.x86_64
> drwxr-xr-x. 24 root root 4096 Jul  6 21:48 6.0.11-300.fc37.x86_64
> drwxr-xr-x. 24 root root 4096 Dec 10  2022 6.0.12-200.fc36.x86_64
> drwxr-xr-x. 25 root root 4096 Jul  6 21:48 6.2.12-200.fc37.x86_64
> drwxr-xr-x. 25 root root 4096 Jul  6 21:48 6.3.12-100.fc37.x86_64
> drwxr-xr-x. 25 root root 4096 Jul  6 21:48 6.3.8-100.fc37.x86_64
> drwxr-xr-x. 25 root root 4096 Aug 26 16:05 6.4.10-200.fc38.x86_64
> drwxr-xr-x. 25 root root 4096 Aug 26 16:05 6.4.11-200.fc38.x86_64
> drwxr-xr-x. 25 root root 4096 Aug 26 16:04 6.4.12-200.fc38.x86_64
> 
Had modified my cleanmodules2 to cleanmodule3 to compare 
directories with kernels in /boot

cat cleanmodules3 
#!/bin/bash
ls -1 | grep x86_64>x1
y=$(ls -1 /boot/vmlinuz* | grep -v rescue| cut -b15-100)
for a in $y; do grep -v $a <x1 >x2; mv x2 x1; done 
for a in $(cat x1); do 
        echo "$a";
        rm ./"$a"/* -f -r;
        rmdir "$a";
done
rm x1


gets a listing of directorys in the /lib/modules or could do in the 
/usr/src/kernels directory
The it sets $y to be the current kernels from /boot
Then removes the current ones from listing in file x1
Then removes file and directories that are not those.

My /usr/src/kernels only have the latest 3.
In modules directory, I had a special module for a USB wifi card 
that I had to build since Fedora wasn't seeing the adapter with 
native ones. But didn't have any left over source directories.

For me running script seems to work in either directory.
created an older directory in both and run script from within each 
directory, and it removed the ones not list in /boot as kernels.
But would recommand  doing a backup of files before testing.

If someone knows of better way to accomplish the same. Seems 
there should be a better method, but it seems to work.


> 
> Many thanks,
> -T
> _______________________________________________
> users mailing list -- users@lists.fedoraproject.org
> To unsubscribe send an email to users-le...@lists.fedoraproject.org
> Fedora Code of Conduct: 
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: 
> https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
> Do not reply to spam, report it: 
> https://pagure.io/fedora-infrastructure/new_issue


+------------------------------------------------------------+
 Michael D. Setzer II - Computer Science Instructor (Retired)     
 mailto:mi...@guam.net                            
 mailto:msetze...@gmail.com
 Guam - Where America's Day Begins                        
 G4L Disk Imaging Project maintainer 
 http://sourceforge.net/projects/g4l/
+------------------------------------------------------------+


_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to