OpenSDE Packages Database (without history before r20070)
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.

68 lines
1.5 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../rocknet/rocknet_base.sh
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- T2-COPYRIGHT-NOTE-END ---
  14. if="none"
  15. declare -a auto_if=()
  16. auto_if[0]="*"
  17. public_auto() {
  18. auto_if=()
  19. for x in "$@"; do
  20. a="${x%(*}"; b="${x#*(}"
  21. b="${b/)}"; b="${b//,/ }"
  22. if [ "$a" = "$b" ]; then
  23. auto_if[${#auto_if[*]}]="$a"
  24. else
  25. for x in $b; do
  26. [ "$x" = "$profile" ] && \
  27. auto_if[${#auto_if[*]}]="$a"
  28. done
  29. fi
  30. done
  31. }
  32. public_interface() {
  33. ignore=1 if="${1%(*}"
  34. local prof="${1#*(}"
  35. prof="${prof/)}"; prof="${prof//,/ }"
  36. if [ "$if" = "$prof" ]; then
  37. ignore=0
  38. prof="default"
  39. else
  40. for x in $prof; do
  41. [ "$x" = "$profile" ] && ignore=0
  42. done
  43. [ "$ignore" = 0 ] && pmatched=1
  44. fi
  45. if [ "$ignore" = 0 ]; then
  46. if [ "$interface" = "auto" ]; then
  47. ignore=1
  48. for x in "${auto_if[@]}"; do
  49. [[ "$if" == $x ]] && ignore=0
  50. done
  51. else
  52. [ "$if" = "$interface" ] || ignore=1
  53. fi
  54. fi
  55. if [ "$ignore" = 0 ] ; then
  56. imatched=1
  57. status "Interface / profile matched: $if($prof)"
  58. addcode up 9 9 "register $if\($prof\)"
  59. addcode down 9 9 "unregister $if\($prof\)"
  60. fi
  61. }