* updated krdc (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / network / rocknet / ifswitch.sh
blob5a6aada9d298d04bae2a58b227e3f668de56851f
1 #!/bin/bash
3 set -e
5 active=$( cat /var/run/rocknet/active-interfaces 2>/dev/null || true )
7 if [ $# -eq 0 ]; then
8 echo "Usage $0 [ interface profile ] | [ profile ]"
9 exit
12 i=0
13 for x in ${active//,/ }; do
14 [ $(( i++ )) -eq 0 ] && echo "Deactivating current interfaces ..."
15 if=${x/(*)/}
16 profile=${x/*(/}; profile=${profile%)}
17 ifdown $if $profile
18 done
20 echo "Activating specified profile/interfaces ..."
22 if [ $# -eq 1 ]; then
23 rocknet $1 auto up
24 else
25 ifup $1 $2