pupautodetect 650 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. #Barry Kauler, Oct. 2011
  3. #called via udev /etc/udev/rules.d/88-puppy-autodetect.rules
  4. #111007 first release.
  5. #111010 maybe wait until delayedrun has done its stuff.
  6. [ ! $1 ] && exit
  7. [ "`pidof X`" == "" ] && exit #X not running.
  8. export PATH='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/root/my-applications/bin'
  9. export DISPLAY=':0'
  10. #111010 maybe wait until delayedrun has done its stuff...
  11. EXCNT=0
  12. while [ ! -f /tmp/delayedrun_finished_flag ];do #see /usr/sbin/delayedrun.
  13. sleep 2
  14. EXCNT=$(($EXCNT + 1))
  15. [ $EXCNT -gt 10 ] && break #precaution
  16. done
  17. case $1 in
  18. camera)
  19. pupcamera &
  20. ;;
  21. android-device)
  22. mtpdevice mount &
  23. ;;
  24. esac