Added possibility to give configurations custom names.
svn path=/nixos/trunk/; revision=8915
This commit is contained in:
parent
f0d1570377
commit
58b29cd565
@ -24,6 +24,7 @@ GRUBEND
|
|||||||
addEntry() {
|
addEntry() {
|
||||||
local name="$1"
|
local name="$1"
|
||||||
local path="$2"
|
local path="$2"
|
||||||
|
local shortSuffix="$3"
|
||||||
|
|
||||||
if ! test -e $path/kernel -a -e $path/initrd; then
|
if ! test -e $path/kernel -a -e $path/initrd; then
|
||||||
return
|
return
|
||||||
@ -46,6 +47,13 @@ addEntry() {
|
|||||||
initrd=$initrd2
|
initrd=$initrd2
|
||||||
fi
|
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
|
cat >> $tmp << GRUBEND
|
||||||
title $name
|
title $name
|
||||||
kernel $kernel systemConfig=$(readlink -f $path) init=$(readlink -f $path/init) $(cat $path/kernel-params)
|
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
|
if test -n "$tmp"; then
|
||||||
addEntry "NixOS - Default" $default
|
addEntry "NixOS - Default" $default ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +90,7 @@ for generation in $(
|
|||||||
echo $generation
|
echo $generation
|
||||||
link=/nix/var/nix/profiles/system-$generation-link
|
link=/nix/var/nix/profiles/system-$generation-link
|
||||||
date=$(stat --printf="%y\n" $link | sed 's/\..*//')
|
date=$(stat --printf="%y\n" $link | sed 's/\..*//')
|
||||||
addEntry "NixOS - Configuration $generation ($date)" $link
|
addEntry "NixOS - Configuration $generation ($date)" $link "$generation ($date)"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,6 +66,15 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = ["boot" "configurationName"];
|
||||||
|
default = "";
|
||||||
|
example = "Stable 2.6.21";
|
||||||
|
description = "
|
||||||
|
Grub entry name instead of default.
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["boot" "kernelParams"];
|
name = ["boot" "kernelParams"];
|
||||||
default = [
|
default = [
|
||||||
|
@ -327,6 +327,7 @@ rec {
|
|||||||
pkgs.diffutils
|
pkgs.diffutils
|
||||||
pkgs.upstart # for initctl
|
pkgs.upstart # for initctl
|
||||||
];
|
];
|
||||||
|
configurationName = config.get ["boot" "configurationName"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ ln -s $etc/etc $out/etc
|
|||||||
ln -s $systemPath $out/sw
|
ln -s $systemPath $out/sw
|
||||||
|
|
||||||
echo "$kernelParams" > $out/kernel-params
|
echo "$kernelParams" > $out/kernel-params
|
||||||
|
echo "$configurationName" > $out/configuration-name
|
||||||
|
|
||||||
cat > $out/menu.lst << GRUBEND
|
cat > $out/menu.lst << GRUBEND
|
||||||
kernel $kernel init=$bootStage2 $kernelParams
|
kernel $kernel init=$bootStage2 $kernelParams
|
||||||
|
Loading…
x
Reference in New Issue
Block a user