grub: Add support for detecting btrfs subvolumes
This commit is contained in:
parent
fba9f641a8
commit
a6e6c85f06
|
@ -28,7 +28,7 @@ let
|
|||
extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
|
||||
default devices fsIdentifier;
|
||||
path = (makeSearchPath "bin" [
|
||||
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils
|
||||
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils pkgs.btrfsProgs
|
||||
]) + ":" + (makeSearchPath "sbin" [
|
||||
pkgs.mdadm pkgs.utillinux
|
||||
]);
|
||||
|
|
|
@ -111,6 +111,13 @@ sub GrubFs {
|
|||
die "invalid fs identifier type\n";
|
||||
}
|
||||
}
|
||||
if ($fs->type eq "btrfs") {
|
||||
$subvol = `mount | sed -n 's,^$fs->device on .*subvol=\([^,)]*\).*$,\1,p'`
|
||||
if ($subvol eq "") {
|
||||
$subvol = `btrfs subvol get-default $fs->mount | sed -n 's,^.*path \([^ ]*\) .*$,\1,p'`
|
||||
}
|
||||
$path = "/$subvol";
|
||||
}
|
||||
}
|
||||
if (not $search eq "") {
|
||||
$search = "search --set=drive$driveid " . $search;
|
||||
|
|
Loading…
Reference in New Issue