3
0
Fork 0
forked from mirrors/nixpkgs

* Option boot.copyKernels to copy all kernels and initrd to

/boot/kernels.  This is necessary if /nix is on a different file
  system than /.  (And it will allow us to support a separate /boot
  partition too.)

svn path=/nixos/trunk/; revision=7887
This commit is contained in:
Eelco Dolstra 2007-02-09 16:19:29 +00:00
parent 2c62eac3a1
commit 582abdaae2
3 changed files with 43 additions and 9 deletions

View file

@ -19,24 +19,47 @@ default=0
timeout=5
GRUBEND
addEntry() {
name="$1"
path="$2"
if ! test -e $path/menu.lst; then
addEntry() {
local name="$1"
local path="$2"
if ! test -e $path/kernel -a -e $path/initrd; then
return
fi
local kernel=$(readlink -f $path/kernel)
local initrd=$(readlink -f $path/initrd)
if test -n "@copyKernels@"; then
local kernel2=/boot/kernels/$(echo $kernel | sed 's^/^-^g')
if ! test -e $kernel2; then
cp $kernel $kernel2
fi
kernel=$kernel2
local initrd2=/boot/kernels/$(echo $initrd | sed 's^/^-^g')
if ! test -e $initrd2; then
cp $initrd $initrd2
fi
initrd=$initrd2
fi
cat >> $tmp << GRUBEND
title $name
kernel $kernel init=$(readlink -f $path/init) $(cat $path/kernel-params)
initrd $initrd
GRUBEND
#cat $path/menu.lst >> $tmp
grep -v "title \|default=\|timeout=" < $path/menu.lst >> $tmp
}
rm -rf /boot/kernels
if test -n "@copyKernels@"; then
mkdir -p /boot/kernels
fi
if test -n "$tmp"; then
addEntry "NixOS - Default" $default
fi
@ -52,7 +75,6 @@ for generation in $(
link=/nix/var/nix/profiles/system-$generation-link
date=$(stat --printf="%y\n" $link | sed 's/\..*//')
addEntry "NixOS - Configuration $generation ($date)" $link
done

View file

@ -175,6 +175,17 @@
}
{
name = ["boot" "copyKernels"];
default = false;
description = "
Whether the Grub menu builder should copy kernels and initial
ramdisks to /boot. This is necessary when /nix is on a
different file system than /.
";
}
{
name = ["networking" "useDHCP"];
default = true;

View file

@ -256,6 +256,7 @@ rec {
isExecutable = true;
inherit (pkgs) bash;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
copyKernels = config.get ["boot" "copyKernels"];
};