Snail/etc/init.d/snail

31 lines
840 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() {
ebegin "Starting bumblebee nVidia Optimus"
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-02-23 22:33:12 +04:00
let i=300
while [ 0 -lt $i ]; do snail.nvstat >/dev/null && break; sleep 0.01; let i--; done
2011-12-25 03:45:06 +04:00
(nohup snail.autostop &>/dev/null)&
eend $status
2011-12-24 00:15:11 +04:00
}
stop() {
ebegin "Stopping bumblebee 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
}