Advertisement
Guest User

Untitled

a guest
Jun 30th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. !/bin/sh /etc/rc.common
  2.  
  3. START=19
  4.  
  5. start(){
  6.  
  7. model=$(awk 'BEGIN{FS="-"} /machine/ {print tolower($2)}' /proc/cpuinfo)
  8. switch_left=
  9. switch_disabled="0"
  10.  
  11. case "$model" in
  12. "ar150")
  13. switch_left=$(grep -o "BTN_8.*hi" /sys/kernel/debug/gpio)
  14. ;;
  15. "ar300m")
  16. switch_left=$(grep -o "button left.*hi" /sys/kernel/debug/gpio)
  17. ;;
  18. "mt300a")
  19. switch_left=$(grep -o "BTN_1.*hi" /sys/kernel/debug/gpio)
  20. ;;
  21. "mt300n")
  22. switch_left=$(grep -o "BTN_0.*hi" /sys/kernel/debug/gpio)
  23. ;;
  24. "connect inet v1" | \
  25. "ar300" | \
  26. "mt750" )
  27. switch_disabled="1"
  28. ;;
  29. esac
  30.  
  31. #if switch is on 0
  32. if [ "$switch_disabled" = "1" ]; then
  33. exit 0
  34. fi
  35.  
  36. if [ -n "$switch_left" ]; then
  37. uci set firewall.internet.src='nothing'
  38. uci set glconfig.tor.disabled='0'
  39. uci set firewall.tor.input='REJECT'
  40. else
  41. uci set firewall.internet.src='tor'
  42. uci set glconfig.tor.disabled='1'
  43. uci set firewall.tor.input='ACCEPT'
  44. fi
  45.  
  46. uci commit glconfig
  47. uci commit firewall
  48. uci commit system
  49. /etc/init.d/firewall restart
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement