1#!/bin/bash
2
3DIR=$1
4CONF=$2
5if [ -z "$DIR" -o -z "$CONF" ]; then
6    echo "usage: $0 <DIR> <CONF>"
7    exit 1
8fi
9if [ ! -d "$DIR" ]; then
10   echo "DIR does not exist: $DIR"
11   exit 1
12fi
13if [ ! -r "$CONF" ]; then
14   echo "CONF does not exist: $CONF"
15   exit 1
16fi
17
18NAME=`echo $CONF | sed s/^build-wpa_supplicant-// | sed s/\.config$//`
19echo -n "wpa_supplicant build: $NAME - "
20
21pushd $DIR > /dev/null
22rm -rf hostap-build
23tar xf hostap-build.tar
24popd > /dev/null
25cp $CONF $DIR/hostap-build/wpa_supplicant/.config
26
27pushd $DIR/hostap-build/wpa_supplicant > /dev/null
28if make -j8 > $DIR/wpa_supplicant-$NAME.log 2>&1; then
29    mv $DIR/wpa_supplicant-$NAME.log{,-OK}
30    echo OK
31else
32    mv $DIR/wpa_supplicant-$NAME.log{,-FAIL}
33    echo FAIL
34fi
35rm -rf $DIR/hostap-build
36popd > /dev/null
37