Changeset 687

Show
Ignore:
Timestamp:
09/24/06 03:01:06 (2 years ago)
Author:
tg
Message:

determine type of board from the file name

"fix it if you can" wbx@

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freewrt/scripts/flash.sh

    • Property svn:keywords set to Id
    r621 r687  
    1 #!/usr/bin/env bash 
     1#!/bin/sh 
     2# $Id$ 
    23# 
    34# tftp flash script for wireless routers 
    45# 
     6# Copyright (c) 2006 by Thorsten Glaser <tg@mirbsd.de> 
     7# Copyright (C) 2006 by Waldemar Brodkorb <wbx@freewrt.org> 
    58# Copyright (C) 2004 by Oleg I. Vdovikin <oleg@cs.msu.su> 
    6 # Copyright (C) 2006 by Waldemar Brodkorb <wbx@freewrt.org> 
    79# 
    810# This program is free software; you can redistribute it and/or modify 
     
    1820# You should have received a copy of the GNU General Public License 
    1921# along with this program; if not, write to the Free Software 
    20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     22# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA 
    2123 
    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 
     24usage() { 
     25        cat <<EOF 
     26Usage: $0 firmware.bin 
     27 
     28The 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 
    3033 
    3134IMPORTANT: 
     
    3942   it again, then release button) 
    4043 
    41 1) connect your pc to the LAN port 
     441) connect your PC to the LAN port 
    42452) be sure your link is up and has an address in the 
    43    192.168.1.0/24 address range (and not the 192.168.1.1) 
     46   192.168.1.0/24 address range (other than 192.168.1.1) 
    4447 
    4548EOF 
    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 
     52file=${1:-/nonexistant} 
     53 
     54test -s "$file" || usage 
     55 
     56case $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        ;; 
     79esac 
    6480echo After that you can login via: ssh admin@192.168.1.1 
    6581echo Default password, unless changed in menuconfig, is: FreeWRT