%define date 20070803
Name: scsi-target-utils
Version: 0.0
Release: 2.%{date}snap%{?dist}
Summary: The SCSI target daemon and utility programs
Group: System Environment/Daemons
License: GPLv2
URL: http://stgt.berlios.de
Source0: http://stgt.berlios.de/releases/tgt-%{date}.tar.bz2
Source1: tgtd.init
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: openssl-devel pkgconfig
Requires: /sbin/chkconfig /sbin/service
%description
The SCSI target package contains the daemon and tools to setup a SCSI targets.
Currently, software iSCSI targets are supported.
%prep
%setup -q -n tgt-%{date}
%build
if pkg-config openssl ; then
CPPFLAGS=$(pkg-config --cflags openssl) ; export CPPFLAGS
LDFLAGS=$(pkg-config --libs openssl) ; export LDFLAGS
fi
pushd usr
%{__sed} -i -e 's|-Wall -g -O2|%{optflags}|' Makefile
%{__make} %{?_smp_mflags} ISCSI=1
%install
%{__rm} -rf %{buildroot}
%{__install} -d %{buildroot}%{_sbindir}
%{__install} -d %{buildroot}%{_mandir}/man8
%{__install} -d %{buildroot}%{_initrddir}
%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/tgtd
%{__install} -p -m 0644 doc/manpages/tgtadm.8 %{buildroot}/%{_mandir}/man8
pushd usr
%{__make} install DESTDIR=%{buildroot}
%post
/sbin/chkconfig --add tgtd
%postun
if [ "$1" = "1" ] ; then
/sbin/service tgtd condrestart > /dev/null 2>&1
fi
%preun
if [ "$1" = "0" ] ; then
/sbin/chkconfig tgtd stop > /dev/null 2>&1
/sbin/chkconfig --del tgtd
fi
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-, root, root, -)
%doc README doc/README.iscsi
%{_sbindir}/tgtd
%{_sbindir}/tgtadm
%{_mandir}/man8/*
%{_initrddir}/tgtd
%changelog
* Sun Dec 07 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 0.0-2.20070803snap
- Rebuild for new openssl soname bump
* Wed Sep 26 2007 Terje Rosten <terje.rosten@ntnu.no> - 0.0-1.20070803snap
- random cleanup
* Wed Sep 26 2007 Terje Rosten <terje.rosten@ntnu.no> - 0.0-0.20070803snap
- update to 20070803
- fix license tag
- use date macro
- build with correct flags (%%optflags)
* Tue Jul 10 2007 Mike Christie <mchristie@redhat.com> - 0.0-0.20070620snap
- first build