glibc: update to 2.41
[openadk.git] / package / base-files / src / etc / network / if-pre-up.d / 05-bonding
blob489a2fcad55e2fd76d7992e0ea81b1d0d935e6f6
1 #!/bin/sh
3 INTERFACES=""
4 BONDOPTS=""
5 for var in $(env | grep '^IF_BOND_'); do
6 val="${var#*=}"
7 opt="${var%%=*}"
8 if [ "$opt" == "IF_BOND_PORTS" ]; then
9 case "$val" in
10 none)
11 INTERFACES=""
14 INTERFACES="$val"
16 esac
17 continue
19 opt="$(tr '[A-Z]' '[a-z]' <<< ${opt#IF_BOND_})"
20 BONDOPTS+=" $opt"
21 [ -n "$val" ] && BONDOPTS+=" $val"
22 done
24 [ -n "$INTERFACES" ] || exit 0
26 ip link add $IFACE type bond ${BONDOPTS} || exit 1
27 for IF in $INTERFACES; do
28 if ! grep -q $IF /proc/net/dev; then
29 echo "Error: interface '$IF' does not exist!"
30 ip link del $IFACE
31 exit 1
33 ip link set $IF master $IFACE
34 ip link set $IF up
35 done
37 exit 0