mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-19 12:14:10 +00:00
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:
parent
f667e94752
commit
99a2f550c0
@ -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
|
||||
|
@ -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.
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user