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.

54 lines
974 B

  1. if="none"
  2. declare -a auto_if=()
  3. auto_if[0]="*"
  4. public_auto() {
  5. auto_if=()
  6. for x in "$@"; do
  7. a="${x%(*}"; b="${x#*(}"
  8. b="${b/)}"; b="${b//,/ }"
  9. if [ "$a" = "$b" ]; then
  10. auto_if[${#auto_if[*]}]="$a"
  11. else
  12. for x in $b; do
  13. [ "$x" = "$profile" ] && \
  14. auto_if[${#auto_if[*]}]="$a"
  15. done
  16. fi
  17. done
  18. }
  19. public_interface() {
  20. ignore=1 if="${1%(*}"
  21. local prof="${1#*(}"
  22. prof="${prof/)}"; prof="${prof//,/ }"
  23. if [ "$if" = "$prof" ]; then
  24. ignore=0
  25. else
  26. for x in $prof; do
  27. [ "$x" = "$profile" ] && ignore=0
  28. done
  29. [ "$ignore" = 0 ] && pmatched=1
  30. fi
  31. if [ "$ignore" = 0 ]; then
  32. if [ "$interface" = "auto" ]; then
  33. ignore=1
  34. for x in "${auto_if[@]}"; do
  35. [[ "$if" == $x ]] && ignore=0
  36. done
  37. else
  38. [ "$if" = "$interface" ] || ignore=1
  39. fi
  40. fi
  41. if [ "$ignore" = 0 ] ; then
  42. imatched=1
  43. status "Interface / profile matched: $if($prof)"
  44. addcode up 9 9 "register $if\($prof\)"
  45. addcode down 9 9 "unregister $if\($prof\)"
  46. fi
  47. }