* tty-backgrounds: don't do a setcfg action on the console if the

current theme is the same.  This prevents the console from being
  blanked during boot.

svn path=/nixos/trunk/; revision=22092
This commit is contained in:
Eelco Dolstra 2010-06-01 18:30:17 +00:00
parent 18fd0a61de
commit e450e4551f
2 changed files with 19 additions and 22 deletions

View File

@ -5,27 +5,23 @@ themes=($themes)
ensureDir $out
default=
defaultName=$(cd $default && ls | grep -v default)
echo $defaultName
ln -s $default/default $out/default
ln -s $defaultName $out/$defaultName
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 | grep -v default)
ln -sfn $theme/$themeName $out/$themeName
if [ "$theme" != default ]; then
themeName=$(cd $theme && ls | grep -v default)
ln -sfn $theme/$themeName $out/$themeName
else
themeName=default
fi
if test -e $out/$tty; then
echo "Multiple themes defined for the same TTY!"
@ -33,5 +29,4 @@ for ((n = 0; n < ${#ttys[*]}; n++)); do
fi
ln -sfn $themeName $out/$tty
done

View File

@ -24,18 +24,15 @@ let
filter (x: !(elem x overridenTTYs)) requiredTTYs;
in
(map (tty: {
inherit tty;
theme = config.services.ttyBackgrounds.defaultTheme;
}) defaultTTYs)
++ specificThemes;
(map (tty: { inherit tty; }) defaultTTYs) ++ specificThemes;
themesUnpacked = stdenv.mkDerivation {
name = "splash-themes";
builder = ./tty-backgrounds-combine.sh;
default = unpackTheme config.services.ttyBackgrounds.defaultTheme;
# !!! Should use XML here.
ttys = map (x: x.tty) backgrounds;
themes = map (x: if x ? theme then (unpackTheme x.theme) else "default") backgrounds;
themes = map (x: if x ? theme then unpackTheme x.theme else "default") backgrounds;
};
unpackTheme = theme: import ../../lib/unpack-theme.nix {
@ -124,7 +121,12 @@ in
# above. Note that splashutils needs a TTY number
# instead of a device name, hence the ''${tty:3}.
theme=$(readlink ${themesUnpacked}/$tty)
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setcfg -t $theme || true
prevTheme=$(${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c getcfg |
sed 's/theme: *\(.*\)/\1/;t;d' || true)
echo $tty $theme $prevTheme
if [ "$theme" != "$prevTheme" ]; then
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setcfg -t $theme || true
fi
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setpic -t $theme || true
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c on || true
done