#!/bin/sh
N=`ls /tmp/*.trx 2>/dev/null | wc -l`
if [ $N == 0 ]; then
echo "no image to flash"
exit 1
fi
if [ $N -gt 1 ]; then
echo "more than one image found"
mtd write /tmp/*.trx firmware
if [ $? != 0 ]; then
echo "ERROR: flash write failed!"
exit
echo "flash written successfully - rebooting"
reboot