aredn/files/usr/local/bin/reflash

25 lines
331 B
Plaintext
Raw Normal View History

#!/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"
exit 1
fi
mtd write /tmp/*.trx linux
if [ $? != 0 ]; then
echo "ERROR: flash write failed!"
exit
fi
echo "flash written successfully - rebooting"
reboot