nixpkgs/upstart-jobs/tty-backgrounds.nix
Eelco Dolstra ab80a34ea4 * Quick workaround for tty-backgrounds not working on Linux 2.6.26:
/proc/sys/kernel/fbcondecor is now suddenly named /proc/sys/fbcondecor.
  Might be a bug.

svn path=/nixos/trunk/; revision=12784
2008-09-02 09:51:44 +00:00

61 lines
1.8 KiB
Nix

{stdenv, splashutils, backgrounds}:
rec {
name = "tty-backgrounds";
unpackTheme = theme: import ../helpers/unpack-theme.nix {
inherit stdenv 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;
};
extraEtc = [
{ source = themesUnpacked;
target = "splash";
}
];
job = ''
start on udev
start script
# Critical: tell the kernel where to find splash_helper. It calls
# this program every time we switch between consoles.
helperProcFile=${splashutils.helperProcFile}
if test -e /proc/sys/fbcondecor; then helperProcFile=/proc/sys/fbcondecor; fi
echo ${splashutils}/${splashutils.helperName} > $helperProcFile
# For each console...
for tty in ${toString (map (x: x.tty) backgrounds)}; do
# Make sure that the console exists.
echo -n "" > /dev/tty$tty
# Set the theme as determined by tty-backgrounds-combine.sh
# above.
theme=$(readlink ${themesUnpacked}/$tty)
${splashutils}/${splashutils.controlName} --tty $tty -c setcfg -t $theme || true
${splashutils}/${splashutils.controlName} --tty $tty -c setpic -t $theme || true
${splashutils}/${splashutils.controlName} --tty $tty -c on || true
done
end script
respawn sleep 10000 # !!! Hack
stop script
# Disable the theme on each console.
for tty in ${toString (map (x: x.tty) backgrounds)}; do
${splashutils}/${splashutils.controlName} --tty $tty -c off || true
done
end script
'';
}