File goliath.spec of Package goliath

#
# Goliath
#
%define name        goliath
%define version     1.0

Summary:            Goliath
Name:               %{name}
Version:            %{version}
Release:            1
License:            GPL
Vendor:             Sancho Lerena <sancho.lerena@artica.es>
Source0:            %{name}-%{version}.tar.gz
URL:                http://sourceforge.net/projects/goliath
Group:              Networking/Servers
Packager:           Manuel Arostegui <marostegui@artica.es>
Prefix:             /opt
BuildRoot:          %{_tmppath}/%{name}-%{version}-buildroot
BuildArchitectures: noarch
Requires:	    perl perl-Net-SSLeay
AutoReq:            0
Provides:           %{name}-%{version}

%description
Goliat is a distributed stress tool to test network enviroments and applications. Supports HTTP, HTTPS, SMTP and other TCP protocols, and TCP Session stress for firewalls (in a client/server setup).
%prep
rm -rf $RPM_BUILD_ROOT

%setup -q -n goliath

%build

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{name}-%{version}-%{release}
mkdir -p $RPM_BUILD_ROOT/usr/
mkdir -p $RPM_BUILD_ROOT/usr/share/
mkdir -p $RPM_BUILD_ROOT/usr/share/goliath/
mkdir -p $RPM_BUILD_ROOT/usr/share/goliath/conf/
mkdir -p $RPM_BUILD_ROOT/usr/bin/

#cp -aRf * $RPM_BUILD_ROOT/%{name}-%{version}-%{release}
cp -aRf *  $RPM_BUILD_ROOT/usr/share/goliath/
# $RPM_BUILD_ROOT/%{name}-%{version}-%{release}/bin/goliath_config.pm $RPM_BUILD_ROOT/usr/bin/
#v $RPM_BUILD_ROOT/%{name}-%{version}-%{release}/bin/goliath_network.pm $RPM_BUILD_ROOT/usr/bin/
#mv $RPM_BUILD_ROOT/%{name}-%{version}-%{release}/bin/goliath.pl $RPM_BUILD_ROOT/usr/bin/
#mv $RPM_BUILD_ROOT/%{name}-%{version}-%{release}/bin/goliath_tools.pm $RPM_BUILD_ROOT/usr/bin/
#cp -aRf * $RPM_BUILD_ROOT/%{name}-%{version}-%{release}/conf/ $RPM_BUILD_ROOT/usr/share/goliath/conf/

if [ -f $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}/%{name}.spec ] ; then
    rm $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}/%{name}.spec
fi

%clean
#rm -rf $RPM_BUILD_ROOT
%post
ln -s  $RPM_BUILD_ROOT/usr/share/goliath/bin/goliath_config.pm /usr/bin/
ln -s $RPM_BUILD_ROOT/usr/share/goliath/bin/goliath.pl /usr/bin/
ln -s  $RPM_BUILD_ROOT/usr/share/goliath/bin/goliath_network.pm /usr/bin/
ln -s  $RPM_BUILD_ROOT/usr/share/goliath/bin/goliath_tools.pm /usr/bin/

echo "Goliath has been placed in /usr/share/goliath/"
echo "Goliath configuration is in /usr/share/goliath/conf/"
echo "Goliath binaries has been placed in /usr/bin/"
echo "To run goliath just use: perl /usr/bin/goliath.pl"
%files
 /usr/share/goliath/bin/goliath.pl
   /usr/share/goliath/bin/goliath_config.pm
   /usr/share/goliath/bin/goliath_network.pm
   /usr/share/goliath/bin/goliath_tools.pm
   /usr/share/goliath/conf/agent.txt
   /usr/share/goliath/conf/cookie.txt
   /usr/share/goliath/conf/parameter.txt
   /usr/share/goliath/conf/peticion.txt
   /usr/share/goliath/conf/pruebas.cfg
   /usr/share/goliath/doc/LICENCE
   /usr/share/goliath/goliath.spec


%defattr(755,root,root)

%docdir %{name}-%{version}-%{release}/docs
/%{name}-%{version}-%{release}