Snail/etc/init.d/snail-xserver

34 lines
879 B
Plaintext
Raw Normal View History

2011-12-24 00:15:11 +04:00
#!/sbin/runscript
DAEMON=/usr/bin/X
DAEMON_ARGS="-ac -config /etc/X11/xorg.conf.nvidia -sharevts -modulepath /usr/local/lib/snail -nolisten tcp -noreset :1 vt9"
PIDFILE=/tmp/.X1-lock
depend() {
need xdm
}
start() {
2012-03-24 01:36:51 +04:00
ebegin "Starting Snail nVidia Optimus"
2011-12-24 00:15:11 +04:00
snail.nv_pwr_on || eend -1
! ps -p `cat $PIDFILE 2>&1` > /dev/null 2>&1 || eend -1
export LD_LIBRARY_PATH=/usr/lib/opengl/nvidia/lib:/usr/lib/opengl/nvidia/lib
start-stop-daemon --start --quiet --background --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS
status=$?
2012-03-20 16:46:24 +04:00
# FIXME: remove --background flag and next cycle
2012-02-23 22:33:12 +04:00
let i=300
2012-03-20 16:46:24 +04:00
while [ 0 -lt $i ]; do
[ -f $PIDFILE ] && pgrep -s `cat $PIDFILE` &>/dev/null && break
sleep 0.01
let i--
done
eend $status
2011-12-24 00:15:11 +04:00
}
stop() {
2012-03-24 01:36:51 +04:00
ebegin "Stopping Snail nVidia Optimus"
2011-12-25 02:55:32 +04:00
kill `cat $PIDFILE 2>&1` > /dev/null 2>&1
2011-12-24 00:15:11 +04:00
snail.nv_pwr_off || eend -1
eend $result
}