--- tftp-iselect.sh 2007/11/18 14:54:00 75 +++ tftp-iselect.sh 2007/11/18 15:20:16 76 @@ -2,20 +2,29 @@ tftp=/srv/tftp/ tmp=/tmp/tftp -fw_info=./fw-info.pl +fw_info=bin/fw-info.pl -echo "Select firmware image to flash: " > $tmp -echo > $tmp +#which=`find $tftp -type f | xargs -i $fw_info {} 2>/dev/null | sort | sed -e "s!$tftp!!" -e 's!^!!' -e 's!^\(.* BANT-R\)!\1!' | iselect -c -n "Select firmware file"` +$fw_info $tftp/ 2>/dev/null | sort -k 2,1 -n | sed -e "s!$tftp/*!!" > $tmp.all -which=`find $tftp -type f | xargs -i $fw_info {} 2>/dev/null | sort | sed -e "s!$tftp!!" -e 's!^!!' -e 's!^\(.* BANT-R\)!\1!' | iselect -c -n "Select firmware file"` +echo -e "Currently selected version for flash:\n" > $tmp -test -z "$which" && exit +grep " BANT-" $tmp.all > $tmp.selected +cat $tmp.selected >> $tmp + +echo -e "\nAll versions available:\n" >> $tmp + +grep -v -f $tmp.selected $tmp.all | sed -e 's!^!!' >> $tmp + +which=`iselect -c -n "Select firmware" < $tmp` + +test -z "$which" && echo "No change" && exit version=`echo $which | cut -d" " -f1` -path=`echo $which | cut -d" " -f2-` +board=`echo $which | cut -d" " -f2` +path=`echo $which | cut -c32-` -echo "Using $path [$version]" +ln -sf $tftp/$path $tftp/$board || exit -cp $tftp/$path $tftp/BANT-R.new && mv $tftp/BANT-R.new $tftp/BANT-R +echo "Using $path for $board [$version]" -rm $tmp