2009. május 18., hétfő

# OpenWrt #0 - Flash the Firmware


#!/bin/bash
# tested on ASUS WL 500 GPv2 [OpenWrt Kamikaze 8.09]

clear
echo "It will take 7 easy steps: "
echo "1/7: To run this script, you have to be root. If you aren't then press Ctrl+C. If you have root privileges, press any key."
read
clear

echo '2/7: If you have internet connection press any key [I want to download the firmware].'
read
wget --timeout 10 --tries=2 "http://downloads.openwrt.org/kamikaze/8.09.1/brcm-2.4/openwrt-brcm-2.4-squashfs.trx"
echo "--------------------"
echo "Press Ctrl+C if it didnt download the firmware..."
read
clear

echo "3/7: If you have internet connection press any key [I want to install atftp on you're PC]."
read
apt-get install -fy --force-yes atftp
echo "--------------------"
echo "Press Ctrl+C if it didnt find the package from you're repository..."
read
clear

echo "4/7: Now unplug you're MODEM from the router, then press any key."
read
clear

echo "5/7: Put you're OpenWrt router in DIAGNOSTIC mode, then press any key. "
echo
echo "Make sure you're IP is eg.: 192.168.1.5, and you're gateway is 192.168.1.1"
echo "And don't forget to check that atftp isn't blocked by a firewall, then press any key."
read
atftp --trace --option "timeout 1" --option "mode octet" --put --local-file openwrt-brcm-2.4-squashfs.trx 192.168.1.1
clear
for i in {1..180}; do sleep 1; clear; echo "[$i/180 sec...] Please wait... meanwhile you can set you're connection back to DHCP."; done
clear

echo "6/7: ...OK! Please turn OFF then turn ON the router, then press any key."
read
clear
for i in {1..50}; do sleep 1; clear; echo "[$i/50 sec...] Waiting for router to boot... Please wait..."; done
dhclient
clear

echo '7/7: ...Now I will telnet the router then you MUST CHANGE the password ["passwd root" command], then reboot it [with the "reboot" command]!!!'
echo "After you changed the root password and rebooted the router, were done! Bye."
echo 'If a "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" sign appear, when you want to SSH to the router, then you need to delete eg.: the "~/.ssh/" dir... '
echo "--------------------"
echo
telnet 192.168.1.1

ui.: ASUS WL 500 GPv2 -n lett tesztelve, mert az van a kezemben, de azért lehetne mást is választanih... [pl.: a v2-ből én FTP-n tudtam max kihozni 3 MByte/sec-et...]
ui2.: ha nem lenne elérhető flashelés után, akkor link

Nincsenek megjegyzések:

Megjegyzés küldése