#!/bin/sh user=d startx='startx -- :0 vt7 -dpi 100 -br -nolisten tcp' timeout=1m # sure would be nice if this worked: # let 'NEXTLEVEL >= 2' || exit # opposite of PREVLEVEL # how to find out the runlevel *to be entered*? # the following is not quite right nextlevel() { for x in $(cat /proc/cmdline) $(grep '^id' /etc/inittab | cut -d: -f2); do case "$x" in [sS0-9]) echo $x; return;; esac done echo 0 } [ $(nextlevel) = 2 ] || exit # I've moved these up in /etc/rcS.d # inits='x11-common screen-cleanup console-screen.kbd.sh sudo' # for f in $inits; do # /etc/init.d/$f start # done modprobe psmouse modprobe nvram # for tpb hostname -F /etc/hostname exec >/dev/null 2>/dev/null su - "$user" -c " sleep $timeout & pid=\$! ; STARTXWAIT=\$pid $startx & wait \$pid ; " low-power