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

args=('--force' '--quiet')

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'}"

		dracut "${args[@]}" --hostonly "/boot/EFI/Linux/$kver-$disk-$subvolid-dracut.efi" --kver "$kver"
	fi
done