Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Simple script to ping and then atftp a firmware image e.g. openwrt or dd-wrt

View ping_atftp.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#!/bin/bash
# Simple script to ping and then atftp a firmware image
# Works on my machine and an ASUS WL-500g series router
# Usage: ./ping_atftp 192.168.1.1 openwrt-brcm47xx-squashfs.trx
 
EXPECTED_ARGS=2
if [ $# -ne $EXPECTED_ARGS ]; then
echo "Usage: `basename $0` ip-addr firmware-image"
exit 1;
fi
 
count=50
while [[ $count -ne 0 ]] ; do
ping -w 1 -l 3 -i 0.2 -t 0.01 -c 1 $1
rc=$?
if [[ $rc -eq 0 ]] ; then
count=1
fi
((count=count-1))
done
 
if [[ $rc -eq 0 ]] ; then
echo "The router is online."
atftp -p -l $2 --trace --verbose $1
else
echo "Timeout."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.