2 |
|
|
3 |
tftp=/srv/tftp/ |
tftp=/srv/tftp/ |
4 |
tmp=/tmp/tftp |
tmp=/tmp/tftp |
5 |
fw_info=./fw-info.pl |
fw_info=bin/fw-info.pl |
6 |
|
|
7 |
echo "Select firmware image to flash: " > $tmp |
#which=`find $tftp -type f | xargs -i $fw_info {} 2>/dev/null | sort | sed -e "s!$tftp!!" -e 's!^!<s>!' -e 's!^<s>\(.* BANT-R\)!\1!' | iselect -c -n "Select firmware file"` |
8 |
echo > $tmp |
$fw_info $tftp/ 2>/dev/null | sort -k 2,1 -n | sed -e "s!$tftp/*!!" > $tmp.all |
9 |
|
|
10 |
which=`find $tftp -type f | xargs -i $fw_info {} 2>/dev/null | sort | sed -e "s!$tftp!!" -e 's!^!<s>!' -e 's!^<s>\(.* BANT-R\)!\1!' | iselect -c -n "Select firmware file"` |
echo -e "Currently selected version for flash:\n" > $tmp |
11 |
|
|
12 |
test -z "$which" && exit |
grep " BANT-" $tmp.all > $tmp.selected |
13 |
|
cat $tmp.selected >> $tmp |
14 |
|
|
15 |
|
echo -e "\nAll versions available:\n" >> $tmp |
16 |
|
|
17 |
|
grep -v -f $tmp.selected $tmp.all | sed -e 's!^!<s>!' >> $tmp |
18 |
|
|
19 |
|
which=`iselect -c -n "Select firmware" < $tmp` |
20 |
|
|
21 |
|
test -z "$which" && echo "No change" && exit |
22 |
|
|
23 |
version=`echo $which | cut -d" " -f1` |
version=`echo $which | cut -d" " -f1` |
24 |
path=`echo $which | cut -d" " -f2-` |
board=`echo $which | cut -d" " -f2` |
25 |
|
path=`echo $which | cut -c32-` |
26 |
|
|
27 |
echo "Using $path [$version]" |
ln -sf $tftp/$path $tftp/$board || exit |
28 |
|
|
29 |
cp $tftp/$path $tftp/BANT-R.new && mv $tftp/BANT-R.new $tftp/BANT-R |
echo "Using $path for $board [$version]" |
30 |
|
|
|
rm $tmp |
|