1 2 3 4 5 6 7 8 9
#!/bin/bash -e efi="$(bootctl -p)" while read -r line; do if [[ "$line" == 'usr/lib/modules/'+([^/])'/pkgbase' ]]; then kver="$(basename "$(dirname "${line}")")" rm -v "$efi/EFI/Linux/linux-${kver}-$(cat /etc/machine-id)"-*.efi fi done