Added possibility to give configurations custom names.

svn path=/nixos/trunk/; revision=8915
This commit is contained in:
Michael Raskin 2007-06-23 16:09:05 +00:00
parent f0d1570377
commit 58b29cd565
4 changed files with 21 additions and 2 deletions

View file

@ -24,6 +24,7 @@ GRUBEND
addEntry() {
local name="$1"
local path="$2"
local shortSuffix="$3"
if ! test -e $path/kernel -a -e $path/initrd; then
return
@ -46,6 +47,13 @@ addEntry() {
initrd=$initrd2
fi
local confName=$(if test -e $path/configuration-name; then
cat $path/configuration-name;
fi);
if test -n "$confName" ; then
name="$confName $3";
fi;
cat >> $tmp << GRUBEND
title $name
kernel $kernel systemConfig=$(readlink -f $path) init=$(readlink -f $path/init) $(cat $path/kernel-params)
@ -61,7 +69,7 @@ fi
if test -n "$tmp"; then
addEntry "NixOS - Default" $default
addEntry "NixOS - Default" $default ""
fi
@ -82,7 +90,7 @@ for generation in $(
echo $generation
link=/nix/var/nix/profiles/system-$generation-link
date=$(stat --printf="%y\n" $link | sed 's/\..*//')
addEntry "NixOS - Configuration $generation ($date)" $link
addEntry "NixOS - Configuration $generation ($date)" $link "$generation ($date)"
done

View file

@ -66,6 +66,15 @@
";
}
{
name = ["boot" "configurationName"];
default = "";
example = "Stable 2.6.21";
description = "
Grub entry name instead of default.
";
}
{
name = ["boot" "kernelParams"];
default = [

View file

@ -327,6 +327,7 @@ rec {
pkgs.diffutils
pkgs.upstart # for initctl
];
configurationName = config.get ["boot" "configurationName"];
};

View file

@ -11,6 +11,7 @@ ln -s $etc/etc $out/etc
ln -s $systemPath $out/sw
echo "$kernelParams" > $out/kernel-params
echo "$configurationName" > $out/configuration-name
cat > $out/menu.lst << GRUBEND
kernel $kernel init=$bootStage2 $kernelParams