File fusioninventory-agent.spec of Package fusioninventory-agent

Name:       fusioninventory-agent
Version:    2.3.18
Release:    2%{?dist}
Summary:    FusionInventory agent
License:    GPLv2+
Group:      System/Servers
URL:        http://www.fusioninventory.org
Source0:    http://forge.fusioninventory.org/attachments/download/867/FusionInventory-Agent-%{version}.tar.gz
Patch0:		25404f038f99bd091e0fb2368879e848500f5082.patch
BuildArch:  noarch
BuildRequires: perl(ExtUtils::MakeMaker)
Requires:  perl(Proc::Daemon)
Requires:  perl(Proc::PID::File)
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}

%description
The fusioninventory agent is a generic agent, running on each managed node. It
can perform a certain number of tasks, either according to its own execution
plan, or as requested from a central control server, such as GLPI server with
fusioninventory plugin.

This package contains only the agent itself. Additional task packages are
needed for effective usage.

%package task-inventory
Summary:    Local inventory support for FusionInventory agent
License:    GPL
Group:		System/Servers
Requires:   %{name} = %{version}-%{release}

%description task-inventory
This package provides local inventory support for FusionInventory agent:
- the inventory task allows the agent to extract various hardware and software
  information on its host
  
Additional optional packages:
- perl-Net-CUPS
- perl-Parse-EDID

%package task-wakeonlan
Summary:    Wake-on-lan support for FusionInventory agent
License:    GPL
Group:		System/Servers
Requires:   %{name} = %{version}-%{release}

%description task-wakeonlan
This package provides wake-on-lan support for FusionInventory agent:
- the wakeonlan task allows the agent to send wake-on-lan packet to another
  host on the same network
  
Additional optional packages:
- perl-Net-Write

%package task-network
Summary:    Network discovery and inventory support for FusionInventory agent
License:    GPL
Group:		System/Servers
Requires:   %{name} = %{version}-%{release}

%description task-network
This package provides network support for FusionInventory agent:
- the NetDiscovery task allows the agent to scan the network to find remote
  devices, through nmap, NetBios or SNMP, and to identify them
- the NetInventory task allows the agent to extract various information from
  a remote device through SNMP protocol
  
Additional optional packages:
- perl-Net-NBName
- nmap

%package task-esx
Summary:    ESX inventory support for FusionInventory agent
License:    GPL
Group:		System/Servers
Requires:   %{name} = %{version}-%{release}

%description task-esx
This package provides ESX support for FusionInventory agent:
- the ESX task allows the agent to perform remote inventory of ESX, ESXi,
  vCenter server using the SOAP interface

%package task-deploy
Summary:    Software deployement support for FusionInventory agent
License:    GPL
Group:		System/Servers
Requires:   %{name} = %{version}-%{release}
Requires:	perl(Archive::Extract)

%description task-deploy
This package provides software deployement support for FusionInventory agent:
- the deploy task allows the agent to perform software installation on its host

%package task-collect
Summary:    Custom information retrieval support for FusionInventory agent
License:    GPL
Group:		System/Servers
Requires:   %{name} = %{version}-%{release}

%description task-collect
This package provides custom information retrieval support for FusionInventory agent:
- the collect task allows the agent to retrieve custom information on its host

%prep
%setup -q -n FusionInventory-Agent-%{version}
%patch0 -p 1

# Automatic dependencies
%if 0%{?centos_version} == 505 || 0%{?rhel_version} == 505
cat << \EOF > %{name}-req
#!/bin/sh
%{__perl_requires} $* |\
    sed -e '/perl(FusionInventory::/d' |\
    sed -e '/perl(Win32/d'
EOF
cat << \EOF > %{name}-prov
#!/bin/sh
%{__perl_provides} $* |\
    sed -e '/perl(FusionInventory::/d'
EOF
%global __perl_provides %{_builddir}/FusionInventory-Agent-%{version}/%{name}-prov
chmod +x %{__perl_provides}
%global __perl_requires %{_builddir}/FusionInventory-Agent-%{version}/%{name}-req
chmod +x %{__perl_requires}
%endif

%if 0%{?centos_version} == 600 || 0%{?rhel_version} == 600
%{?filter_from_requires: %filter_from_provides /perl(FusionInventory::/d}
%{?filter_from_requires: %filter_from_requires /perl(Win32/d}
%{?filter_from_requires: %filter_from_requires /perl(FusionInventory::/d}
%{?perl_default_filter}
%endif

%if 0%{?centos_version} == 700 || 0%{?rhel_version} == 700
%perl_default_filter
%global __requires_exclude perl\\(Win32|FusionInventory
%global __provides_exclude perl\\(FusionInventory
%endif

%build
%__perl Makefile.PL \
    PREFIX=%{_prefix} \
    SYSCONFDIR=%{_sysconfdir}/fusioninventory \
    LOCALSTATEDIR=%{_localstatedir}/lib/fusioninventory
make

%install
rm -rf  %{buildroot}
make install DESTDIR=%{buildroot}

# init script configuration file
install -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig
cat > %{buildroot}%{_sysconfdir}/sysconfig/fusioninventory-agent <<EOF
# fusioninventory agent options
OPTIONS=""
EOF

install -d -m 755 %{buildroot}%{_sysconfdir}/cron.daily
cat > %{buildroot}%{_sysconfdir}/cron.daily/fusioninventory-agent <<EOF
#!/bin/sh
. /etc/sysconfig/fusioninventory-agent
%{_bindir}/fusioninventory-agent $OPTIONS > /dev/null 2>&1
EOF
chmod 755 %{buildroot}%{_sysconfdir}/cron.daily/fusioninventory-agent

install -d -m 755 %{buildroot}%{_sysconfdir}/logrotate.d
cat > %{buildroot}%{_sysconfdir}/logrotate.d/fusioninventory-agent <<EOF
%{_localstatedir}/log/%{name}/*.log {
    compress
    notifempty
    missingok
}
EOF

%if 0%{?centos_version} == 700 || 0%{?rhel_version} == 700
install -d -m 755 %{buildroot}%{_unitdir}
install -m 755 contrib/unix/fusioninventory-agent.service \
    %{buildroot}%{_unitdir}/fusioninventory-agent.service
%else
install -d -m 755 %{buildroot}%{_initrddir}
install -m 755 contrib/unix/fusioninventory-agent.init.redhat \
    %{buildroot}%{_initrddir}/fusioninventory-agent
%endif

install -d -m 755 %{buildroot}%{_localstatedir}/log/%{name}
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}

%clean
rm -rf %{buildroot}

%files
%doc Changes THANKS LICENSE README
%{_bindir}/fusioninventory-agent
%{_bindir}/fusioninventory-injector
%{_mandir}/man1/fusioninventory-agent.1*
%{_mandir}/man1/fusioninventory-injector.1*
%{_localstatedir}/log/fusioninventory-agent
%{_localstatedir}/lib/fusioninventory-agent
%{_datadir}/fusioninventory
%dir %{_sysconfdir}/fusioninventory
%config(noreplace) %{_sysconfdir}/fusioninventory/agent.cfg
%config(noreplace) %{_sysconfdir}/logrotate.d/fusioninventory-agent
%config(noreplace) %{_sysconfdir}/cron.daily/fusioninventory-agent
%config(noreplace) %{_sysconfdir}/sysconfig/fusioninventory-agent
%if 0%{?centos_version} == 700 || 0%{?rhel_version} == 700
%{_unitdir}/fusioninventory-agent.service
%else
%{_initrddir}/fusioninventory-agent
%endif
%dir %{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task
%exclude %{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task
%exclude %{_datadir}/fusioninventory/lib/FusionInventory/Agent/SNMP.pm
%exclude %{_datadir}/fusioninventory/lib/FusionInventory/Agent/SNMP
%exclude %{_datadir}/fusioninventory/lib/FusionInventory/Agent/SOAP

%files task-inventory
%{_bindir}/fusioninventory-inventory
%{_mandir}/man1/fusioninventory-inventory.1*
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task/Inventory.pm
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task/Inventory

%files task-wakeonlan
%{_bindir}/fusioninventory-wakeonlan
%{_mandir}/man1/fusioninventory-wakeonlan.1*
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task/WakeOnLan.pm

%files task-network
%{_bindir}/fusioninventory-netdiscovery
%{_bindir}/fusioninventory-netinventory
%{_mandir}/man1/fusioninventory-netdiscovery.1*
%{_mandir}/man1/fusioninventory-netinventory.1*
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task/NetInventory.pm
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task/NetDiscovery.pm
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/SNMP.pm
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/SNMP

%files task-esx
%{_bindir}/fusioninventory-esx
%{_mandir}/man1/fusioninventory-esx.1*
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task/ESX.pm
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/SOAP

%files task-deploy
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task/Deploy.pm
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task/Deploy

%files task-collect
%{_datadir}/fusioninventory/lib/FusionInventory/Agent/Task/Collect.pm

%changelog
* Mon Jun 20 2016 Guillaume Rousse <guillomovitch@gmail.com> 2.3.18-2
- fix useless dependency on perl(Data::Structure::Util) 

* Mon Jun 20 2016 Guillaume Rousse <guillomovitch@gmail.com> 2.3.18-1
- update to 2.3.18
- add task-collect subpackage

* Sun Sep 27 2015 Guillaume Rousse <guillomovitch@gmail.com> 2.3.17-1
-  update to 2.3.17

* Sun Mar 01 2015 Guillaume Rousse <guillomovitch@gmail.com> 2.3.16-1
-  update to 2.3.16

* Tue Jan 06 2015 Guillaume Rousse <guillomovitch@gmail.com> 2.3.15-1
-  update to 2.3.15
  
* Fri Jan 02 2015 Guillaume Rousse <guillomovitch@gmail.com> 2.3.14-3
- use init script and systemd unit from the tarball, instead of 
  additional sources

* Wed Dec 31 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.14-2
- ship systemd unit instead of init script for RHEL/CentOS >= 7

* Mon Dec 15 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.14-1
- update to 2.3.14

* Thu Nov 06 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.13-1
- update to 2.3.13

* Mon Oct 06 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.12-1
- update to 2.3.12

* Mon Sep 29 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.11.1-1
- update to 2.3.11.1

* Tue Aug 08 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.10.1-1
- update to 2.3.10.1

* Tue Jul 31 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.10-1
- update to 2.3.10

* Tue Jul 15 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.9.1-1
- update to 2.3.9.1

* Fri May 16 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.8-1
- update to 2.3.8

* Wed Apr 30 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.7.1-1
- update to 2.3.7.1

* Tue Apr 29 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.7-1
- update to 2.3.7

* Tue Mar 11 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.6-1
- update to 2.3.6

* Wed Jan 15 2014 Guillaume Rousse <guillomovitch@gmail.com> 2.3.5.1-1
- update to 2.3.5.1

* Fri Nov 29 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.3.4-1
- update to 2.3.4

* Wed Nov 06 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.3.3-1
- update to 2.3.3

* Tue Oct 08 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.3.2-1
- update to 2.3.2

* Tue Sep 10 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.3.1-1
- update to 2.3.1

* Thu Aug 08 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.3.0-5
- list optional suggested packages in descriptions
  
* Wed Aug 07 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.3.0-4
- add optional perl modules needed for daemon mode as explicit dependencies
  (#2195)

* Tue Aug 06 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.3.0-3
- really move F::A::HTTP::Client::Fusion class in main package
- move executable man pages in various task packages
  
* Mon Aug 05 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.3.0-2
- better description
- move F::A::HTTP::Client::Fusion class in main package, it is needed
  both for esx and deploy tasks

* Tue Aug  1 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.3.0-1
- update to 2.3.0
- drop suse conditional build statements, as there no interest to make
  spec file more complex, without any way to test the result

* Tue Feb 12 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.2.7-2
- first attempt to port it to Suse
- fix perms and name of init script

* Fri Jan 11 2013 Guillaume Rousse <guillomovitch@gmail.com> 2.2.7-1
- initial OBS release