/[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

Annotation of /tftp-iselect.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 77 - (hide annotations)
Sun Nov 18 15:27:37 2007 UTC (16 years, 5 months ago) by dpavlin
File MIME type: application/x-sh
File size: 874 byte(s)
 r116@brr:  dpavlin | 2007-11-18 16:27:32 +0100
 fix firmware filename parsing by using fixed number of chars (yak!)

1 dpavlin 22 #!/bin/sh
2    
3     tftp=/srv/tftp/
4     tmp=/tmp/tftp
5 dpavlin 76 fw_info=bin/fw-info.pl
6 dpavlin 22
7 dpavlin 76 #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 dpavlin 22
10 dpavlin 76 echo -e "Currently selected version for flash:\n" > $tmp
11 dpavlin 22
12 dpavlin 77 grep " BANT-.$" $tmp.all > $tmp.selected
13 dpavlin 76 cat $tmp.selected >> $tmp
14 dpavlin 22
15 dpavlin 76 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 dpavlin 22 version=`echo $which | cut -d" " -f1`
24 dpavlin 76 board=`echo $which | cut -d" " -f2`
25     path=`echo $which | cut -c32-`
26 dpavlin 22
27 dpavlin 77 cp $tftp/$path $tftp/$board.new && mv $tftp/$board.new $tftp/$board || exit
28 dpavlin 22
29 dpavlin 76 echo "Using $path for $board [$version]"
30 dpavlin 22

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26