Add rootflags=subvol=<name> if / is on a btrfs subvolume (LP: #712029).

This commit is contained in:
Colin Watson 2011-02-04 14:29:21 +00:00
parent 458bc629c4
commit 266a01be26
3 changed files with 29 additions and 0 deletions

1
debian/changelog vendored
View File

@ -7,6 +7,7 @@ grub2 (1.99~rc1-2) UNRELEASED; urgency=low
Uggla).
* Handle empty dir passed to grub_find_root_device_from_mountinfo; fixes
grub-mkrelpath on btrfs subvolumes (LP: #712029).
* Add rootflags=subvol=<name> if / is on a btrfs subvolume (LP: #712029).
-- Colin Watson <cjwatson@debian.org> Tue, 18 Jan 2011 11:44:48 +0000

27
debian/patches/btrfs_rootflags.patch vendored Normal file
View File

@ -0,0 +1,27 @@
Description: Add rootflags=subvol=<name> if / is on a btrfs subvolume
Not yet forwarded upstream because rootflags= is distribution-specific.
It's not clear how to do this portably.
Author: Colin Watson <cjwatson@ubuntu.com>
Forwarded: no
Bug-Ubuntu: https://bugs.launchpad.net/bugs/712029
Last-Update: 2011-02-04
Index: b/util/grub.d/10_linux.in
===================================================================
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -51,6 +51,14 @@
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
+if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
+ rootsubvol="`make_system_path_relative_to_its_root /`"
+ rootsubvol="${rootsubvol#/}"
+ if [ "x${rootsubvol}" != x ]; then
+ GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
+ fi
+fi
+
linux_entry ()
{
os="$1"

View File

@ -16,3 +16,4 @@ branch_squash.patch
branch_longlinuxcmd.patch
branch_parse-color.patch
branch_embed-sectors.patch
btrfs_rootflags.patch