#!/bin/bash


get_img_file()
{
	businfo=$1
	psid_flash=""
	psid_image=""
	image_file=""
	
	(cd nic_fw 
	psid_flash=`./mstflint -d $1 dc | grep "^PSID"|cut -d'=' -f2|sed -e 's/ *//g'`

	fw_files=`ls fw*`
	
	for i in $fw_files;do 
		psid_image=`./mstflint -i $i dc | grep "^PSID"|cut -d'=' -f2|sed -e 's/ *//g'`
		if [ "$psid_image" = "$psid_flash" ];then
			image_file=$i
			break;
		fi
		psid_image=""
	done 
	
	if [ -n "$image_file" ];then
		if [ $psid_image = "HP_0200000003" ];then
			card="Ariston"
		else
			card="Legion2"
		fi
		echo "$card#$image_file"
	else
		echo 0
	fi)
	
}


#MAIN starts from here
if [ $# -ne 2 ];then
        echo "improper command invocation"
        exit 
fi

if [ $1 = "imgfile" ];then
        get_img_file $2
fi





