|
Last change
on this file since 12356 was 12356, checked in by rick, 13 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 | #
|
|---|
| 7 | DIRNAME=`dirname $0`
|
|---|
| 8 |
|
|---|
| 9 | # Argument helpers
|
|---|
| 10 | if [ -z "$2" ]; then
|
|---|
| 11 | echo "Usage: $0 <node> <iface>"
|
|---|
| 12 | exit 128
|
|---|
| 13 | fi
|
|---|
| 14 |
|
|---|
| 15 | if [ ! -r "fwupdate.bin" ]; then
|
|---|
| 16 | echo "Unable to read fwupdate.bin (download latest firmware file)"
|
|---|
| 17 | exit 1
|
|---|
| 18 | fi
|
|---|
| 19 |
|
|---|
| 20 | HOSTNAME=$1
|
|---|
| 21 | NS_IFACE=$2
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | # Create configuration
|
|---|
| 25 | $DIRNAME/gformat.py test $HOSTNAME $NS_IFACE-ns5m.conf > system.cfg.new
|
|---|
| 26 | if [ $? -ne 0 ]; then
|
|---|
| 27 | echo "Unable to generate configuration file"
|
|---|
| 28 | exit 1
|
|---|
| 29 | fi
|
|---|
| 30 |
|
|---|
| 31 | # Verify connectivity
|
|---|
| 32 | ping -c 1 192.168.1.20
|
|---|
| 33 | if [ $? -ne 0 ]; then
|
|---|
| 34 | echo "Unable to connect to NanoStation"
|
|---|
| 35 | exit 1
|
|---|
| 36 | fi
|
|---|
| 37 |
|
|---|
| 38 | # Variables needed from Nanostaion, as to be filled into configuration
|
|---|
| 39 | MAC=`arp -na | awk '/192.168.1.20/ {print $4}'`
|
|---|
| 40 | IFACE=`arp -na | awk '/192.168.1.20/ {print $7}'`
|
|---|
| 41 |
|
|---|
| 42 | # XXX: Automatically put MAC into configuration
|
|---|
| 43 | echo "# MAC of NanoStation is $MAC"
|
|---|
| 44 |
|
|---|
| 45 | # Flash node
|
|---|
| 46 | sshpass -p ubnt scp -oUserKnownHostsFile=/dev/null system.cfg.new fwupdate.bin ubnt@192.168.1.20:/tmp
|
|---|
| 47 | sshpass -p ubnt ssh -oUserKnownHostsFile=/dev/null ubnt@192.168.1.20 'cfgmtd -w -f /tmp/system.cfg.new && fwupdate -m'
|
|---|
| 48 |
|
|---|
| 49 | echo "Ones the leds are off configuration is done"
|
|---|
| 50 |
|
|---|
| 51 | # TODO: Login on auto-alias IP address to verify
|
|---|
| 52 | sudo 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.