#!/bin/bash

# Apply interface specific configurations that are required *before*
# the interface is brought up.

[ -n "$IFACE" ] || exit 1

[ -f /etc/network/iface-"$IFACE".conf ] || exit 0

source /etc/network/iface-"$IFACE".conf

if [ -n "$IFACE_DISABLE_SLAVE_0" ]; then
    [ -f /sys/class/net/"$IFACE"/device/slave-0/disable ] && \
        echo "$IFACE_DISABLE_SLAVE_0" > /sys/class/net/"$IFACE"/device/slave-0/disable
fi

if [ -n "$IFACE_DISABLE_SLAVE_1" ]; then
    [ -f /sys/class/net/"$IFACE"/device/slave-1/disable ] && \
        echo "$IFACE_DISABLE_SLAVE_1" > /sys/class/net/"$IFACE"/device/slave-1/disable
fi

exit 0
