File fusioninventory-agent.spec of Package fusioninventory-agent
%define realname fusioninventory-agent
%define srcext tar.bz2
%global __requires_exclude perl\\(VMS|perl\\(Win32
%{!?perl_installarchlib:%define perl_installarchlib %(perl -V:installarchlib | sed "s!.*='!!;s!'.*!!")}
%{!?perl_vendorarch:%define perl_vendorarch %(perl -V:vendorarch | sed "s!.*='!!;s!'.*!!")}
%{!?perl_version:%define perl_version %(perl -V:version | sed "s!.*='!!;s!'.*!!")}
# Common info
Name: %{realname}
Version: 2.3.19
Release: wiz%{?extraver:0.}1%{?dist}
License: GPL-2.0+
Group: Hardware/Other
URL: http://fusioninventory.org/
Summary: FusionInventory agent
# Install-time parameters
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
## Tools
Requires: coreutils procps util-linux iproute2
Requires: dmidecode pciutils usbutils ipmitool
Requires: hdparm smartmontools mpt-status
Requires: lvm2
Requires: dosfstools e2fsprogs xfsprogs
Requires: read-edid
Requires: nmap
%if 0%{?suse_version}
Requires: pciutils-ids
%else
Requires: hwdata
%endif
# Perl module requirements
Requires: perl(Archive::Extract)
Requires: perl(Compress::Zlib)
Requires: perl(Data::Dumper)
Requires: perl(DateTime)
Requires: perl(Digest::MD5) perl(Digest::SHA)
Requires: perl(Encode)
Requires: perl(File::Copy::Recursive) perl(File::Path) perl(File::Temp) perl(File::Which)
Requires: perl(HTTP::Cookies) perl(HTTP::Daemon)
Requires: perl(HTTP::Headers) perl(HTTP::Request) perl(HTTP::Status)
Requires: perl(IO::Socket::SSL)
Requires: perl(JSON::PP)
Requires: perl(LWP::Simple) perl(LWP::UserAgent)
Requires: perl(Memoize)
Requires: perl(Net::CUPS)
Requires: perl(Net::HTTPS) perl(Net::IP)
Requires: perl(Net::NBName)
Requires: perl(Net::Ping)
Requires: perl(Net::SNMP)
Requires: perl(Parallel::ForkManager)
Requires: perl(Parse::EDID)
Requires: perl(Proc::Daemon)
Requires: perl(Text::Template)
Requires: perl(Thread::Queue)
Requires: perl(Time::HiRes) perl(Time::Piece)
Requires: perl(UNIVERSAL::require)
Requires: perl(URI) perl(URI::Escape)
Requires: perl(XML::TreePP) perl(XML::XPath)
Requires: perl(YAML::Tiny)
Provides: perl-FusionInventory-Agent = %{version}
Provides: FusionInventory-Agent = %{version}
Obsoletes: FusionInventory-Agent < %{version}
# Build-time parameters
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl(Module::Install) perl(ExtUtils::MakeMaker)
%if 0%{?suse_version}
BuildRequires: pciutils-ids
BuildRequires: usbutils
%else
BuildRequires: hwdata
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source0: %{realname}-%{version}%{?extraver}.%{srcext}
Source1: fusioninventory-agent.init
Source11: LXC.pm
%description
fusioninventory-agent is an agent for OCS Inventory server and FusionInventory
for GLPI servers. It creates local inventory of the machines (hardware and
software) and send it to the server. It can also write it in a local XML file.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%{__sed} -ri \
-e '/setup\.pm/ s|(/lib/)$|\1FusionInventory/|' \
-e 's|\$\(DATADIR\)/lib|%{perl_vendorlib}|' \
-e '/^authors/ d' \
Makefile.PL
%build
export PATH=${PATH}:/sbin:/usr/sbin
%{__perl} Makefile.PL \
INSTALLDIRS=vendor \
PREFIX=%{_prefix} \
SYSCONFDIR=%{_sysconfdir}/fusioninventory \
DATADIR=%{_datadir}/fusioninventory \
LOCALSTATEDIR=%{_localstatedir}/lib/fusioninventory
%{__make} %{?_smp_mflags}
%install
%{__make} install config_install data_install DESTDIR=%{buildroot}
%{__install} -d -m755 %{buildroot}%{_localstatedir}/lib/fusioninventory
%{__install} -D -m755 %{S:1} %{buildroot}%{_initrddir}/fusioninventory-agent
%{__install} -m644 %{S:11} %{buildroot}%{perl_vendorlib}/FusionInventory/Agent/Task/Inventory/Linux/LXC.pm
%if 0%{?suse_version}
%{__install} -d -m755 %{buildroot}%{_sbindir}
%{__ln_s} -f %{_initrddir}/fusioninventory-agent %{buildroot}%{_sbindir}/rcfusioninventory-agent
%else
%{__install} -D -m644 contrib/yum-plugin/fusioninventory-agent.conf %{buildroot}%{_sysconfdir}/yum/pluginconf.d/fusioninventory-agent.conf
%{__install} -D -m644 contrib/yum-plugin/fusioninventory-agent.py %{buildroot}%{_prefix}/lib/yum-plugins/fusioninventory-agent.py
%endif
test -f %{buildroot}%{perl_archlib}/perllocal.pod && %{__rm} -f %{buildroot}%{perl_archlib}/perllocal.pod
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%files
%defattr(-,root,root)
%license LICENSE
%doc Changes README.md THANKS
%dir %{_sysconfdir}/fusioninventory
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/fusioninventory/*.cfg
%{_bindir}/*
%{_initrddir}/fusioninventory-agent
%if 0%{?suse_version}
%{_sbindir}/rcfusioninventory-agent
%else
%config %{_sysconfdir}/yum/pluginconf.d/fusioninventory-agent.conf
%{_prefix}/lib/yum-plugins/fusioninventory-agent.py*
%endif
%{perl_vendorlib}/setup.pm
%{perl_vendorlib}/FusionInventory/
%dir %{_localstatedir}/lib/fusioninventory
%dir %{_datadir}/fusioninventory/html
%dir %{_datadir}/fusioninventory
%{_datadir}/fusioninventory/html/*
%{_datadir}/fusioninventory/*.ids
%doc %{_mandir}/man1/*
###%doc %{_mandir}/man3/*
%exclude %{perl_vendorarch}/auto/FusionInventory/Agent/.packlist
%if 0%{?suse_version}
%post
%{fillup_and_insserv %{name}}
%preun
%{stop_on_removal %{name}}
%{__rm} -rf %{_localstatedir}/lib/fusioninventory/*
%postun
%{restart_on_update %{name}}
%{insserv_cleanup}
%else
%preun
%{__rm} -rf %{_localstatedir}/lib/fusioninventory/*
%endif
%changelog