#!/bin/bash
# Entry point for net-failover.service. Reads mode from config.yml
# and hands off to eth-failover.sh or wifi-failover.sh.

. /usr/lib/net-failover/common.sh

LIB_DIR=/usr/lib/net-failover

MODE=$(cfg_get mode)

case "$MODE" in
  eth|wifi) ;;
  *)
    log "bad or missing mode '$MODE' in $CONFIG, defaulting to eth"
    MODE=eth
    ;;
esac

log "mode=$MODE, starting $MODE-failover.sh"
exec "$LIB_DIR/$MODE-failover.sh"
