Allow a way to install grub to multiple devices (for /boot on soft raid arrays).

svn path=/nixos/trunk/; revision=32913
This commit is contained in:
Lluís Batlle i Rossell 2012-03-08 21:37:30 +00:00
parent 9d1b72a6c7
commit 13ac0a309b
3 changed files with 21 additions and 2 deletions

View file

@ -54,6 +54,20 @@ in
value <literal>nodev</literal> means that a GRUB boot menu
will be generated, but GRUB itself will not actually be
installed.
To install grub into multiple devices look at
<literal>devices</literal>.
'';
};
devices = mkOption {
default = [];
example = [ "/dev/hda" ];
type = with pkgs.lib.types; listOf string;
description = ''
The devices on which the boot loader, GRUB, will be
installed. Can be used instead of <literal>device</literal> to
install grub into multiple devices (as softraid arrays holding /boot).
'';
};

View file

@ -38,7 +38,9 @@ if [ "$action" = "switch" -o "$action" = "boot" ]; then
if [ "$NIXOS_INSTALL_GRUB" = 1 -o "$oldGrubVersion" != "$newGrubVersion" ]; then
echo "installing the GRUB bootloader..."
@grub@/sbin/grub-install "$(readlink -f "@grubDevice@")" --no-floppy
for a in @grubDevices@; do
@grub@/sbin/grub-install "$(readlink -f "$a")" --no-floppy
done
echo "$newGrubVersion" > /boot/grub/version
fi
fi

View file

@ -171,7 +171,10 @@ let
if config.boot.loader.grub.enable
then (builtins.parseDrvName config.system.build.grub.name).version
else "";
grubDevice = config.boot.loader.grub.device;
grubDevices = let
wrapQuotes = s: "\"" + s + "\"";
in map wrapQuotes ([ config.boot.loader.grub.device ] ++
config.boot.loader.grub.devices);
configurationName = config.boot.loader.grub.configurationName;
};