From e450e4551f98acaa4e5e9a282c57dd68ef17daf2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 Jun 2010 18:30:17 +0000 Subject: [PATCH] * 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 --- modules/tasks/tty-backgrounds-combine.sh | 25 ++++++++++-------------- modules/tasks/tty-backgrounds.nix | 16 ++++++++------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/modules/tasks/tty-backgrounds-combine.sh b/modules/tasks/tty-backgrounds-combine.sh index 66113864f7b8..d7ac3c31c6bd 100644 --- a/modules/tasks/tty-backgrounds-combine.sh +++ b/modules/tasks/tty-backgrounds-combine.sh @@ -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 diff --git a/modules/tasks/tty-backgrounds.nix b/modules/tasks/tty-backgrounds.nix index 5f557ac7f5cb..8ba46e1b6b34 100644 --- a/modules/tasks/tty-backgrounds.nix +++ b/modules/tasks/tty-backgrounds.nix @@ -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