From e4b6f10c5c8f4bd2fa62cb49c6c9f290e3cb09ea Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Jun 10 2008 17:59:07 +0000 Subject: new package --- diff --git a/ocsinventory-agent-options.patch b/ocsinventory-agent-options.patch new file mode 100644 index 0000000..60a1844 --- /dev/null +++ b/ocsinventory-agent-options.patch @@ -0,0 +1,25 @@ +--- ocsinventory-agent.orig 2008-04-02 20:27:42.000000000 +0200 ++++ ocsinventory-agent 2008-04-02 20:29:12.000000000 +0200 +@@ -86,7 +86,7 @@ + "p|password=s" => \$params->{password}, + "r|realm=s" => \$params->{realm}, + "R|remotedir=s" => \$params->{remotedir}, +- "s|server=s" => \$params->{server}, ++ "s|server=s" => \$params->{optserver}, + "stdout" => \$params->{stdout}, + "t|tag=s" => \$params->{tag}, + "u|user=s" => \$params->{user}, +@@ -215,6 +215,13 @@ + $params->{nosoftware} = 1 + } + ++# allow "server" from command line when "local" in config. file ++if (defined($params->{optserver})) { ++ $params->{server}=$params->{optserver}; ++ undef $params->{local}; ++ undef $params->{optserver}; ++} ++ + if ($params->{server} !~ /^http(|s):\/\//) { + $logger->debug("the --server passed doesn't have a protocle, assume http as default"); + $params->{server} = "http://".$params->{server} diff --git a/ocsinventory-agent.README b/ocsinventory-agent.README new file mode 100644 index 0000000..9c413a6 --- /dev/null +++ b/ocsinventory-agent.README @@ -0,0 +1,25 @@ +Thie RPM install the OCS Inventory NG client +It is configure to generate, daily, a local report: + + /var/lib/ocsinventory-agent/.ocs + +If you want it to automaticaly transfer the result +to your organization communication server, or +if you want to use the ocs TAG, edit the +configuration file: + + /etc/ocsinventory/ocsinventory-agent.cfg + + +If you want to deploy this client on a important number of +computer, you can generate a already configured RPM with + +rpmbuild -bb \ + --define "ocstag tagvalue" \ + --define "ocsserver ocsserver.domain.tld:port" \ + ocsinventory-agent-.src.rpm + +Result will be : ocsinventory-agent-..noarch.rpm + +When using a personalized RPM, the cron is enabled by default. + diff --git a/ocsinventory-agent.README.fr b/ocsinventory-agent.README.fr new file mode 100644 index 0000000..28474d1 --- /dev/null +++ b/ocsinventory-agent.README.fr @@ -0,0 +1,25 @@ +Ce RPM installe l'agent d"OCS Inventory NG" +Il est configuré pour générer quotidiennement un rapport local : + + /var/lib/ocsinventory-agent/.ocs + +Si vous souhaitez transmettre ce rapport au serveur +de communication de votre organisation, ou si vous +souhaitez utiliser le TAG ocs, éditez le fichier de +configuration : + + /etc/ocsinventory/ocsinventory-agent.cfg + + +Si vous désirez déployer ce client sur un parc important, vous +pouvez générer un RPM préconfiguré à l'aide de la commande + +rpmbuild -bb \ + --define "ocstag tagvalue" \ + --define "ocsserver ocsserver.domain.tld:port" \ + ocsinventory-agent-.src.rpm + +Le résultat sera : ocsinventory-agent-..noarch.rpm + +Dans le cas d'un RPM personalisé, le "cron" est activé par défaut. + diff --git a/ocsinventory-agent.cron b/ocsinventory-agent.cron new file mode 100644 index 0000000..f4751a0 --- /dev/null +++ b/ocsinventory-agent.cron @@ -0,0 +1,35 @@ +#!/bin/bash +NAME=ocsinventory-agent + +exec >>/var/log/$NAME/$NAME.log 2>&1 + +[ -f /etc/sysconfig/$NAME ] || exit 0 +source /etc/sysconfig/$NAME + +i=0 +while [ $i -lt ${#OCSMODE[*]} ] +do + if [ ${OCSMODE[$i]:-none} == cron ]; then + OPTS= + if [ ! -z "${OCSPAUSE[$i]}" ]; then + OPTS="--wait ${OCSPAUSE[$i]}" + fi + + if [ ! -z "${OCSTAG[$i]}" ]; then + OPTS="$OPTS --tag=${OCSTAG[$i]}" + fi + + if [ "z${OCSSERVER[$i]}" = 'zlocal' ]; then + # Local inventory + OPTS="$OPTS --local=/var/lib/$NAME" + elif [ ! -z "${OCSSERVER[$i]}" ]; then + # Remote inventory + OPTS="$OPTS --lazy --server=${OCSSERVER[$i]}" + fi + echo "[$(date '+%D %T')]" Running $NAME $OPTS + /usr/sbin/$NAME $OPTS + fi + ((i++)) +done +echo "[$(date '+%D %T')]" End of cron job + diff --git a/ocsinventory-agent.logrotate b/ocsinventory-agent.logrotate new file mode 100644 index 0000000..2483628 --- /dev/null +++ b/ocsinventory-agent.logrotate @@ -0,0 +1,9 @@ +# Rotate OCS Inventory NG agent logs daily, only if not empty +# Save 7 days old logs under compressed mode +/var/log/ocsinventory-agent/*.log { + daily + rotate 7 + compress + notifempty + missingok +} diff --git a/ocsinventory-agent.spec b/ocsinventory-agent.spec new file mode 100644 index 0000000..b8c00d3 --- /dev/null +++ b/ocsinventory-agent.spec @@ -0,0 +1,252 @@ +# Can, optionaly, be define at build time (see README.RPM) +# - ocstag : administrative tag +# - ocsserver : OCS Inventory NG communication serveur + +Name: ocsinventory-agent +Summary: Open Computer and Software Inventory Next Generation client + +Version: 0.0.9.2 +Release: 1%{?dist}%{?ocstag:.%{ocstag}} + +#Source0: http://search.cpan.org/CPAN/authors/id/G/GO/GONERI/Ocsinventory-Agent-%{version}.tar.gz +Source0: http://nana.rulezlan.org/~goneri/ocsinventory-agent/Ocsinventory-Agent-nobundle-%{version}.tar.gz + +Source1: %{name}.logrotate +Source2: %{name}.cron + +Source11: %{name}.README +Source12: %{name}.README.fr + +Patch1: %{name}-options.patch + +Group: Development/Libraries +License: GPLv2 +URL: http://www.ocsinventory-ng.org/ + +BuildArch: noarch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: perl(Module::Install) perl(XML::Simple) perl(LWP) perl(Net::IP) +BuildRequires: perl(Digest::MD5) perl(File::Temp) perl(XML::SAX) +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +Requires: net-tools, pciutils +Requires: %{_sysconfdir}/logrotate.d, %{_sysconfdir}/cron.hourly +Requires: perl(HTTP::Request) +Requires: perl(Proc::Daemon) +Requires: nmap +Requires: monitor-edid +# Optionnal : dmidecode on x86, /proc in ppc +# Requires: %{_sbindir}/dmidecode +# Optionnal : ipdiscover or nmap, monitor-edid +# Requires: ocsinventory-ipdiscover, nmap, monitor-edid +Obsoletes: ocsinventory-client <= 1.01 +Provides: ocsinventory-client = 1.02 +# use the following line when version is strictly above 1.01 +# ocsinventory-client = %{version}-%{release} + + +%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} provides the client for Linux (Unified Unix Agent). + + +%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 le client pour Linux (Agent Unix Unifié) + + +%prep +%setup -q -n Ocsinventory-Agent-%{version} + +%patch1 -p0 + +cat <%{name}.conf +# +# OCS Inventory "Unix Unified Agent" Configuration File +# used by hourly cron job +# +%if 0%{?ocsserver:1} +# Mode, change to "none" to disable +OCSMODE[0]=cron + +%else +# Mode, change to "cron" to activate +OCSMODE[0]=none + +%endif + +# can be used to override the %{name}.cfg setup. +# OCSSERVER[0]=http://your.ocsserver.name/ocsinventory +# +# corresponds with --local=%{_localstatedir}/lib/%{name} +# OCSSERVER[0]=local + +# Wait before inventory +OCSPAUSE[0]=100 + +# Administrative TAG (optional, must be filed before first inventory) +OCSTAG[0]=%{?ocstag} +EOF + +cat <%{name}.cfg +# +# OCS Inventory "Unix Unified Agent" Configuration File +# +# options used by cron job overides this (see /etc/sysconfig/%{name}) +# + +%if 0%{?ocsserver:1} +server = http://%{ocsserver}/ocsinventory +%else +# Server URL, unconmment if needed +# server = http://your.ocsserver.name/ocsinventory +local = %{_localstatedir}/lib/%{name} +%endif + +# Administrative TAG (optional, must be filed before first inventory) +# tag = your_tag + +# How to log, can be File,Stderr,Syslog +logger = Stderr +logfile = %{_localstatedir}/log/%{name}/%{name}.log +EOF + +cp %{SOURCE11} README.RPM +cp %{SOURCE12} README.RPM.fr + + +%build +%{__perl} Makefile.PL INSTALLDIRS=vendor +make %{?_smp_mflags} + + +%install +rm -rf %{buildroot} + +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}/* + +# Move exe to root directory +mv %{buildroot}%{_bindir} %{buildroot}%{_sbindir} + +%{__mkdir_p} %{buildroot}%{_localstatedir}/{log,lib}/%{name} +%{__mkdir_p} %{buildroot}%{_sysconfdir}/{logrotate.d,sysconfig,cron.hourly,ocsinventory} + +%{__install} -pm 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} +%{__install} -m 644 %{name}.conf %{buildroot}%{_sysconfdir}/sysconfig/%{name} + +sed -e 's;/etc/;%{_sysconfdir}/;' \ + -e 's;/var/;%{_localstatedir}/;' \ + -e 's;/usr/sbin/;%{_sbindir}/;' \ + %{SOURCE2} > %{buildroot}%{_sysconfdir}/cron.hourly/%{name} +chmod +x %{buildroot}%{_sysconfdir}/cron.hourly/%{name} + +%{__install} -m 644 %{name}.cfg %{buildroot}%{_sysconfdir}/ocsinventory/%{name}.cfg + +# Remove some unusefull files (which brings unresolvable deps) +rm -rf %{buildroot}%{perl_vendorlib}/Ocsinventory/Agent/Backend/OS/Win32* + +# Only need for manual installation +rm %{buildroot}%{perl_vendorlib}/Ocsinventory/postinst.pl + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-, root, root, -) +%doc AUTHORS Changes LICENSE README THANKS README.RPM +%lang(fr) %doc README.RPM.fr +%{perl_vendorlib}/Ocsinventory +%{_sbindir}/%{name} +%dir %{_localstatedir}/log/%{name} +%dir %{_localstatedir}/lib/%{name} +%dir %{_sysconfdir}/ocsinventory +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%config(noreplace) %{_sysconfdir}/ocsinventory/%{name}.cfg +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%{_sysconfdir}/cron.hourly/%{name} +%{_mandir}/man1/%{name}.* + + +%changelog +* Sun Apr 20 2008 Remi Collet 0.0.9.2-1 +- update to 0.0.9.2 (minor bug fix) + +* Mon Apr 07 2008 Remi Collet 0.0.9.1-2 +- add Requires monitor-edid + +* Thu Apr 03 2008 Remi Collet 0.0.9.1-1 +- update to 0.0.9.1 (minor bug fix) +- swicth back to nobundle sources + +* Wed Apr 02 2008 Remi Collet 0.0.9-1 +- update to 0.0.9 finale +- provides default config to file (need options.patch) +- add requires nmap (for ipdiscover) +- add BR perl(XML::SAX) (to avoid install of bundled one) + +* Mon Mar 10 2008 Remi Collet 0.0.8.2-0.6.20080305 +- rebuild against perl 5.10 + +* Fri Mar 7 2008 Remi Collet 0.0.8.2-0.5.20080305 +- patches from review (Patrice Dumas) + +* Wed Mar 5 2008 Remi Collet 0.0.8.2-0.4.20080305 +- update to 2008-03-05 +- add /etc/sysconfig/ocsinventory-agent config file for cron job + +* Mon Mar 3 2008 Remi Collet 0.0.8.2-0.3.20080302 +- only enable cron when server is configured + +* Sun Mar 2 2008 Remi Collet 0.0.8.2-0.2.20080302 +- from Review, see #435593 + +* Sun Mar 2 2008 Remi Collet 0.0.8.2-0.1.20080302 +- update to 0.0.8.2 from CVS + +* Fri Feb 22 2008 Remi Collet 0.0.8.2-0.1.20080222 +- update to 0.0.8.2 from CVS + +* Sun Feb 17 2008 Remi Collet 0.0.8.1-0.1.20080217 +- update to 0.0.8.1 from CVS +- change config file used + from /etc/ocsinventory-agent/ocsinv.conf + to /etc/ocsinventory/ocsinventory-agent.cfg + +* Sat Jan 26 2008 Remi Collet 0.0.7-1 +- update to 0.0.7 + +* Sat Dec 28 2007 Remi Collet 0.0.6.2-1 +- update to 0.0.6.2 + +* Mon Apr 16 2007 Remi Collet 0.0.6-1 +- update to 0.0.6 + +* Sat Feb 10 2007 Remi Collet 0.0.5-0.20070409 +- cvs update 20070409 +- create cron.daily file +- create logrotate.d file +- create ocsinv.conf +- cvs update 20070405 +- cvs update 20070403 + +* Sat Feb 10 2007 Remi Collet 0.0.2-0.20070210 +- initial spec diff --git a/sources b/sources index e69de29..a7687fb 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +8c2ae7ce0505e571546ccc5b0cec353d Ocsinventory-Agent-nobundle-0.0.9.2.tar.gz