]> TLD Linux GIT Repositories - packages/grub2.git/blob - grub-lvmdevice.patch
- grub2 from PLD
[packages/grub2.git] / grub-lvmdevice.patch
1 --- grub-1.97.1/util/grub-mkconfig.in~  2009-11-17 17:02:16.626243372 +0200
2 +++ grub-1.97.1/util/grub-mkconfig.in   2009-11-17 17:02:08.346050859 +0200
3 @@ -120,6 +120,21 @@
4  
5  # Device containing our userland.  Typically used for root= parameter.
6  GRUB_DEVICE="`${grub_probe} --target=device /`"
7 +
8 +# Rewrite to sane LVM node (Code from PLD Linux geninitrd):
9 +# /dev/mapper/sys-rootfs -> /dev/sys/rootfs
10 +# /dev/mapper/blodnatt-blah--bleh -> /dev/blodnatt/blah-bleh
11 +# /dev/mapper/vg--meaw-root -> /dev/vg-meaw/root
12 +case "$GRUB_DEVICE" in
13 +/dev/mapper/*-*)
14 +       # change "--" to / (as "/" is impossible in LV name)
15 +       local dev=$(awk -vdev="${GRUB_DEVICE#/dev/mapper/}" 'BEGIN{gsub(/--/, "/", dev); print dev}')
16 +       local VG=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[1]); print v[1]}')
17 +       local LV=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[2]); print v[2]}')
18 +       GRUB_DEVICE=/dev/$VG/$LV
19 +;;
20 +esac
21 +
22  GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
23  
24  # Device containing our /boot partition.  Usually the same as GRUB_DEVICE.