#!/bin/bash
# Example leg hook.
#
# Leg hooks are run with the "start" argument after a leg is added and
# with the "stop" argument before it is removed. For PPP legs, the hook is also
# called when the PPP daemon restarts. For DHCP legs, the hook is also called
# when the lease changes.
#
# Environment variables:
#   ID: the leg ID
#   BOND_ID: the ID of the leg's bond
#   LINK_MODE: the mode of the leg: "idle" or "active"
#   FAILOVER: "True" for failover legs, otherwise "False"
#   TUNNEL_PORT: the tunnel UDP port number
#   UP_SPEED: the upload speed (CPE->agg) in Mbps
#   DOWN_SPEED: the download speed (agg->CPE) in Mbps
#   BANDWIDTH_ADAPTATION: "True" if this leg will lower its speed if latency
#       is detected, otherwise "False"
#   BANDWIDTH_ADAPTATION_LIMIT: 1-99, percent of the configured speed that this
#       link can lower to.
#   MINIMUM_MTU: The minimum possible MTU of the leg, if MTU detection is
#       enabled
#
#   The following fields are mobile broadband leg-specific:
#   IMEI:  the unique 15-digit identifier for the mobile network device.
#   SIM_PIN: the PIN required to access the SIM card.
#   ROAMING: whether the leg is constrained to its home network or not.
#   ACCESS_MODES: list of access modes that the modem can use to connect to the
#       mobile network.
#   RADIO_BANDS: list of radio bands that the modem can use to connect to the
#       mobile network.

start () {
    remove 2> /dev/null
    true
}
stop () {
    remove
}
remove () {
    true
}

# Avoid changing anything below here.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac
