summarylogtreecommitdiffstats
path: root/dracut-btrfs-uefi-remove
blob: e845244526d6aa55809920a3c4419c2fe170af17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env bash

disk=$(lsblk /dev/nvme0n1 -o MODEL | awk '{print $2;}' | xargs)
subvolid=$(btrfs sub show / | grep 'Subvolume ID:' | awk '{print $3;}' | sed -r 's/\s+//g')

while read -r line; do
	if [[ "$line" == 'usr/lib/modules/'+([^/])'/pkgbase' ]]; then
		read -r pkgbase < "/${line}"
		kver="${line#'usr/lib/modules/'}"
		kver="${kver%'/pkgbase'}"
		
		rm -f "/boot/EFI/Linux/$kver-$disk-$subvolid-dracut.efi"
	fi
done