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