]> git.proxmox.com Git - mirror_zfs.git/blame - patches/grub-mkconfig-zfs-support.diff
Uninitialized variable spa_autoreplace used
[mirror_zfs.git] / patches / grub-mkconfig-zfs-support.diff
CommitLineData
7eebaff4
MAR
1diff -up ./util/grub-mkconfig.in.original ./util/grub-mkconfig.in
2--- ./util/grub-mkconfig.in.original 2012-03-27 13:03:49.475388000 -0700
3+++ ./util/grub-mkconfig.in 2012-03-27 13:06:38.948080000 -0700
4@@ -140,9 +140,24 @@ if test -e ${GRUB_PREFIX}/device.map ; t
5 ${grub_mkdevicemap}
6 fi
7
8-# Device containing our userland. Typically used for root= parameter.
9-GRUB_DEVICE="`${grub_probe} --target=device /`"
10-GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
11+# Attempt to detect if the root file system is in ZFS first
12+unset GRUB_DEVICE
13+unset GRUB_DEVICE_BOOT
14+getzfsgrubdevice() {
15+ mount | while read dev dummy mntpnt dummy2 fstype rest ; do
16+ if [ -n "$GRUB_DEVICE" ] ; then break ; fi
17+ if [ "$fstype" != "zfs" ] ; then continue ; fi
18+ if [ "$mntpnt" != "/" ] ; then continue ; fi
19+ GRUB_DEVICE=`fstab-decode echo "$dev"`
20+ GRUB_DEVICE="ZFS=$GRUB_DEVICE" ; echo "$GRUB_DEVICE" ; break
21+ done
22+}
23+GRUB_DEVICE=`getzfsgrubdevice`
24+if [ -z "$GRUB_DEVICE" ] ; then
25+ # Device containing our userland. Typically used for root= parameter.
26+ GRUB_DEVICE="`${grub_probe} --target=device /`"
27+ GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
28+fi
29
30 # Device containing our /boot partition. Usually the same as GRUB_DEVICE.
31 GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"