File sblim-sfcb.spec of Package sblim-sfcb
#
# spec file for package sblim-sfcb
#
# Copyright (c) 2012 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/
#
%if 0%{?suse_version} > 1140 || 0%{?fedora_version} > 14
%define has_systemd 1
%else
%define has_systemd 0
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: Small Footprint CIM Broker
License: EPL-1.0
Group: System/Management
Name: sblim-sfcb
Version: 1.3.16
Release: 0
Url: http://sblim.sf.net/
Provides: openwbem = 3.2.2
Obsoletes: openwbem < 3.2.2
Source0: %{name}-%{version}.tar.bz2
Source1: autoconfiscate.sh
%if 0%{?suse_version}
Source2: sblim-sfcb.init
%endif
Source3: autoconfiscate.sh-mofc
Source4: sfcb-pam.conf
Source5: %{name}-rpmlintrc
Source6: susefirewall.conf
Source7: sfcbd.service
Patch1: pending-upstream.patch
Patch4: 0004-Don-t-call-tool_mm_flush-during-OPS_LoadProvider.patch
Patch6: 0006-Reflect-provider-information-in-ps-via-argv.patch
Patch7: sblim-resource.patch
Provides: cim-server
Provides: cimserver
%if 0%{?suse_version} >= 1030
BuildRequires: libcurl-devel
%else
BuildRequires: curl-devel
%endif
%if 0%{?suse_version} >= 1140
%if 0%{?has_systemd} == 0
Requires: sysvinit-tools
%endif
%endif
BuildRequires: cim-schema
BuildRequires: libtool
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: sblim-sfcc-devel
BuildRequires: zlib-devel
%if 0%{?rhel_version} == 0 && 0%{?centos_version} == 0
BuildRequires: openslp-devel
%endif
BuildRequires: bison
BuildRequires: flex
BuildRequires: unzip
# RHEL4 explicitly requires gcc
%if 0%{?rhel_version} >= 400 || 0%{?centos_version} >= 400
%if 0%{?rhel_version} < 500 || 0%{?centos_version} < 500
BuildRequires: gcc-c++
%endif
%endif
%if 0%{?has_systemd}
BuildRequires: systemd
%{?systemd_requires}
%endif
Requires: curl
%if 0%{?suse_version} < 1120
# unneeded explicit lib dependency
Requires: zlib
%endif
Requires: openssl
Requires: pam
# Added NWP - dependency on cim-schema instead of inbuilt schema
Requires: cim-schema
# /usr/bin/wbemcat needs LWP::UserAgent
Requires: perl-libwww-perl
PreReq: /usr/sbin/groupadd /usr/sbin/groupmod
%description
Small Footprint CIM Broker (sfcb) is a CIM server conforming to the CIM
Operations over HTTP protocol. It is robust, with low resource
consumption and therefore specifically suited for embedded and resource
constrained environments. sfcb supports providers written against the
Common Manageability Programming Interface (CMPI).
%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch4 -p1
%patch6 -p1
%patch7 -p1
export PATCH_GET=0
%build
#autoreconf -f -i
cp %SOURCE1 .
cp %SOURCE3 mofc/autoconfiscate.sh
chmod +x mofc/autoconfiscate.sh
# 1.3.6 tarball seems incomplete. (issue #2931327 upstream)
# might be able to remove the following workaround in a future version.
mkdir -p test/finaltest
mkdir -p test/TestProviders/tests
mkdir -p test/commands
mkdir -p test/wbemcli
mkdir -p test/xmltest
mkdir -p test/unittest
mkdir -p test/slptest
mkdir -p test/localtests
touch test/finaltest/Makefile.in
touch test/TestProviders/tests/Makefile.in
touch test/commands/Makefile.in
touch test/wbemcli/Makefile.in
touch test/xmltest/Makefile.in
touch test/unittest/Makefile.in
touch test/slptest/Makefile.in
touch test/localtests/Makefile.in
sh ./autoconfiscate.sh
mkdir -p m4
%if 0%{?rhel_version} == 0 && 0%{?centos_version} == 0
WITH_SLP=--enable-slp
%else
WITH_SLP=
%endif
%configure --enable-debug --enable-ssl --enable-pam --enable-ipv6 \
--enable-uds $WITH_SLP
# RHEL < 6 ships with old libtool (see http://www.yolinux.com/TUTORIALS/C++XmlBeansxx.html)
%if 0%{?rhel_version} >= 400 || 0%{?centos_version} >= 400
%if 0%{?rhel_version} < 600 || 0%{?centos_version} < 600
rm -f libtool; ln -s /usr/bin/libtool .
(cd mofc; rm -f libtool; ln -s /usr/bin/libtool .)
%endif
%endif
make
%install
%makeinstall
make postinstall DESTDIR=$RPM_BUILD_ROOT
# comment out - NWP - removing schema pkg
#make DESTDIR=$RPM_BUILD_ROOT install-cimschema
# remove docs from wrong dir. They are handled by %%doc macro in files list
rm -rf $RPM_BUILD_ROOT/usr/share/doc
# remove unused libtool files
rm -f $RPM_BUILD_ROOT/%{_libdir}/*a
rm -f $RPM_BUILD_ROOT/%{_libdir}/sfcb/*a
# make the cmpi directory that sfcb will own - for SuSE Autobuild checks of rpm directory ownership
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/cmpi
%if 0%{?has_systemd}
install -D -m 644 %{S:7} $RPM_BUILD_ROOT%{_unitdir}/sfcbd.service
# remove the default-installed sfcb init script
rm -f $RPM_BUILD_ROOT/etc/init.d/sfcb
%else
%if 0%{?suse_version}
# override the default-installed sfcb init script - use the one from Source2
# due to /etc/SuSE-release not available in autobuild, so won't install
# correct init script
install %SOURCE2 $RPM_BUILD_ROOT/etc/init.d/sfcb
ln -s /etc/init.d/sfcb $RPM_BUILD_ROOT/usr/sbin/rcsfcb
%endif
%endif
# Added NWP 5/14/08 - transition to using cim-schema rpm instead of internal-built schema
ln -sf /usr/share/mof/cim-current $RPM_BUILD_ROOT/%{_datadir}/sfcb/CIM
install -m 0644 %SOURCE4 $RPM_BUILD_ROOT/etc/pam.d/sfcb
%if 0%{?suse_version} > 1010
# firewall service definition
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services
install -m 0644 %SOURCE6 $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services/sblim-sfcb
%endif
#
# package list for %%files section
echo "%defattr(-,root,root)" > _pkg_list
# Added NWP 5/14/08 - moved from 'files schema'
echo "%dir %{_datadir}/sfcb/" >> _pkg_list
find $RPM_BUILD_ROOT/%{_datadir}/sfcb -type f | grep -v $RPM_BUILD_ROOT/%{_datadir}/sfcb/CIM >> _pkg_list
# Added next line - NWP - declaring link to CIM as part of pkg
echo "%{_datadir}/sfcb/CIM" >> _pkg_list
# end add NWP
sed s?$RPM_BUILD_ROOT??g _pkg_list > _pkg_list_2
mv -f _pkg_list_2 _pkg_list
echo "%dir %{_libdir}/cmpi/" >> _pkg_list
echo "%dir %{_sysconfdir}/sfcb/" >> _pkg_list
echo "%dir %{_libdir}/sfcb" >> _pkg_list
echo "%config %{_sysconfdir}/sfcb/*" >> _pkg_list
echo "%config %{_sysconfdir}/pam.d/*" >> _pkg_list
%if 0%{?suse_version} > 1010
echo "%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/sblim-sfcb" >> _pkg_list
%endif
echo "%doc README COPYING AUTHORS" >> _pkg_list
echo "%doc %{_datadir}/man/man1/*" >> _pkg_list
%if 0%{?has_systemd}
echo "%{_unitdir}/sfcbd.service" >> _pkg_list
%else
echo "%{_sysconfdir}/init.d/sfcb" >> _pkg_list
%endif
echo "%{_localstatedir}/lib/sfcb" >> _pkg_list
echo "%{_bindir}/*" >> _pkg_list
echo "%{_sbindir}/*" >> _pkg_list
echo "%{_libdir}/sfcb/*.so*" >> _pkg_list
echo =======================================
cat _pkg_list
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%pre
/usr/sbin/groupadd -r sfcb >/dev/null 2>&1 || :
/usr/sbin/groupmod -A root sfcb >/dev/null 2>&1 || :
# cleanup up schema directory (bnc#590196)
if [ -d %{_datadir}/sfcb/CIM -a \( \! -L /usr/share/sfcb/CIM \) ]
then
rm -rf %{_datadir}/sfcb/CIM
fi
# follow http://en.opensuse.org/openSUSE:Systemd_packaging_guidelines
%if 0%{?has_systemd}
if [-f /var/lib/systemd/migrated/%{name}]; then
%service_add_pre sfcbd.service
fi
%endif
%post
test -n "$FIRST_ARG" || FIRST_ARG=$1
#removed NWP, placed into init script for first service startup
#%%{_datadir}/sfcb/genSslCert.sh %%{_sysconfdir}/sfcb
%if 0%{?has_systemd}
%service_add_post sfcbd.service
%else
%if 0%{?suse_version}
%{fillup_and_insserv -f sfcb}
%endif
%endif
if test "$FIRST_ARG" -eq 1 ; then
sfcbrepos -f 2> /dev/null || :
fi
# else we do it in postun instead.
/sbin/ldconfig
exit 0
%preun
%if 0%{?has_systemd}
%service_del_preun sfcbd.service
%else
%stop_on_removal sfcb
%endif
%postun
test -n "$FIRST_ARG" || FIRST_ARG=$1
/sbin/ldconfig
if test "$FIRST_ARG" -ge 1 ; then
sfcbrepos -f 2> /dev/null || :
fi
%if 0%{?has_systemd}
%service_del_postun sfcbd.service
%else
%restart_on_update sfcb
%insserv_cleanup
%endif
%files -f _pkg_list
%changelog