1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00

* Use fbsplash / splashutils to give virtual consoles a nice

background.  Each console can have a different theme.  The mapping
  from consoles to themes is specified in splash-themes.nix.

svn path=/nixu/trunk/; revision=7137
This commit is contained in:
Eelco Dolstra 2006-11-26 23:00:30 +00:00
parent 81856426cf
commit 0b1caba9d8
5 changed files with 150 additions and 0 deletions

View file

@ -113,6 +113,14 @@ rec {
inherit (pkgs) openssh;
})
# Transparent TTY backgrounds.
(import ./upstart-jobs/tty-backgrounds.nix {
inherit (pkgs) stdenv splashutils;
backgrounds = (import ./splash-themes.nix {
inherit (pkgs) fetchurl;
}).ttyBackgrounds;
})
# Handles the maintenance/stalled event (single-user shell).
(import ./upstart-jobs/maintenance-shell.nix {
inherit (pkgs) bash;

45
test/splash-themes.nix Normal file
View file

@ -0,0 +1,45 @@
{fetchurl}:
rec {
# Some themes.
themeBabyTux = fetchurl {
url = http://www.bootsplash.de/files/themes/Theme-BabyTux.tar.bz2;
md5 = "a6d89d1c1cff3b6a08e2f526f2eab4e0";
};
themeFrozenBubble = fetchurl {
url = http://www.bootsplash.de/files/themes/Theme-FrozenBubble.tar.bz2;
md5 = "da49f04988ab04b7e0de117b0d25061a";
};
themePativo = fetchurl {
url = http://www.bootsplash.de/files/themes/Theme-Pativo.tar.bz2;
md5 = "9e13beaaadf88d43a5293e7ab757d569";
};
# The themes to use for each tty. For each tty except the first
# entry in the list, you can omit `theme' to get the same theme as
# the first one. If a tty does not appear, it doesn't get a
# theme (i.e., it will keep a black background).
ttyBackgrounds = [
{ tty = 1;
theme = themeBabyTux;
}
{ tty = 2;
}
{ tty = 3;
theme = themeFrozenBubble;
}
{ tty = 4;
theme = themePativo;
}
{ tty = 6;
theme = themeFrozenBubble;
}
];
}

View file

@ -0,0 +1,37 @@
source $stdenv/setup
ttys=($ttys)
themes=($themes)
ensureDir $out
default=
for ((n = 0; n < ${#ttys[*]}; n++)); do
tty=${ttys[$n]}
theme=${themes[$n]}
if test "$theme" = "default"; then
if test -z "$default"; then
echo "No default theme!"
exit 1
fi
theme=$default
fi
if test -z "$default"; then default=$theme; fi
echo "TTY $tty -> $theme"
themeName=$(cd $theme && ls)
ln -sf $theme/$themeName $out/$themeName
if test -e $out/$tty; then
echo "Multiple themes defined for the same TTY!"
exit 1
fi
ln -sf $themeName $out/$tty
done

View file

@ -0,0 +1,44 @@
{stdenv, splashutils, backgrounds}:
rec {
name = "tty-backgrounds";
unpackTheme = theme: stdenv.mkDerivation {
name = "theme";
builder = ./unpack-theme.sh;
inherit theme;
};
themesUnpacked = stdenv.mkDerivation {
name = "splash-themes";
builder = ./tty-backgrounds-combine.sh;
# !!! Should use XML here.
ttys = map (x: x.tty) backgrounds;
themes = map (x: if x ? theme then (unpackTheme x.theme) else "default") backgrounds;
};
job = "
start on hardware-scan
script
rm -f /etc/splash
ln -s ${themesUnpacked} /etc/splash
# Critical: tell the kernel where to find splash_helper. It calls
# this program every time we switch between consoles.
echo ${splashutils}/bin/splash_helper > /proc/sys/kernel/fbsplash
# Set the theme for each console, as determined by
# tty-backgrounds-combine.sh above.
for tty in ${toString (map (x: x.tty) backgrounds)}; do
theme=$(readlink ${themesUnpacked}/$tty)
${splashutils}/bin/splash_util --tty $tty -c setcfg -t $theme || true
${splashutils}/bin/splash_util --tty $tty -c setpic -t $theme || true
${splashutils}/bin/splash_util --tty $tty -c on || true
done
end script
";
}

View file

@ -0,0 +1,16 @@
source $stdenv/setup
ensureDir $out
tar xvfj $theme -C $out
themeName=$(cd $out && ls)
for i in $out/$themeName/config/*.cfg; do
echo "converting $i"
# Rewrite /etc paths. Also, the file names
# config/bootsplash-<RES>.cfg should be <RES>.cfg.
sed "s^/etc/bootsplash/themes^$out^g" < $i > $out/$themeName/$(basename $i | sed 's^.*-^^')
done
rm $out/$themeName/config/*.cfg