From dfd5c542584327c9011a802d4f461738078616b1 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 22 Jun 2012 09:49:28 +0200 Subject: [PATCH] premier commit --- createlinks | 13 +++++ .../defaults/fusioninventory-agent/TCPPort | 1 + .../defaults/fusioninventory-agent/access | 1 + .../defaults/fusioninventory-agent/type | 1 + .../etc/fusioninventory/agent.cfg | 3 ++ .../templates/etc/fusioninventory/agent.cfg/10dir | 2 + .../etc/fusioninventory/agent.cfg/15server | 1 + .../templates/etc/fusioninventory/agent.cfg/20auth | 14 +++++ .../templates/etc/fusioninventory/agent.cfg/25rpc | 9 ++++ .../templates/etc/fusioninventory/agent.cfg/30tag | 1 + .../etc/fusioninventory/agent.cfg/35deploy | 10 ++++ root/var/service/fusioninventory-agent/log/run | 27 ++++++++++ root/var/service/fusioninventory-agent/run | 27 ++++++++++ smeserver-fusioninventory-agent.spec | 60 ++++++++++++++++++++++ 14 files changed, 170 insertions(+) create mode 100644 createlinks create mode 100644 root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/TCPPort create mode 100644 root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/access create mode 100644 root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/type create mode 100644 root/etc/e-smith/templates.metadata/etc/fusioninventory/agent.cfg create mode 100644 root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/10dir create mode 100644 root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/15server create mode 100644 root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/20auth create mode 100644 root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/25rpc create mode 100644 root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/30tag create mode 100644 root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/35deploy create mode 100644 root/var/service/fusioninventory-agent/log/run create mode 100644 root/var/service/fusioninventory-agent/run create mode 100644 smeserver-fusioninventory-agent.spec diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..539e7fd --- /dev/null +++ b/createlinks @@ -0,0 +1,13 @@ +#!/usr/bin/perl -w + +use esmith::Build::CreateLinks qw(:all); + +service_link_enhanced("fusioninventory-agent", "S88", "7"); +service_link_enhanced("fusioninventory-agent", "K12", "6"); +service_link_enhanced("fusioninventory-agent", "K12", "0"); +service_link_enhanced("fusioninventory-agent", "K12", "1"); + +safe_touch("root/var/service/fusioninventory-agent/down"); +safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/fusioninventory-agent'); +safe_symlink("/var/service/fusioninventory-agent" , 'root/service/fusioninventory-agent'); + diff --git a/root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/TCPPort b/root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/TCPPort new file mode 100644 index 0000000..f72d96c --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/TCPPort @@ -0,0 +1 @@ +62354 diff --git a/root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/access b/root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/access new file mode 100644 index 0000000..3e18ebf --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/access @@ -0,0 +1 @@ +private diff --git a/root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/type b/root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/type new file mode 100644 index 0000000..24e1098 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/fusioninventory-agent/type @@ -0,0 +1 @@ +service diff --git a/root/etc/e-smith/templates.metadata/etc/fusioninventory/agent.cfg b/root/etc/e-smith/templates.metadata/etc/fusioninventory/agent.cfg new file mode 100644 index 0000000..70c3562 --- /dev/null +++ b/root/etc/e-smith/templates.metadata/etc/fusioninventory/agent.cfg @@ -0,0 +1,3 @@ +PERMS=0660 +UID="root" +GID="root" diff --git a/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/10dir b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/10dir new file mode 100644 index 0000000..f222667 --- /dev/null +++ b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/10dir @@ -0,0 +1,2 @@ +share-dir=/usr/lib/perl5/vendor_perl/5.8.8/auto/share/dist/FusionInventory-Agent +basevardir=/var/lib/fusioninventory-agent diff --git a/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/15server b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/15server new file mode 100644 index 0000000..bce77a7 --- /dev/null +++ b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/15server @@ -0,0 +1 @@ +server={${'fusioninventory-agent'}{'Server'}} diff --git a/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/20auth b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/20auth new file mode 100644 index 0000000..9a9ab00 --- /dev/null +++ b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/20auth @@ -0,0 +1,14 @@ +{ +my $user = ${'fusioninventory-agent'}{'User'} || ''; +my $pass = ${'fusioninventory-agent'}{'Password'} || ''; + +if ($user ne '' and $pass ne ''){ + $OUT .=<<"EOF"; +user=$user +password=$pass +EOF +} +else{ + $OUT .= '# No authentication configured'; +} +} diff --git a/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/25rpc b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/25rpc new file mode 100644 index 0000000..2bbb0dc --- /dev/null +++ b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/25rpc @@ -0,0 +1,9 @@ +rpc-trust-localhost +rpc-port={${'fusioninventory-agent'}{'TCPPort'} || '62354'} +{ + +my $network = ${'fusioninventory-agent'}{'Networking'} || 'no'; +my $listen = ($network) ? '127.0.0.1':'0.0.0.0'; +$OUT .= "rpc-ip=$listen\n"; + +} diff --git a/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/30tag b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/30tag new file mode 100644 index 0000000..330a9da --- /dev/null +++ b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/30tag @@ -0,0 +1 @@ +tag={${'fusioninventory-agent'}{'Tag'} || $DomainName} diff --git a/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/35deploy b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/35deploy new file mode 100644 index 0000000..f3b8e65 --- /dev/null +++ b/root/etc/e-smith/templates/etc/fusioninventory/agent.cfg/35deploy @@ -0,0 +1,10 @@ +{ +my $deploy = ${'fusioninventory-agent'}{'Deploy'} || 'disabled'; + +return '' if ($deploy eq 'enabled'); + +$OUT .=<<'HERE'; +no-deploy +no-ocsdeploy +HERE +} diff --git a/root/var/service/fusioninventory-agent/log/run b/root/var/service/fusioninventory-agent/log/run new file mode 100644 index 0000000..30fb696 --- /dev/null +++ b/root/var/service/fusioninventory-agent/log/run @@ -0,0 +1,27 @@ +#!/bin/sh + +#---------------------------------------------------------------------- +# copyright (C) 2011 Firewall Services +# daniel@firewall-services.com +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +#---------------------------------------------------------------------- + +exec \ + /usr/local/bin/setuidgid smelog \ + /usr/local/bin/multilog t s5000000 \ + /var/log/inventory + diff --git a/root/var/service/fusioninventory-agent/run b/root/var/service/fusioninventory-agent/run new file mode 100644 index 0000000..fbe222f --- /dev/null +++ b/root/var/service/fusioninventory-agent/run @@ -0,0 +1,27 @@ +#!/bin/sh + +#---------------------------------------------------------------------- +# copyright (C) 2011 Firewall Services +# daniel@firewall-services.com +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +#---------------------------------------------------------------------- + +OPTIONS=$(/sbin/e-smith/db configuration getprop fusioninventory-agent getprop Options || echo '') +exec 2>&1 + +exec /usr/bin/fusioninventory-agent --daemon-no-fork \ + --info $OPTIONS diff --git a/smeserver-fusioninventory-agent.spec b/smeserver-fusioninventory-agent.spec new file mode 100644 index 0000000..de2e0ac --- /dev/null +++ b/smeserver-fusioninventory-agent.spec @@ -0,0 +1,60 @@ +%define version 0.1 +%define release 2 +%define name smeserver-fusioninventory-agent + + +Summary: FusionInventory-Agent integration on SME Server +Name: %{name} +Version: %{version} +Release: %{release}%{?dist} +License: GPL +Group: Networking/Daemons +Source: %{name}-%{version}.tar.gz + +Patch0: smeserver-fusioninventory-agent-0.1-disable_deploy.patch + +BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot +BuildArchitectures: noarch +BuildRequires: e-smith-devtools + +Requires: e-smith-base >= 5.2.0 +Requires: fusioninventory-agent + +%description +Configure FusdionInventory daemon on SME Server + +%changelog +* Mon Dec 19 2011 Daniel Berteaud - 0.2.sme +- disable deploy and ocsdeply in the default config + +* Tue Nov 29 2011 Daniel Berteaud - 0.1.sme +- initial release + +%prep +%setup -q -n %{name}-%{version} +%patch0 -p1 + +%build +%{__mkdir_p} root/var/log/inventory +perl createlinks + +%install +/bin/rm -rf $RPM_BUILD_ROOT +(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) +/bin/rm -f %{name}-%{version}-filelist +/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ + --file /var/service/fusioninventory-agent/run 'attr(0755,root,root)' \ + --file /var/service/fusioninventory-agent/log/run 'attr(0755,root,root)' \ + --dir /var/log/inventory 'attr(0750,smelog,smelog)' \ + > %{name}-%{version}-filelist + +%files -f %{name}-%{version}-filelist +%defattr(-,root,root) + +%clean +rm -rf $RPM_BUILD_ROOT + +%post + +%preun +