Update initramfs scripts

This commit is contained in:
2026-01-03 09:07:38 +02:00
parent b1066cb4f2
commit 93f6259c87
3 changed files with 21 additions and 8 deletions
+7 -4
View File
@@ -1,11 +1,14 @@
#!/bin/sh
for file in $(find /boot/ -name 'initramfs-*'); do
kver=$(echo "$file" | sed 's/.img//' | cut -d'-' -f'2-')
name=$(echo "$file" | sed 's/.img//' | cut -d'-' -f2-)
# Continue if kernel version is installed
[ -d /usr/lib/modules/"$kver" ] && continue
# Continue if initramfs image name is an installed package
bpm q "$name" &> /dev/null && continue
# Continue if initramfs image name is an installed kernel version
[ -d /usr/lib/modules/"$name" ] && continue
echo "Removed $file"
rm $file
echo "Removed $file"
done