| 22 | | if [ -z "$1" ] || [ ! -f $1 ] || [ -z $2 ]; then |
|---|
| 23 | | echo Usage: $0 firmware model |
|---|
| 24 | | cat << EOF |
|---|
| 25 | | Following models are supported: |
|---|
| 26 | | asus_wl500g - Asus WL500g |
|---|
| 27 | | asus_wl500gd - Asus WL500g Deluxe |
|---|
| 28 | | asus_wl500gp - Asus WL500g Premium |
|---|
| 29 | | linksys - All Linksys models |
|---|
| | 24 | usage() { |
|---|
| | 25 | cat <<EOF |
|---|
| | 26 | Usage: $0 firmware.bin |
|---|
| | 27 | |
|---|
| | 28 | The following models are supported: |
|---|
| | 29 | asus-wl500g - Asus WL500g |
|---|
| | 30 | asus-wl500g-deluxe - Asus WL500g Deluxe |
|---|
| | 31 | asus-wl500g-premium - Asus WL500g Premium |
|---|
| | 32 | linksys - All Linksys models |
|---|
| 46 | | exit 0 |
|---|
| 47 | | fi |
|---|
| 48 | | if [ "$2" == "asus_wl500g" ]; then |
|---|
| 49 | | echo Confirming IP address setting... |
|---|
| 50 | | echo -en "get ASUSSPACELINK\x01\x01\xa8\xc0 /dev/null\nquit\n" | tftp 192.168.1.1 |
|---|
| 51 | | echo Flashing 192.168.1.1 using $1... |
|---|
| 52 | | echo -en "binary\nput $1 ASUSSPACELINK\nquit\n" | tftp 192.168.1.1 |
|---|
| 53 | | echo Please wait until leds stops flashing. Device will automatically reboot. |
|---|
| 54 | | elif [ "$2" == "asus_wl500gd" -o "$2" == "asus_wl500gp" ]; then |
|---|
| 55 | | echo Flashing 192.168.1.1 using $1... |
|---|
| 56 | | echo -en "rexmt 1\ntrace\nbinary\nput $1\nquit\n" | tftp 192.168.1.1 |
|---|
| 57 | | echo Please wait 5-7 minutes and then remove the power. |
|---|
| 58 | | echo This device does not reboot automatically after flashing. |
|---|
| 59 | | else |
|---|
| 60 | | echo Flashing 192.168.1.1 using $1... |
|---|
| 61 | | echo -en "rexmt 1\ntrace\nbinary\nput $1\nquit\n" | tftp 192.168.1.1 |
|---|
| 62 | | echo Unit will automatically reboot within 3-7 minutes. Do not power off. |
|---|
| 63 | | fi |
|---|
| | 49 | exit 1 |
|---|
| | 50 | } |
|---|
| | 51 | |
|---|
| | 52 | file=${1:-/nonexistant} |
|---|
| | 53 | |
|---|
| | 54 | test -s "$file" || usage |
|---|
| | 55 | |
|---|
| | 56 | case $file in |
|---|
| | 57 | *-asus-wl500g-*.bin) |
|---|
| | 58 | echo Confirming IP address setting... |
|---|
| | 59 | echo -en "get ASUSSPACELINK\x01\x01\xa8\xc0 /dev/null\nquit\n" | tftp 192.168.1.1 |
|---|
| | 60 | echo Flashing 192.168.1.1 using "$file"... |
|---|
| | 61 | echo -en "binary\nput $file ASUSSPACELINK\nquit\n" | tftp 192.168.1.1 |
|---|
| | 62 | echo Please wait until leds stops flashing. Device will automatically reboot. |
|---|
| | 63 | ;; |
|---|
| | 64 | *-asus-wl500g-deluxe-*.bin | *-asus-wl500g-premium-*.bin) |
|---|
| | 65 | echo Flashing 192.168.1.1 using "$file"... |
|---|
| | 66 | echo -en "rexmt 1\ntrace\nbinary\nput $file\nquit\n" | tftp 192.168.1.1 |
|---|
| | 67 | echo Please wait 5-7 minutes and then remove the power. |
|---|
| | 68 | echo This device does not reboot automatically after flashing. |
|---|
| | 69 | ;; |
|---|
| | 70 | *-linksys-*.bin) |
|---|
| | 71 | echo Flashing 192.168.1.1 using "$file"... |
|---|
| | 72 | echo -en "rexmt 1\ntrace\nbinary\nput $file\nquit\n" | tftp 192.168.1.1 |
|---|
| | 73 | echo Unit will automatically reboot within 3-7 minutes. Do not power off. |
|---|
| | 74 | ;; |
|---|
| | 75 | *) |
|---|
| | 76 | echo Unsupported model "'$file'" |
|---|
| | 77 | usage |
|---|
| | 78 | ;; |
|---|
| | 79 | esac |
|---|