2009-07-02 Manuel Arostegui <marostegui@artica.es>

* linux/pandora_agent.spec: RPM spec file for 3.0 version.
	This spec file builds packages for: Centos5,Fedora11,RHEL5,
	SLE9, SLE10, OpenSuse 10.3, OpenSuse 11.0.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1787 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
marostegui 2009-07-02 17:49:29 +00:00
parent 4244beaa4a
commit 2a2b40e466
2 changed files with 66 additions and 34 deletions

View File

@ -1,3 +1,9 @@
2009-07-02 Manuel Arostegui <marostegui@artica.es>
* linux/pandora_agent.spec: RPM spec file for 3.0 version.
This spec file builds packages for: Centos5,Fedora11,RHEL5,
SLE9, SLE10, OpenSuse 10.3, OpenSuse 11.0.
2009-06-11 Manuel Arostegui <marostegui@artica.es>
* linux/pandora_agent_installer: Changed the uninstall options

View File

@ -1,12 +1,11 @@
#ndora Agents
#
# Pandora Agents
#
%define name pandora_agents
%define version 1.3.1
%define name PandoraFMS_Agent
%define version 3.0.0
Summary: Pandora Agents
Name: %{name}
Version: %{version}
Release: Beta1
Release: 1
License: GPL
Vendor: Sancho Lerena <sancho.lerena@artica.es>
Source0: %{name}-%{version}.tar.gz
@ -34,54 +33,81 @@ rm -rf $RPM_BUILD_ROOT
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/
mkdir -p $RPM_BUILD_ROOT/usr/share/
mkdir -p $RPM_BUILD_ROOT/usr/share/pandora_agent
mkdir -p $RPM_BUILD_ROOT/usr/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/etc/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_out
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mv $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
%if "%{_vendor}" == "redhat"
mv $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
%else
mv $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
%endif
mv $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
#cp pandora.1 $RPM_BUILD_ROOT/usr/share/man/man1/
#cp pandora_agents.1 $RPM_BUILD_ROOT/usr/share/man/man1/
if [ -f $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}/%{name}.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/%{name}-%{version}-%{release}/%{name}.spec
mv $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.conf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.conf.rpmnew
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -rf $RPM_BUILD_ROOT
%post
echo "Pandora Agent has been placed under /usr/share/"
echo "Pandora Agent configuration file is /etc/pandora/pandora_agent.conf"
echo "Pandora Agent Daemon has been placed in /etc/init.d/pandora_agent_daemon"
mkdir -p /etc/pandora
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
%if "%{_vendor}" == "suse"
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc3.d/S99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc2.d/S99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc6.d/K99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc0.d/K99pandora_agent_daemon
%else
ln -s /etc/init.d/pandora_agent_daemon /etc/rc0.d/K99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc6.d/K99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc3.d/S99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc5.d/S99pandora_agent_daemon
%pre
%if "%{_vendor}" == "redhat"
/usr/sbin/useradd -d %{prefix}/pandora -s /sbin/nologin -M -r pandora 2>/dev/null
%endif
exit 0
%post
mkdir -p /etc/pandora
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
mv /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
echo "Pandora Agent configuration file installed as /usr/share/pandora_agent/pandora_agent.conf.rpmnew"
fi
%if "%{_vendor}" == "suse"
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc3.d/S99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc2.d/S99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc6.d/K99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc0.d/K99pandora_agent_daemon
%else
ln -s /etc/init.d/pandora_agent_daemon /etc/rc0.d/K99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc6.d/K99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc3.d/S99pandora_agent_daemon
ln -s /etc/init.d/pandora_agent_daemon /etc/rc5.d/S99pandora_agent_daemon
%endif
%preun
if [ "$1" = 0 ]; then
# stop pandora_agent silently, but only if it's running
%if "%{_vendor}" == "redhat"
/usr/sbin/service pandora_agent_daemon stop &>/dev/null
/sbin/chkconfig --del pandora_agent_daemon
/usr/sbin/userdel pandora
%endif
fi
exit 0
%files
%defattr(700,pandora,pandora)
%if "%{_vendor}" == "redhat"
/usr/bin/pandora_agent
%defattr(600,pandora,pandora)
%else
/usr/bin/pandora_agent
%endif
%defattr(700,pandora,pandora)
/var/log/pandora/
/var/spool/pandora/
%defattr(755,pandora,pandora)
/usr/bin/tentacle_client
/etc/init.d/pandora_agent_daemon
%docdir %{prefix}/pandora_agents/docs
%{prefix}/pandora_agent
#%{_mandir}/man1/pandora.1.gz
#%{_mandir}/man1/pandora_agents.1.gz