#!/bin/bash
#
#    Copyright (c) 2005 Brocade Communications Systems, Inc.
#    All rights reserved.
#
#    Description:
#
#	This post install script will be run after firmware 
#	download to the co-cpu. It runs on the co-CPU.
#
#

PATH=/bin:/usr/bin:/sbin:/usr/sbin

#
# Passed in version numbers
#
TO_MAJOR=$1
TO_MINOR=$2
TO_PATCH=$3

swbd() {
	/bin/sed -n -e 's/^.*\(SWBD[[:digit:]]\{1,\}\).\+$/\1/gp'
}

# Determine the system platform identifier.
SWBD=$(sin | swbd 2> /dev/null)

#downgrading from >=6.4 to <=6.3
if [ $TO_MAJOR -le 6 -a $TO_MINOR -le 3 ]; then
	# older version use ataboot
	if test $SWBD = "SWBD63"; then
		/sbin/fwdl_benv ataboot
	fi
else
	if test $SWBD = "SWBD63"; then
		# turn off for now
		echo "net boot..."
		#/sbin/fwdl_benv netboot
	fi
fi

#
# These files are introduced in distribution and should be deleted
#
/bin/rm -f /mnt/dev/fabsys /mnt/dev/ki* /mnt/dev/fc* /mnt/dev/switch*
exit 0
