From 02996db3ba642944401135dab8daedf0f4922c54 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 15 Aug 2010 20:33:20 +0200 Subject: import fusioninventory-agent* --- fusioninventory-agent.cron | 37 ++++++++ fusioninventory-agent.init | 94 +++++++++++++++++++ fusioninventory-agent.spec | 221 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 352 insertions(+) create mode 100644 fusioninventory-agent.cron create mode 100755 fusioninventory-agent.init create mode 100644 fusioninventory-agent.spec diff --git a/fusioninventory-agent.cron b/fusioninventory-agent.cron new file mode 100644 index 0000000..e09c0db --- /dev/null +++ b/fusioninventory-agent.cron @@ -0,0 +1,37 @@ +#!/bin/bash +NAME=fusioninventory-agent +LOG=/var/log/$NAME/$NAME.log + +exec >>$LOG 2>&1 + +[ -f /etc/sysconfig/$NAME ] || exit 0 +source /etc/sysconfig/$NAME +export PATH + +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 '+%c')] Running $NAME $OPTS" + /usr/bin/$NAME $FUSINVOPT --logfile=$LOG $OPTS + fi + ((i++)) +done +echo "[$(date '+%c')] End of cron job ($PATH)" + diff --git a/fusioninventory-agent.init b/fusioninventory-agent.init new file mode 100755 index 0000000..e6bfffc --- /dev/null +++ b/fusioninventory-agent.init @@ -0,0 +1,94 @@ +#!/bin/bash +# +# chkconfig: 345 88 12 +# description: FusionInventory Agent +# processname: fusioninventory-agent +# config: /etc/sysconfig/fusioninventory-agent.pid +# pidfile: /var/run/fusioninventory-agent.pid + +# source function library +. /etc/rc.d/init.d/functions + +RETVAL=0 +desc="FusionInventory Agent" +prog=fusioninventory-agent +lockfile=/var/lock/subsys/$prog +pidfile=/var/run/$prog.pid +logfile=/var/log/$prog/$prog.log + +# pull in sysconfig settings +[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +# +# Function that starts the daemon/service +# +do_start() +{ + # Read configuration + i=0 + OPTS= + while [ $i -lt ${#OCSMODE[*]} ] + do + if [ ${OCSMODE[$i]:-none} == daemon ]; then + if [ ! -z "${OCSTAG[$i]}" ]; then + OPTS="$OPTS --tag=${OCSTAG[$i]}" + fi + if [ "z${OCSSERVER[$i]}" = 'zlocal' ]; then + # Local inventory + OPTS="$OPTS --local=/var/lib/$prog" + elif [ ! -z "${OCSSERVER[$i]}" ]; then + # Remote inventory + OPTS="$OPTS --server=${OCSSERVER[$i]}" + fi + fi + ((i++)) + done + if [ -n "$OPTS" ]; then + echo -n $"Starting $prog: " + daemon $prog $FUSINVOPT --logfile=$logfile --daemon $OPTS + RETVAL=$? + echo + else + RETVAL=1 + fi + [ $RETVAL -eq 0 ] && touch $lockfile +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + echo -n $"Stopping $prog: " + killproc $prog + RETVAL=$? + echo + if [ $RETVAL -eq 0 ] ; then + rm -f $lockfile $pidfile + fi +} + +case "$1" in + start) + do_start + ;; + stop) + do_stop + ;; + status) + status $prog + ;; + restart|reload|force-reload) + do_stop + do_start + ;; + condrestart) + [ -f $lockfile ] && do_stop && do_start || : + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}" + exit 1 + ;; +esac +exit $RETVAL + diff --git a/fusioninventory-agent.spec b/fusioninventory-agent.spec new file mode 100644 index 0000000..10729ce --- /dev/null +++ b/fusioninventory-agent.spec @@ -0,0 +1,221 @@ +#global gitver f7c5492 + +Name: fusioninventory-agent +Summary: FusionInventory agent +Summary(fr): Agent FusionInventory + +Version: 2.0.6 + +%if 0%{?gitver:1} +Release: 5.git%{gitver}%{?dist} +Source0: fusinv-fusioninventory-agent-2.0.4-20-gf7c5492.tar.gz +%else +Release: 1%{?dist} +Source0: http://forge.fusioninventory.org/attachments/download/66/FusionInventory-Agent-2.0.6.tar.gz +%endif + +Source1: %{name}.cron +Source2: %{name}.init + +Group: Applications/System +License: GPLv2+ +URL: http://fusioninventory.org/ + +BuildArch: noarch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: perl(Module::Install) +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +Requires: perl(LWP) perl(Net::IP) perl(HTTP::Status) perl(Net::SSLeay) perl(Crypt::SSLeay) +Requires: perl(Proc::Daemon) perl(Proc::PID::File) +# Not yet available in EPEL ... +%if %{?fedora}%{?rhel} > 4 +Requires: perl(Archive::Extract) +Requires: perl(Net::CUPS) +%endif +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig, /sbin/service +Requires(postun): /sbin/service + +%{?perl_default_filter} + + +%description +FusionInventory Agent is an application designed to help a network +or system administrator to keep track of the hardware and software +configurations of computers that are installed on the network. + +This agent can send information about the computer to a OCS Inventory NG +or GLPI server with the FusionInventory for GLPI plugin. + +You can add additional packages for optional tasks: + +* perl-FusionInventory-Agent-Task-OcsDeploy + OCS Inventory Software deployment support +* perl-FusionInventory-Agent-Task-NetDiscovery + Network Discovery support +* perl-FusionInventory-Agent-Task-SNMPQuery + SNMP Query support + + + +%description -l fr +L'agent FusionInventory est une application destinée à aider l'administrateur +système ou réseau à surveiller la configuration des machines du réseau +et les logiciels qui y sont installés. + +Cet agent peut envoyer les informations de l'ordinateur à un serveur +OCS Inventory NG ou à un serveur GLPI disposant de l'extension FusionInventory. + +Vous pouvez ajouter les paquets additionnels pour les tâches optionnelles : + +* perl-FusionInventory-Agent-Task-OcsDeploy + Gestion du déploiement logiciel OCS Inventory +* perl-FusionInventory-Agent-Task-NetDiscovery + Gestion de la découverte réseau +* perl-FusionInventory-Agent-Task-SNMPQuery + Gestion de l'interrogation SNMP + + +%prep +%if 0%{?gitver:1} +%setup -q -n fusinv-fusioninventory-agent-%{gitver} +%else +%setup -q -n FusionInventory-Agent-%{version} +%endif + +cat </dev/null ';' + +%{_fixperms} $RPM_BUILD_ROOT/* + + +%{__mkdir_p} %{buildroot}%{_localstatedir}/{log,lib}/%{name} + +%{__install} -m 644 -D logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name} +%{__install} -m 644 -D %{name}.conf %{buildroot}%{_sysconfdir}/sysconfig/%{name} +%{__install} -m 644 -D agent.cfg %{buildroot}%{_sysconfdir}/fusioninventory/agent.cfg +%{__install} -m 755 -Dp %{SOURCE1} %{buildroot}%{_sysconfdir}/cron.hourly/%{name} +%{__install} -m 755 -Dp %{SOURCE2} %{buildroot}%{_initrddir}/%{name} + + +%clean +rm -rf %{buildroot} + + +%post +/sbin/chkconfig --add %{name} + + +%preun +if [ $1 -eq 0 ] ; then + /sbin/service %{name} stop &>/dev/null + /sbin/chkconfig --del %{name} +fi +exit 0 + + +%postun +if [ $1 -ge 1 ]; then + /sbin/service %{name} condrestart &>/dev/null +fi +exit 0 + + +%files +%defattr(-, root, root, -) +%doc AUTHORS Changes LICENSE README THANKS +%dir %{_sysconfdir}/fusioninventory +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%config(noreplace) %{_sysconfdir}/fusioninventory/agent.cfg +%{_sysconfdir}/cron.hourly/%{name} +%{_initrddir}/%{name} +%{perl_vendorlib}/FusionInventory +%{_bindir}/%{name} +%exclude %{_bindir}/%{name}-config +%{_mandir}/man1/%{name}* +%{_mandir}/man3/Fusion* +%dir %{_localstatedir}/log/%{name} +%dir %{_localstatedir}/lib/%{name} + + +%changelog +* Sat May 29 2010 Remi Collet 2.0.6-1 +- update to 2.0.6 +- swicth download URL to forge + +* Wed May 12 2010 Remi Collet 2.0.5-1 +- update to 2.0.5 + +* Tue May 11 2010 Remi Collet 2.0.4-4.gitf7c5492 +- git snapshot fix perl 5.8.8 (EL5) issue + +* Sat May 08 2010 Remi Collet 2.0.4-4.gitddfdeaf +- git snapshot fix daemon issue +- add FUSINVOPT for global options (p.e.--debug) + +* Sat May 08 2010 Remi Collet 2.0.4-3 +- add support for daemon mode + +* Fri May 07 2010 Remi Collet 2.0.4-2 +- info about perl-FusionInventory-Agent-Task-OcsDeploy +- spec cleanup +- french translation +- set Net::CUPS and Archive::Extract optionnal on RHEL4 + +* Fri May 07 2010 Remi Collet 2.0.4-1 +- update to 2.0.4 which fixes important bugs when cron is used + +* Sat May 01 2010 Remi Collet 2.0.3-1 +- initial spec + -- cgit