%define tarname OCSNG_LINUX_AGENT_1.0 # Can, optionaly, be define at build time (see README.fedora) # - ocstag : administrative tag # - ocsserver : OCS Inventory NG communication serveur ExclusiveArch: i386 x86_64 Name: ocsinventory-client Version: 1.0 Release: 1%{?dist}%{?ocstag:.}%{?ocstag} Summary: Open Computer and Software Inventory Next Generation client Group: Development/Libraries License: GPL URL: http://ocsinventory.sourceforge.net/ Source0: http://heanet.dl.sourceforge.net/sourceforge/ocsinventory/%{tarname}.tar.gz Source1: ocsinventory-client.README Source2: ocsinventory-client.README.fr Patch0: ocsinventory-client.patch # Not noarch because of ipdiscover.c - BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: %{_sbindir}/dmidecode, perl %if %{?fedora}0 Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) %else %define perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) %endif Requires: %{_sbindir}/dmidecode, net-tools, pciutils Requires: %{_sysconfdir}/logrotate.d, %{_sysconfdir}/cron.daily %if "%{?rhel}0" == "20" # No auto-requires on RHEL2 Requires: perl(Compress::Zlib) Requires: perl(Exporter) Requires: perl(Fcntl) Requires: perl(File::Path) Requires: perl(Net::IP) Requires: perl(Net::SSLeay) Requires: perl(Socket) Requires: perl(XML::Simple) Requires: perl(constant) Requires: perl(strict) # Dosen't work when this extension installed Conflicts: perl-XML-SAX # No virtual provides for this Requires: perl-Digest-MD5 perl-libwww-perl %else # Only vitual provides (but not detected) on non RHEL2 Requires: perl(HTTP::Request) %endif %description Open Computer and Software Inventory Next Generation is an application designed to help a network or system administrator keep track of computer configuration and software installed on the network. It also allows deploying softwares, commands or files on Windows and Linux client computers. %{name} provide the client agent for Linux. %description -l fr Open Computer and Software Inventory Next Generation est une application destinée à aider l'administrateur système ou réseau à garder un oeil sur la configuration des machines du réseau et sur les logiciels qui y sont installés. Elle autorise aussi la télédiffusion (ou déploiement) de logiciels, de commandes ou de fichiers sur les clients Windows ou Linux. %{name} fournit l'agent client pour Linux. %prep %setup -q -n %{tarname} %patch0 -p0 -b .fedora %{__perl} -pi -e 's/\r//' changelogs cat <ocsinv.conf OCS_AGENT_DEVICE_ID $(%{_sbindir}/dmidecode 2>/dev/null | grep "# dmidecode" | cut -d' ' -f3) 3 %{?ocsserver}%{!?ocsserver:__local__} 0 EOF cat <ocsinv.adm TAG %{?ocstag} EOF cat <cron #!/bin/sh # Time balancing - Wait up to 10mn sleep \$((RANDOM % 600 + 1)) # Do Inventory %{_sbindir}/ocsinventory-client.pl &>/dev/null EOF %{__perl} -pi -e 's|PATH_TO_LOG_DIRECTORY|%{_localstatedir}/log/%{name}|' logrotate.ocsinventory-client cp %{SOURCE1} README.fedora cp %{SOURCE2} README.fedora.fr %build pushd Ocsinventory %{__perl} Makefile.PL INSTALLDIRS=vendor make %{?_smp_mflags} popd %{__cc} %{optflags} -o ipdiscover ipdiscover.c %install rm -rf %{buildroot} pushd Ocsinventory make pure_install PERL_INSTALL_ROOT=%{buildroot} find %{buildroot} -type f -name .packlist -exec rm -f {} ';' find %{buildroot} -type d -depth -exec rmdir {} 2>/dev/null ';' chmod -R u+rwX,go+rX,go-w %{buildroot}/* rm %{buildroot}%{perl_vendorlib}/Ocsinventory/ocsinventory-client.pl popd %{__install} -m 755 ipdiscover %{buildroot}%{_sbindir} %{__mkdir_p} %{buildroot}%{_localstatedir}/log/%{name} %{__mkdir_p} %{buildroot}%{_sysconfdir}/%{name} %{__install} -m 644 ocsinv.conf ocsinv.adm %{buildroot}%{_sysconfdir}/%{name} %{__mkdir_p} %{buildroot}%{_sysconfdir}/logrotate.d %{__install} -m 644 logrotate.ocsinventory-client %{buildroot}%{_sysconfdir}/logrotate.d/%{name} %{__mkdir_p} %{buildroot}%{_sysconfdir}/cron.daily %{__install} -m 755 cron %{buildroot}%{_sysconfdir}/cron.daily/%{name} %clean rm -rf %{buildroot} %post # First install : generate DEVICE_ID if [ "$1" -eq "1" ] then OCS_AGENT_DEVICE_ID=$(hostname)-$(date +%%Y-%%m-%%d-%%H-%%M-%%S) %{__perl} -pi -e "s/OCS_AGENT_DEVICE_ID/$OCS_AGENT_DEVICE_ID/" %{_sysconfdir}/%{name}/ocsinv.conf else # Update from RC3 %{__perl} -pi -e "s/>local__local__ 1.0-1 - update to 1.0 Final - add sleep in cron task (time balancing for large network) * Tue Jan 09 2007 Remi Collet 1.0-0.7.RC3 - build for RHEL2 - switch back from sed to perl (no sed -i on RHEL2) - add manual perl requires on RHEL2 - grep output of dmidecode (no --version option available on older distro) * Thu Nov 30 2006 Remi Collet 1.0-0.6.RC3 - ExclusiveArch: i386 x86_64 (no dmidecode on other arch) * Wed Nov 29 2006 Remi Collet 1.0-0.5.RC3 - Requires %%{_sysconfdir}/logrotate.d and %%{_sysconfdir}/cron.daily - define perl_vendorlib on non-fedora (for RHEL3) * Tue Nov 28 2006 Remi Collet 1.0-0.4.RC3 - requires %%{_sbindir}/dmidecode (kernel-utils in FC3) rather than dmidecode - requires perl(:MODULE_COMPAT) only on Fedora (not provided on RHEL3) - patch improved (Fedora is RPM based) * Mon Nov 27 2006 Remi Collet 1.0-0.3.RC3 - $RPM_OPT_FLAGS changed to %%{optflags}. - add not detected Requires perl(HTTP::Request) * Sun Nov 26 2006 Remi Collet 1.0-0.2.RC3 - replace perl and dos2unix by sed - split README.fedora * Sun Nov 26 2006 Remi Collet 1.0-0.1.RC3 - initial spec