AppRun 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/sh
  2. #100228 BK support default network tool.
  3. #100325 BK support Simple Network Setup.
  4. #16aug10 shinobar: netchoice. BK: but only if defaultconnect still set to 'exec connectwizard'.
  5. #110505 support sudo for non-root user.
  6. #130104 rerwin: add frisbee
  7. #130117 rerwin: remove redundant CURREXEC test, per shinobar
  8. [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
  9. CURREXEC="`cat /usr/local/bin/defaultconnect | tail -n 1 | tr -s " " | cut -f 2 -d " "`"
  10. [ "`grep 'gprs' /usr/local/bin/defaultconnect`" != "" ] && CURREXEC='pgprs-connect'
  11. [ "$CURREXEC" = "gkdial" ] && CURREXEC="pupdial" #for older pups.
  12. #16aug10 shinobar: netchoice... same code in rc.init
  13. if [ "$CURREXEC" = "connectwizard" ];then #BK
  14. NETCHOICE=""
  15. #try determine which tool was used to setup networking...
  16. if [ -s /etc/simple_network_setup/connections ];then #100306
  17. NETCHOICE='sns'
  18. else
  19. CHECKOLDWIZ="`ls -1 /etc/*[0-9]mode 2>/dev/null`" #ex: eth0mode, wlan0mode.
  20. if [ "$CHECKOLDWIZ" != "" -a -d /usr/local/net_setup ];then
  21. NETCHOICE='net_wiz_classic'
  22. else
  23. CHECKNEWWIZ="`ls -1 /etc/network-wizard/network/interfaces 2>/dev/null`"
  24. if [ "$CHECKNEWWIZ" != "" ];then
  25. NETCHOICE='net-setup.sh'
  26. else
  27. CHECKFRISBEE="`ls -1 /etc/frisbee/interfaces 2>/dev/null`" #130104...
  28. if [ "$CHECKFRISBEE" != "" ];then
  29. NETCHOICE='frisbee'
  30. else #130104 end
  31. [ -f /usr/local/Pwireless2/interface ] && NETCHOICE='Pwireless2' #100304
  32. fi
  33. fi
  34. fi
  35. fi
  36. [ "$NETCHOICE" != "" ] && CURREXEC="$NETCHOICE"
  37. fi
  38. #16aug10 shinobar: end
  39. RUNMODE="$1"
  40. case $RUNMODE in
  41. --wizard) exec /usr/sbin/connectwizard 1>&2 ;;
  42. --connect)
  43. case $CURREXEC in #connect using default tool.
  44. net-setup.sh) exec /etc/rc.d/rc.network connect 1>&2 ;; #Dougal.
  45. pgprs-connect) pppd call gprs-disconnect-chatmm; killall pppd; pgprs-connect ;; #guessing, i need help here.
  46. pupdial) pupdial ;;
  47. pppoe_gui) pppoe_gui ;;
  48. connectwizard) connectwizard ;;
  49. Pwireless2) Pwireless2 ;;
  50. net_wiz_classic) net_wiz_classic ;;
  51. sns) /usr/local/simple_network_setup/rc.network ;;
  52. frisbee) [ -f /usr/local/bin/frisbee ] && /usr/local/frisbee/connect ;; #130104
  53. esac
  54. ;;
  55. --disconnect) #disconnect using default tool.
  56. case $CURREXEC in
  57. net-setup.sh) exec /etc/rc.d/rc.network stop 1>&2 ;; #Dougal.
  58. pgprs-connect) pppd call gprs-disconnect-chatmm; killall pppd ;; #guessing, i need help here.
  59. pupdial) killall wvdial; killall pppd ;;
  60. pppoe_gui) pppoe_gui ;;
  61. connectwizard) connectwizard ;;
  62. Pwireless2) Pwireless2 ;;
  63. net_wiz_classic) net_wiz_classic ;;
  64. sns) /usr/local/simple_network_setup/rc.network stop ;;
  65. frisbee) [ -f /usr/local/bin/frisbee ] && /usr/local/frisbee/disconnect ;; #130104
  66. esac
  67. ;;
  68. *) exec /usr/local/bin/defaultconnect 1>&2 ;;
  69. esac
  70. ###END###