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.

46 lines
756 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. fi
  30. if [ "$ignore" = 0 ]; then
  31. if [ "$interface" = "auto" ]; then
  32. ignore=1
  33. for x in "${auto_if[@]}"; do
  34. [[ "$if" == $x ]] && ignore=0
  35. done
  36. else
  37. [ "$if" = "$interface" ] || ignore=1
  38. fi
  39. fi
  40. }