-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added simply for convenience until this, or an equivilant, change is merged in the upstream grub2 source. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #847
- Loading branch information
1 parent
c171ea7
commit 7eebaff
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
diff -up ./util/grub-mkconfig.in.original ./util/grub-mkconfig.in | ||
--- ./util/grub-mkconfig.in.original 2012-03-27 13:03:49.475388000 -0700 | ||
+++ ./util/grub-mkconfig.in 2012-03-27 13:06:38.948080000 -0700 | ||
@@ -140,9 +140,24 @@ if test -e ${GRUB_PREFIX}/device.map ; t | ||
${grub_mkdevicemap} | ||
fi | ||
|
||
-# Device containing our userland. Typically used for root= parameter. | ||
-GRUB_DEVICE="`${grub_probe} --target=device /`" | ||
-GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true | ||
+# Attempt to detect if the root file system is in ZFS first | ||
+unset GRUB_DEVICE | ||
+unset GRUB_DEVICE_BOOT | ||
+getzfsgrubdevice() { | ||
+ mount | while read dev dummy mntpnt dummy2 fstype rest ; do | ||
+ if [ -n "$GRUB_DEVICE" ] ; then break ; fi | ||
+ if [ "$fstype" != "zfs" ] ; then continue ; fi | ||
+ if [ "$mntpnt" != "/" ] ; then continue ; fi | ||
+ GRUB_DEVICE=`fstab-decode echo "$dev"` | ||
+ GRUB_DEVICE="ZFS=$GRUB_DEVICE" ; echo "$GRUB_DEVICE" ; break | ||
+ done | ||
+} | ||
+GRUB_DEVICE=`getzfsgrubdevice` | ||
+if [ -z "$GRUB_DEVICE" ] ; then | ||
+ # Device containing our userland. Typically used for root= parameter. | ||
+ GRUB_DEVICE="`${grub_probe} --target=device /`" | ||
+ GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true | ||
+fi | ||
|
||
# Device containing our /boot partition. Usually the same as GRUB_DEVICE. | ||
GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`" |