Modifications to grub-menu-builder: copy default kernel and initrd to /boot/nixos-.. , limit menu size

svn path=/nixos/trunk/; revision=10106
This commit is contained in:
Michael Raskin 2008-01-10 04:43:19 +00:00
parent f667e94752
commit 99a2f550c0
3 changed files with 26 additions and 1 deletions

View File

@ -35,12 +35,18 @@ if test -n "@grubSplashImage@"; then
echo "splashimage $splashLocation" >> $tmp
fi
configurationCounter=0;
addEntry() {
local name="$1"
local path="$2"
local shortSuffix="$3"
configurationCounter=$((configurationCounter + 1))
if test $configurationCounter -gt @configurationLimit@ ; then
return
fi;
if ! test -e $path/kernel -a -e $path/initrd; then
return
fi
@ -48,6 +54,16 @@ addEntry() {
local kernel=$(readlink -f $path/kernel)
local initrd=$(readlink -f $path/initrd)
if test "$path" = "$default"; then
cp "$kernel" /boot/nixos-kernel
cp "$initrd" /boot/nixos-initrd
cp "$(readlink -f "$path/init")" /boot/nixos-init
cat > /boot/nixos-grub-config <<EOF
kernel ${bootMount:-/boot}/nixos-kernel systemConfig=$(readlink -f "$path") init=${bootMount:-/boot}/nixos-init $(cat "$path/kernel-params")
initrd ${bootMount:-/boot}/nixos-initrd
EOF
fi
if test -n "@copyKernels@"; then
local kernel2=/boot/kernels/$(echo $kernel | sed 's^/^-^g')
if ! test -e $kernel2; then

View File

@ -251,6 +251,15 @@
";
};
configurationLimit = mkOption {
default = 100;
example = 120;
description = "
Maximum of configurations in boot menu. GRUB has problems when
there are too many entries.
";
};
};

View File

@ -324,7 +324,7 @@ rec {
inherit (pkgs) bash;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
inherit (config.boot) copyKernels extraGrubEntries
grubSplashImage bootMount;
grubSplashImage bootMount configurationLimit;
};