From c2c54aabd4647586832c3c2f450346f68d2bba11 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sun, 8 Apr 2012 10:44:17 -0400 Subject: [PATCH] Fedora 16 x86_64 (64bit) support is done --- bin/nvrun | 3 +-- sbin/snail-watcher.sh | 19 +++++++++++++++---- share/init.d/snail-xserver.systemd | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/bin/nvrun b/bin/nvrun index b4e5bce..157ab8e 100755 --- a/bin/nvrun +++ b/bin/nvrun @@ -8,14 +8,13 @@ let INTEL_IF_FAIL=1 # run on Intel if nVidia fails LOCK_FILE=/tmp/.snail.lock FIFO_FILE=/tmp/.snail.fifo - { echo -n > $FIFO_FILE & flock -w $TIMEOUT -s 9 if [ 0 -eq $? ]; then echo "Running $@ on nVidia" - export LD_LIBRARY_PATH=/usr/lib/snail:/usr/lib/snail/lib + export LD_LIBRARY_PATH=/usr/lib/snail snail.vglrun -d :1 "$@" echo "Application $@ was performed on nVidia" diff --git a/sbin/snail-watcher.sh b/sbin/snail-watcher.sh index 7a21eb1..bfb3abb 100755 --- a/sbin/snail-watcher.sh +++ b/sbin/snail-watcher.sh @@ -2,12 +2,23 @@ PATH=/usr/local/sbin:/usr/local/bin:$PATH -SERVICE=/etc/init.d/snail-xserver +XSERVER_START_CMD= +XSERVER_STOP_CMD= +if [ -f /etc/init.d/snail-xserver ]; then + XSERVER_START_CMD="/etc/init.d/snail-xserver start" + XSERVER_STOP_CMD="/etc/init.d/snail-xserver stop" +elif [ -f /etc/systemd/system/snail-xserver.service ]; then + XSERVER_START_CMD="systemctl start snail-xserver.service" + XSERVER_STOP_CMD="systemctl stop snail-xserver.service" +else + echo "Error: snail-xservice not found ;-(" + exit -1 +fi LOCK_FILE=/tmp/.snail.lock FIFO_FILE=/tmp/.snail.fifo -$SERVICE stop && snail.nv_pwr_off # stop X service +$XSERVER_STOP_CMD && snail.nv_pwr_off # stop X service touch $LOCK_FILE && chown root:video $LOCK_FILE && chmod 660 $LOCK_FILE # create lock file rm -f $FIFO_FILE && mkfifo --mode 660 $FIFO_FILE && chgrp video $FIFO_FILE # create fifo @@ -18,10 +29,10 @@ rm -f $FIFO_FILE && mkfifo --mode 660 $FIFO_FILE && chgrp video $FIFO_FILE # cre while [ 1 ]; do read <$FIFO_FILE - snail.nv_pwr_on && $SERVICE start # starting X server + snail.nv_pwr_on && $XSERVER_START_CMD # starting X server flock -u 9 flock 9 echo >$FIFO_FILE | cat $FIFO_FILE >/dev/null # flush fifo - $SERVICE stop && snail.nv_pwr_off # stopping X server + $XSERVER_STOP_CMD && snail.nv_pwr_off # stopping X server done } 9>$LOCK_FILE diff --git a/share/init.d/snail-xserver.systemd b/share/init.d/snail-xserver.systemd index 98bea51..217e9e6 100644 --- a/share/init.d/snail-xserver.systemd +++ b/share/init.d/snail-xserver.systemd @@ -3,6 +3,6 @@ Description=Daemon to auto start/stop power up/down nVidia graphics. After=syslog.target [Service] -ExecStart=/bin/bash -c '(/usr/sbin/snail.nv_pwr_on && nohup /usr/bin/X -ac -config /etc/X11/xorg.conf.nvidia -sharevts -modulepath /usr/lib/snail -nolisten tcp -noreset :1 vt9 &>/dev/null)&' +ExecStart=/bin/bash -c '(nohup /usr/bin/X -ac -config /etc/X11/xorg.conf.nvidia -sharevts -modulepath /usr/lib/snail -nolisten tcp -noreset :1 vt9 &>/dev/null)&' ExecStop=/usr/sbin/snail.nv_pwr_off Type=forking