source: genesis/tools/flash-ns5m@ 12356

Last change on this file since 12356 was 12356, checked in by rick, 12 years ago

Nanostation automatic configuration script (AP mode only).

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/sh
2#
3# Flash stock nanostation for use in WL network
4#
5# Rick van der Zwet <info@rickvanderzwet.nl>
6#
7DIRNAME=`dirname $0`
8
9# Argument helpers
10if [ -z "$2" ]; then
11 echo "Usage: $0 <node> <iface>"
12 exit 128
13fi
14
15if [ ! -r "fwupdate.bin" ]; then
16 echo "Unable to read fwupdate.bin (download latest firmware file)"
17 exit 1
18fi
19
20HOSTNAME=$1
21NS_IFACE=$2
22
23
24# Create configuration
25$DIRNAME/gformat.py test $HOSTNAME $NS_IFACE-ns5m.conf > system.cfg.new
26if [ $? -ne 0 ]; then
27 echo "Unable to generate configuration file"
28 exit 1
29fi
30
31# Verify connectivity
32ping -c 1 192.168.1.20
33if [ $? -ne 0 ]; then
34 echo "Unable to connect to NanoStation"
35 exit 1
36fi
37
38# Variables needed from Nanostaion, as to be filled into configuration
39MAC=`arp -na | awk '/192.168.1.20/ {print $4}'`
40IFACE=`arp -na | awk '/192.168.1.20/ {print $7}'`
41
42# XXX: Automatically put MAC into configuration
43echo "# MAC of NanoStation is $MAC"
44
45# Flash node
46sshpass -p ubnt scp -oUserKnownHostsFile=/dev/null system.cfg.new fwupdate.bin ubnt@192.168.1.20:/tmp
47sshpass -p ubnt ssh -oUserKnownHostsFile=/dev/null ubnt@192.168.1.20 'cfgmtd -w -f /tmp/system.cfg.new && fwupdate -m'
48
49echo "Ones the leds are off configuration is done"
50
51# TODO: Login on auto-alias IP address to verify
52sudo tcpdump -nn -v -i $IFACE -s 1500 -c 1 'ether[18:4] == 0x000c2000'
53
54`
Note: See TracBrowser for help on using the repository browser.