File powerman.spec of Package powerman

#
# spec file for package powerman
#
# Copyright (c) 2011 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
%if 0%{?suse_version} > 1110
%define enable_heartbeat 1
%endif
%endif

Name:           powerman
Version:        2.3.20
Release:        1.1
Url:            http://code.google.com/p/powerman/
Source:         %{name}-%{version}.tar.gz
Patch0:         powerman-piddir.patch
Patch1:         powerman-runlevel.patch
Summary:        Centralized Power Control for Clusters
License:        GPL-2.0+
Group:          Productivity/Clustering/HA
BuildRequires:  curl-devel
BuildRequires:  ncurses-devel
BuildRequires:  pkg-config
BuildRequires:  tcpd-devel
%if 0%{?enable_heartbeat}
BuildRequires:  heartbeat
%endif
#BuildRequires:  genders
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %insserv_prereq

%description
PowerMan is a tool for manipulating remote power control (RPC) devices from a 
central location. Several RPC varieties are supported natively by PowerMan and 
Expect-like configurability simplifies the addition of new devices.

%package -n libpowerman0
Summary:        Libraries for applications using PowerMan
Group:          System/Libraries

%description -n libpowerman0
A shared library for applications using PowerMan.

%package devel
Requires:       libpowerman0 = %{version}
Summary:        Headers and libraries for developing applications using PowerMan
Group:          Development/Libraries/C and C++

%description devel
A header file and static library for developing applications using PowerMan.

%prep
%setup -q
%patch0
%patch1 -p1

%build
# --with-genders
%configure\
	--disable-static\
	--with-httppower
make %{?jobs:-j%jobs}

%install
make install DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT%{_libdir}/*.la
ln -s ../..%{_sysconfdir}/init.d/powerman $RPM_BUILD_ROOT%{_sbindir}/rcpowerman
mv $RPM_BUILD_ROOT%{_sysconfdir}/powerman/powerman.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/powerman/powerman.conf
# 
%if ! 0%{?enable_heartbeat}
rm -r $RPM_BUILD_ROOT%{_libdir}/stonith
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%preun
%{stop_on_removal}

%post
%{fillup_and_insserv -f}

%postun
%{restart_on_update}
%{insserv_cleanup}

%post -n libpowerman0 -p /sbin/ldconfig

%postun -n libpowerman0 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS DISCLAIMER COPYING NEWS README TODO
%{_bindir}/*
%if 0%{?enable_heartbeat}
%{_libdir}/stonith/plugins/external/powerman
%endif
%dir %attr(0755,daemon,root) %ghost %{_localstatedir}/run/powerman
%doc %{_mandir}/man?/*.*
%exclude %doc %{_mandir}/man3/*.*
%{_sbindir}/*
%dir %config %{_sysconfdir}/powerman
%{_sysconfdir}/init.d/powerman
%config %{_sysconfdir}/powerman/powerman.conf
%{_sysconfdir}/powerman/*.dev

%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%doc %{_mandir}/man3/*.*

%files -n libpowerman0
%defattr(-,root,root)
%{_libdir}/*.so.*

%changelog
* Thu Dec  8 2011 coolo@suse.com
- the COPYING is GPL-2.0+
* Thu Jul 28 2011 sbrabec@suse.cz
- Update to version 2.3.9:
  * Add MIB support to snmppower.
  * Add eaton-epdu-blue-switched.dev.
  * Add support for SNMP power controllers.
  * Add SNMP dev files for 8-port APC, 8-port Baytech, and 20 port
    Eaton Revelation PDU.
  * Add support for APC 7900 revision 3 firmware.
  * Add support for Appro Greenblade.
  * Add support for APC 7920.
  * Add Support for ranged beacon on/off device scripts, and beacon
    support for ipmipower.
- Make heartbeat support optional as it is dropped now.
* Wed May 19 2010 ro@suse.de
- keep /var/run/powerman only as ghost in filelist
  and create it in initscript if missing
* Tue May 18 2010 aj@suse.de
- Add pkg-config as build requires.
* Fri Aug 14 2009 sbrabec@suse.cz
- PreReq fix.
* Mon Aug 10 2009 sbrabec@suse.cz
- New SuSE package, version 2.3.5.
openSUSE Build Service is sponsored by