blob: 16cdc668a932ac09045ff982b60632a8e07a647d [file] [log] [blame]
#!/bin/sh
. /etc/utils.sh
# in waveguide itself
register_experiment WifiPrimarySpreading
register_experiment WifiUseActiveTime
register_experiment WifiChannelsLimited2G
register_experiment WifiLowIsHigh
register_experiment WifiUseDFS
# in this file
register_experiment WifiNoBgScans
register_experiment WifiMoreBgScans
case "$1" in
start)
# TODO(awdavies): For now we want to avoid running more daemons on MN than
# we need to. This is until we've fixed our RAM woes.
if is-windcharger; then
exit 1
fi
if is-network-box; then
YES=1
HP=--high-power
elif has_wifi && runnable iw; then
YES=1
HP=--no-high-power
fi
if is-tv-box; then
TB=--tv-box
else
unset TB
fi
if experiment WifiNoBgScans; then
SI=--scan-interval=0
elif experiment WifiMoreBgScans; then
SI=--scan-interval=30
else
SI=--scan-interval=300
fi
if [ -n "$YES" ]; then
mkdir -p /tmp/waveguide
supernice babysit 60 alivemonitor /tmp/waveguide/alive 10 10 600 \
waveguide "$HP" "$SI" "$TB" 2>&1 | logos waveguide &
fi
;;
stop)
pkillwait waveguide
;;
restart)
$0 stop; $0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac