#!/bin/ksh

OSNAME=$(uname)

if [ "$OSNAME" = "AIX" ]
then
	
	tar -cvf perl-xCAT-2.0.tar perl-xCAT-2.0
	gzip perl-xCAT-2.0.tar
	cp  perl-xCAT-2.0.tar.gz /opt/freeware/src/packages/SOURCES
	cd ./perl-xCAT-2.0
	rm /opt/freeware/src/packages/RPMS/ppc/perl-xCAT-2.0*rpm
	rpm -ba perl-xCAT.spec
	#rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/perl-xCAT-2.0*rpm

else
	if [ -f /etc/redhat-release ]
	then
   		pkg="redhat"
	else
   		pkg="packages"
	fi

	tar --exclude .svn -czvf perl-xCAT-2.0.tar.gz perl-xCAT-2.0/;
	rm /usr/src/$pkg/RPMS/noarch/perl-xCAT-2.0*rpm
	rpmbuild -ta perl-xCAT-2.0.tar.gz ;
	#rpm -Uvh /usr/src/$pkg/RPMS/noarch/perl-xCAT-2.0*rpm
fi