Skip to content

Instantly share code, notes, and snippets.

@padde
Created April 1, 2012 18:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save padde/2277538 to your computer and use it in GitHub Desktop.
Save padde/2277538 to your computer and use it in GitHub Desktop.
Install Tomato Firmware via TFTP from *NIX system
#!/bin/bash
echo "==================================================================="
echo "This bash script will upload tomato.trx in the current directory to"
echo "192.168.11.1 during the router's bootup."
echo
echo "* Set your ethernet card's settings to:"
echo " IP: 192.168.11.2"
echo " Mask: 255.255.255.0"
echo " Gateway: 192.168.11.1."
echo
echo "* Unplug the router's power cable."
echo " Press Ctrl+C to abort or any other key to continue..."
read
echo "* Re-plug the router's power cable."
echo "==================================================================="
echo
echo "Waiting for the router... Press Ctrl+C to abort."
ROUTER_IP='192.168.11.1'
ret=""
while [ -z "$ret" ]; do
ret=$( ping -c 1 -W 50 $ROUTER_IP | grep ttl )
echo -n '.'
done
echo
if [ -n "$ret" ]; then
echo 'Uploading firmware via tftp...'
echo 'put tomato.trx' | tftp $ROUTER_IP
echo
echo "==================================================================="
echo "* WAIT for about 2 minutes while the firmware is being flashed."
echo
echo "* Reset your ethernet card's settings back to DHCP."
echo
echo "* The default router address will be at 192.168.1.1."
else
echo 'Upload failed!'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment