#!/bin/sh
set -x

if test -z "${OLPC_RADIO_TESTING_ADHOC_ADDRESS}"; then
    IP=10.1.1.1/24
else
    IP=${OLPC_RADIO_TESTING_ADHOC_ADDRESS}
fi

if test -z "${OLPC_RADIO_TESTING_ADHOC_CHANNEL}"; then
    CHANNEL=10
else
    CHANNEL=${OLPC_RADIO_TESTING_ADHOC_CHANNEL}
fi

iwconfig eth0 mode ad-hoc
until (iwconfig eth0|grep -q -i ad-hoc); do sleep 0.1; done
iwconfig eth0 channel ${CHANNEL} essid ${CHANNEL}.laptop.org
ip addr add ${IP} dev eth0
ip link set eth0 up
