From f4399a1883a1684eeb27a75cea2590422489013f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 4 Jan 2008 15:02:31 +0000 Subject: [PATCH] * 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 --- installer/grub-menu-builder.sh | 24 +++++++++++++++++++----- system/options.nix | 14 ++++++++++++++ system/system.nix | 5 ++--- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/installer/grub-menu-builder.sh b/installer/grub-menu-builder.sh index ddcec0e93d5..779dba30c19 100644 --- a/installer/grub-menu-builder.sh +++ b/installer/grub-menu-builder.sh @@ -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 diff --git a/system/options.nix b/system/options.nix index 5b441148933..e99ab54d2b0 100644 --- a/system/options.nix +++ b/system/options.nix @@ -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 + gzip or bzip2. Set to + null to run Grub in text mode. + "; + }; + }; diff --git a/system/system.nix b/system/system.nix index 825fbf4a434..9dbfef0c0b3 100644 --- a/system/system.nix +++ b/system/system.nix @@ -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; };