* Option to set the Grub background image. To

get the background image to work, you may need
  to set NIXOS_INSTALL_GRUB=1 when calling
  nixos-rebuild to force Grub to be reinstalled
  with splashimage support.

svn path=/nixos/trunk/; revision=10071
This commit is contained in:
Eelco Dolstra 2008-01-04 15:02:31 +00:00
parent e9a7f80681
commit f4399a1883
3 changed files with 35 additions and 8 deletions

View File

@ -11,17 +11,30 @@ if test -z "$1"; then
exit 1
fi
bootMount=@bootMount@
if test -z "$bootMount"; then bootMount=/boot; fi
target=/boot/grub/menu.lst
tmp=$target.tmp
cat > $tmp << GRUBEND
# Automatically generated. DO NOT EDIT THIS FILE!
default=0
timeout=5
default 0
timeout 5
GRUBEND
if test -n "@grubSplashImage@"; then
splashLocation=@grubSplashImage@
# !!! image in /nix/store doesn't seem to work
#if test -n "@copyKernels@"; then
cp -f $splashLocation /boot/background.xpm.gz
splashLocation=$bootMount/background.xpm.gz
#fi
echo "splashimage $splashLocation" >> $tmp
fi
addEntry() {
local name="$1"
@ -48,9 +61,9 @@ addEntry() {
fi
initrd=$initrd2
if test -n "@bootMount@"; then
kernel=$(echo $kernel2 | sed -e 's^/boot^@bootMount@^')
initrd=$(echo $initrd2 | sed -e 's^/boot^@bootMount@^')
if test -n "$bootMount"; then
kernel=$(echo $kernel2 | sed -e "s^/boot^$bootMount^")
initrd=$(echo $initrd2 | sed -e "s^/boot^$bootMount^")
fi
fi
@ -62,6 +75,7 @@ addEntry() {
fi;
cat >> $tmp << GRUBEND
title $name
kernel $kernel systemConfig=$(readlink -f $path) init=$(readlink -f $path/init) $(cat $path/kernel-params)
initrd $initrd

View File

@ -220,6 +220,20 @@
";
};
grubSplashImage = mkOption {
default = pkgs.fetchurl {
url = http://www.gnome-look.org/CONTENT/content-files/36909-soft-tux.xpm.gz;
sha256 = "14kqdx2lfqvh40h6fjjzqgff1mwk74dmbjvmqphi6azzra7z8d59";
};
example = null;
description = "
Background image used for Grub. It must be a 640x480,
14-colour image in XPM format, optionally compressed with
<command>gzip</command> or <command>bzip2</command>. Set to
<literal>null</literal> to run Grub in text mode.
";
};
};

View File

@ -318,9 +318,8 @@ rec {
isExecutable = true;
inherit (pkgs) bash;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
copyKernels = config.boot.copyKernels;
extraGrubEntries = config.boot.extraGrubEntries;
bootMount = config.boot.bootMount;
inherit (config.boot) copyKernels extraGrubEntries
grubSplashImage bootMount;
};