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.

55 lines
991 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. prof="default"
  26. else
  27. for x in $prof; do
  28. [ "$x" = "$profile" ] && ignore=0
  29. done
  30. [ "$ignore" = 0 ] && pmatched=1
  31. fi
  32. if [ "$ignore" = 0 ]; then
  33. if [ "$interface" = "auto" ]; then
  34. ignore=1
  35. for x in "${auto_if[@]}"; do
  36. [[ "$if" == $x ]] && ignore=0
  37. done
  38. else
  39. [ "$if" = "$interface" ] || ignore=1
  40. fi
  41. fi
  42. if [ "$ignore" = 0 ] ; then
  43. imatched=1
  44. status "Interface / profile matched: $if($prof)"
  45. addcode up 9 9 "register $if\($prof\)"
  46. addcode down 9 9 "unregister $if\($prof\)"
  47. fi
  48. }