/[mdap]/tftp-iselect.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /tftp-iselect.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 75 by dpavlin, Fri Nov 16 14:44:37 2007 UTC revision 76 by dpavlin, Sun Nov 18 15:20:16 2007 UTC
# Line 2  Line 2 
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  

Legend:
Removed from v.75  
changed lines
  Added in v.76

  ViewVC Help
Powered by ViewVC 1.1.26