grub: Allow setting the boot root explicitly
If /boot is a btrfs subvolume, it will be on a different device than / but not be at the root from grub's perspective. This should be fixed in a nicer way by #2449, but that can't go into 14.04.
This commit is contained in:
parent
4fe2f98051
commit
e4630c1d41
|
@ -25,7 +25,7 @@ let
|
||||||
inherit (cfg)
|
inherit (cfg)
|
||||||
version extraConfig extraPerEntryConfig extraEntries
|
version extraConfig extraPerEntryConfig extraEntries
|
||||||
extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
|
extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
|
||||||
default devices;
|
default devices explicitBootRoot;
|
||||||
path = (makeSearchPath "bin" [
|
path = (makeSearchPath "bin" [
|
||||||
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils
|
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils
|
||||||
]) + ":" + (makeSearchPath "sbin" [
|
]) + ":" + (makeSearchPath "sbin" [
|
||||||
|
@ -209,6 +209,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
explicitBootRoot = mkOption {
|
||||||
|
default = "";
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
The relative path of /boot within the parent volume. Leave empty
|
||||||
|
if /boot is not a btrfs subvolume.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,6 +39,7 @@ my $configurationLimit = int(get("configurationLimit"));
|
||||||
my $copyKernels = get("copyKernels") eq "true";
|
my $copyKernels = get("copyKernels") eq "true";
|
||||||
my $timeout = int(get("timeout"));
|
my $timeout = int(get("timeout"));
|
||||||
my $defaultEntry = int(get("default"));
|
my $defaultEntry = int(get("default"));
|
||||||
|
my $explicitBootRoot = get("explicitBootRoot");
|
||||||
$ENV{'PATH'} = get("path");
|
$ENV{'PATH'} = get("path");
|
||||||
|
|
||||||
die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
|
die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
|
||||||
|
@ -61,6 +62,10 @@ if (stat("/")->dev != stat("/boot")->dev) {
|
||||||
$copyKernels = 1;
|
$copyKernels = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($explicitBootRoot ne "") {
|
||||||
|
$bootRoot = $explicitBootRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Generate the header.
|
# Generate the header.
|
||||||
my $conf .= "# Automatically generated. DO NOT EDIT THIS FILE!\n";
|
my $conf .= "# Automatically generated. DO NOT EDIT THIS FILE!\n";
|
||||||
|
|
Loading…
Reference in New Issue