Advertisement
theroot

g13.sh

Feb 8th, 2013
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.90 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. tmpfile=/tmp/g13.sh.tmp
  4. dlpbm="/usr/local/misc/wtf.lpbm"
  5. drgb="0 50 235"
  6. dmod="15"
  7. binder="/etc/conf.d/g13-binder.conf"
  8.  
  9. . /etc/conf.d/g13.conf
  10.  
  11. function start()
  12. {
  13.  
  14.         chmod 0777 /dev/input/uinput >/dev/null 2>&1
  15.         /usr/local/bin/g13 >/dev/null 2>&1 &
  16.  
  17.         chmod 0777 /tmp/g13-0 >/dev/null 2>&1
  18.         sleep 1.5
  19.  
  20.         echo "rgb ${drgb}" >/tmp/g13-0
  21.         echo "mod ${dmod}" >/tmp/g13-0
  22.  
  23.         sleep 1
  24.         cat ${dlpbm} >/tmp/g13-0
  25.  
  26.         sleep 1
  27.  
  28.         cat ${binder} |grep -v '#' |sed '/^$/d' >${tmpfile}
  29.  
  30.         while read -r line
  31.         do
  32.                 echo "${line}" >/tmp/g13-0
  33.                 sleep 0.1
  34.         done <${tmpfile}
  35.  
  36.         chmod 0777 /tmp/g13-0
  37.  
  38. }
  39.  
  40. function stop()
  41. {
  42.  
  43.         killall g13
  44.  
  45. }
  46.  
  47. case "$1" in
  48.         --start) start;;
  49.         --stop) stop;;
  50.         --restart) stop; sleep 0.5; start;;
  51. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement