blob: 75751dc0ea5efb3d4fef5d157948ad4a9cb65bd3 [file] [log] [blame]
#!/bin/sh
. /etc/utils.sh
# When booting over NFS, don't mess with interfaces or we could lose our NFS
# connection.
# TODO(apenwarr): remove this when ipapply is fixed.
# Right now, it flushes all routes before reapplying them, which breaks NFS.
# If we fixed that, then it's clear that the NFS interface should always be
# up, which means its route should stay around even if ipapply is asked to
# re-check it.
if [ -e /tmp/NFS ]; then
exit 0
fi
INTERFACES=
APIMODE=
if is-fiberjack; then
INTERFACES="pon0"
elif is-spacecast; then
INTERFACES="lan0"
elif is-network-box; then
INTERFACES="wan0"
APIMODE="--api-mode=iff"
# Initialize to the down state.
/etc/ifplugd/ifplugd.action wan0 down
elif is-wireless-client; then
INTERFACES="eth0 wcli0 wcli1"
APIMODE="--api-mode=iff"
mkdir -p /tmp/conman/interfaces
fi
start()
{
for IFNAME in $INTERFACES; do
if interface_exists $IFNAME; then
babysit 60 ifplugd $APIMODE -i $IFNAME -n -s -f -I -q -d0 2>&1 | logos "ifplugd-$IFNAME" &
fi
done
}
stop()
{
for IFNAME in $INTERFACES; do
ifplugd -k -W -i $IFNAME
done
pkill ifplugd.action
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
sleep)
sleep 60
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0