mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
843 B

  1. #!/bin/bash
  2. #
  3. # Example for ROCKNET profile auto-detection.
  4. # on default do nothing
  5. exit 0
  6. echo -n "Trying to auto-detect network profile .. "
  7. echo default > /etc/network/profile
  8. # we need to activate the interfaces for the test
  9. ip l set eth0 up &> /dev/null
  10. ip l set eth1 up &> /dev/null
  11. # use arping to check for a well-known IPs
  12. (
  13. if arping -i eth0 -c3 10.0.23.42; then
  14. echo foo > /etc/network/profile
  15. fi
  16. ) &> /dev/null &
  17. # maybe we have found that essid
  18. (
  19. sleep 2 # give it some time to get the essid
  20. if iwlist eth1 scan | grep -q 'ESSID:"MyWLAN"'; then
  21. echo bar > /etc/network/profile
  22. fi
  23. ) &> /dev/null &
  24. # wait for all childs to finish, output found profile
  25. wait; cat /etc/network/profile
  26. # deactivate the interfaces, the profile might activate them again
  27. ip l set eth0 down &> /dev/null
  28. ip l set eth1 down &> /dev/null