1 |
#!/bin/sh |
2 |
|
3 |
tftp=/srv/tftp/ |
4 |
tmp=/tmp/tftp |
5 |
fw_info=bin/fw-info.pl |
6 |
|
7 |
#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 |
$fw_info $tftp/ 2>/dev/null | sort -k 2,1 -n | sed -e "s!$tftp/*!!" > $tmp.all |
9 |
|
10 |
echo -e "Currently selected version for flash:\n" > $tmp |
11 |
|
12 |
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` |
24 |
board=`echo $which | cut -d" " -f2` |
25 |
path=`echo $which | cut -c32-` |
26 |
|
27 |
ln -sf $tftp/$path $tftp/$board || exit |
28 |
|
29 |
echo "Using $path for $board [$version]" |
30 |
|