File iscsitarget.spec of Package iscsitarget

#
# spec file for package iscsitarget (Version 1.4.19)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           iscsitarget
BuildRequires:  kernel-syms module-init-tools openssl-devel
Url:            http://iscsitarget.sourceforge.net
License:        GPLv2
Group:          System/Daemons
PreReq:         %fillup_prereq %insserv_prereq /bin/cat /bin/rm
AutoReqProv:    on
Version:        1.4.19
Release:        7
Requires:       iscsitarget-kmp
Summary:        Open Source iSCSI Target with Professional Features
Source:         %{name}-%{version}.tar.gz
Source1:        %{name}.init
Source2:        %{name}.sysconfig
Source3:        preamble
Source4:        services
Patch0:         iscsitarget-2.6.29.patch
Patch1:         iscsitarget-2.6.30.patch
Patch2:         iscsitarget-2.6.33.patch
Patch3:         iscsitarget-0.4.17.diff
Patch4:         iscsitarget-isns-bounds-checking
Patch5:         iscsitarget-2.6.37.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%suse_kernel_module_package -n %{name} -p %{S:3} kdump um

%description
The aim of the project is to develop an open source iSCSI target with
professional features that works well in enterprise environment under
real workload and is scalable and versatile enough to meet the
challenge of future storage needs and developments.

%package KMP
Group:          System/Daemons
License:        LGPLv2.1+
Summary:        Open Source iSCSI Target with Professional Features

%description KMP
The aim of the project is to develop an open source iSCSI target with
professional features that works well in enterprise environment under
real workload and is scalable and versatile enough to meet the
challenge of future storage needs and developments.

%prep
%setup
%patch0
%patch1
%patch2
%patch3 -p0
%patch4 -p1
%patch5 -p1
echo "iscsi_trgt.ko yes" > kernel/Module.supported

%build
%{__make} CFLAGS="${RPM_OPT_FLAGS} -D_GNU_SOURCE -I../include" bindir=/usr/sbin -C usr
for flavor in %flavors_to_build; do
	rm -rf obj/$flavor
	mkdir -p obj/$flavor
	cp -a kernel/* obj/$flavor
	cp include/iet_u.h obj/$flavor
	make -C /usr/src/linux-obj/%_target_cpu/$flavor modules \
	      M=$PWD/obj/$flavor
done

%install
install -vD usr/ietd ${RPM_BUILD_ROOT}/usr/sbin/ietd
install -vD usr/ietadm ${RPM_BUILD_ROOT}/usr/sbin/ietadm
install -vD -m 600 etc/ietd.conf ${RPM_BUILD_ROOT}/etc/ietd.conf
install -vD -m 755 %{S:1} ${RPM_BUILD_ROOT}/etc/init.d/iscsitarget
install -vD -m 644 %{S:2} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.ietd
install -vD -m 644 %{S:4} ${RPM_BUILD_ROOT}/etc/sysconfig/SuSEfirewall2.d/services/iscsitarget
install -D -m 644 doc/manpages/ietd.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/ietd.8
install -D -m 644 doc/manpages/ietd.conf.5 ${RPM_BUILD_ROOT}%{_mandir}/man5/ietd.conf.5
ln -sf ../../etc/init.d/iscsitarget $RPM_BUILD_ROOT/usr/sbin/rciscsitarget
# install kernel modules
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
	make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
	      M=$PWD/obj/$flavor
done

%clean
[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
rm -f filelist

%post
%{fillup_and_insserv -f iscsitarget}
%{fillup_and_insserv -i -n ietd}

%preun
%stop_on_removal iscsitarget

%postun
%{insserv_cleanup}

%files
%attr(755,root,root)/usr/sbin/*
%attr(755,root,root)/etc/init.d/*
%defattr(-,root,root)
%config /etc/ietd.conf
%config /etc/sysconfig/SuSEfirewall2.d/services/*
/var/adm/fillup-templates/sysconfig.ietd
%doc COPYING README
%doc %{_mandir}/man5/*
%doc %{_mandir}/man8/*

%changelog
openSUSE Build Service is sponsored by