commit c701bdc19dbbee87baf5f5f942cc174d99121f6d Author: Ivan Zakharyaschev Date: Sat Dec 27 03:54:04 2008 +0300 Improved the code: I need to do some things before a wireless iface is UP! It's for iwl3??? and for setting the mode -- see the example (wlan0/iwconfig_prep#TIBET). diff --git a/scripts/config-wireless b/scripts/config-wireless index 62feb52..17be0db 100755 --- a/scripts/config-wireless +++ b/scripts/config-wireless @@ -4,12 +4,16 @@ usage() { - echo "Usage: $0 " >&2 + echo "Usage: $0 [_prep]" >&2 exit 1 } [ -z "$1" ] && usage NAME=$1 +# I need to do some things (setting the mode) before it is UP! +# Suffix _prep is used for calling this stage in ifup-common ("prepare"). +# (The code is general enough for any other stages/variants and resp. suffixes.) +STAGE="$2" pickup_defaults pickup_options @@ -18,14 +22,14 @@ pickup_options # configure private extensions if [ -x "${IWPRIV:=$DEFAULT_IWPRIV}" ]; then - xargise_file $IFACEDIR/default/iwpriv "$IWPRIV $NAME" - xargise_file $MYIFACEDIR/iwpriv "$IWPRIV $NAME" + xargise_file $IFACEDIR/default/iwpriv"$STAGE" "$IWPRIV $NAME" + xargise_file $MYIFACEDIR/iwpriv"$STAGE" "$IWPRIV $NAME" fi # configure WEP if [ -x "${IWCONFIG:=$DEFAULT_IWCONFIG}" ]; then - xargise_file $IFACEDIR/default/iwconfig "$IWCONFIG $NAME" - xargise_file $MYIFACEDIR/iwconfig "$IWCONFIG $NAME" + xargise_file $IFACEDIR/default/iwconfig"$STAGE" "$IWCONFIG $NAME" + xargise_file $MYIFACEDIR/iwconfig"$STAGE" "$IWCONFIG $NAME" fi # configure WPA diff --git a/scripts/ifup-common b/scripts/ifup-common index 5a897f7..93b6b9e 100755 --- a/scripts/ifup-common +++ b/scripts/ifup-common @@ -199,6 +199,14 @@ if ! is_yes $IN_WPA_CLI; then # non-wifi or first pass for wifi xargise_file $IFACEDIR/default/iplink-$TYPE "$IP link set dev $NAME" xargise_file $MYIFACEDIR/iplink "$IP link set dev $NAME" +# handle wireless extensions, if any + if is_yes "$CONFIG_WIRELESS" && is_wireless $NAME; then + $SCRIPTDIR/config-wireless $NAME _prep + rc=$? + [ $rc -eq 2 ] || exit $rc + print_progress + fi + # bring iface up if ! is_yes $KEEP_DOWN; then $IP link set dev $NAME up && print_progress