From 6fa9c2ce2495f644e2a62e23379c48f6f81a3adb Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 30 Oct 2009 09:09:00 +0000 Subject: [PATCH] 2009-10-30 Miguel de Dios * DEBIAN/control, DEBIAN/md5sums, DEBIAN/postinst, DEBIAN/prerm, DEBIAN/conffiles: debian base files for to make a .deb package. * make_deb_package.sh: shell script for make automatically the deb package for standard installation in a Debian Lenny, this script make a package "pandorafms.agent_3.0.0.rc1.deb". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2060 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/ChangeLog | 8 ++ pandora_agents/linux/make_deb_package.sh | 125 +++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 pandora_agents/linux/make_deb_package.sh diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index ecc6f01bca..ea98f415ce 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,11 @@ +2009-10-30 Miguel de Dios + + * DEBIAN/control, DEBIAN/md5sums, DEBIAN/postinst, DEBIAN/prerm, + DEBIAN/conffiles: debian base files for to make a .deb package. + * make_deb_package.sh: shell script for make automatically the deb package + for standard installation in a Debian Lenny, this script make a package + "pandorafms.agent_3.0.0.rc1.deb". + 2009-10-26 Sancho Lerena * Updated conf files: temporal variable to use /tmp by default. diff --git a/pandora_agents/linux/make_deb_package.sh b/pandora_agents/linux/make_deb_package.sh new file mode 100644 index 0000000000..a64298b704 --- /dev/null +++ b/pandora_agents/linux/make_deb_package.sh @@ -0,0 +1,125 @@ +#!/bin/bash + +#Pandora FMS- http:#pandorafms.com +# ================================================== +# Copyright (c) 2005-2009 Artica Soluciones Tecnologicas +# Please see http:#pandorafms.org for full contribution list + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; version 2 + +# 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. + +pandora_agent_version="3.0.0.rc1" + +echo Test if you has the tools for to make the packages. +whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null +if [ $? = 1 ] +then + echo No found \"dpkg-deb\" aplication, please install. + exit 1 +else + echo Found \"dpkg-debs\". +fi + +echo Make a \"temp_package\" temp dir for job. +mkdir temp_package +mkdir temp_package/usr +mkdir temp_package/usr/bin +mkdir temp_package/usr/share +mkdir temp_package/usr/share/pandora_agent +mkdir temp_package/var +mkdir temp_package/var/spool +mkdir temp_package/var/spool/pandora +mkdir temp_package/var/spool/pandora/data_out +mkdir temp_package/var/log +mkdir temp_package/var/log/pandora/ +mkdir temp_package/etc +mkdir temp_package/etc/pandora +mkdir temp_package/etc/init.d/ + +echo Make directory system tree for package. +cp DEBIAN temp_package -R + +PANDORA_LOG=temp_package/var/log/pandora/pandora_agent.log +PANDORA_BIN=temp_package/usr/bin +PANDORA_HOME=temp_package/usr/share/pandora_agent +TENTACLE=temp_package/usr/bin/tentacle_client +PANDORA_CFG=temp_package/etc/pandora +PANDORA_STARTUP=temp_package/etc/init.d/pandora_agent_daemon + +# Create logfile +if [ ! -z "`touch $PANDORA_LOG`" ] +then + echo "Seems to be a problem generating logfile ($PANDORA_LOG) please check it"; + exit +else + echo "Creating logfile at $PANDORA_LOG..." +fi + +# Copying agent +echo "Copying Pandora FMS Agent to $PANDORA_BIN..." +cp pandora_agent $PANDORA_BIN + +echo "Copying Pandora FMS Agent contrib dir to $PANDORA_HOME/..." +cp pandora_agent_daemon $PANDORA_HOME + +echo "Copying default agent configuration to $PANDORA_HOME/pandora_agent.conf" +cp pandora_agent.conf $PANDORA_HOME/pandora_agent.conf + +echo "Copying Pandora FMS Agent plugins to $PANDORA_HOME/plugins..." +cp -r plugins $PANDORA_HOME + +echo "Copying tentacle client to $TENTACLE" +cp tentacle_client $TENTACLE + +echo "Linking start-up daemon script at $PANDORA_STARTUP"; +cp pandora_agent_daemon $PANDORA_STARTUP + +touch $PANDORA_CFG/pandora_agent.conf + +echo Remove the SVN files. +for item in `find temp_package` +do + echo -n "." + echo $item | grep "svn" > /dev/null + #last command success + if [ $? -eq 0 ] + then + rm -rf $item + fi +done + +echo "" + +echo Calcule md5sum for md5sums file control of package +for item in `find temp_package` +do + echo -n "." + if [ ! -d $item ] + then + echo $item | grep "DEBIAN" > /dev/null + #last command success + if [ $? -eq 1 ] + then + md5=`md5sum $item | cut -d" " -f1` + + #delete "temp_package" in the path + final_path=${item#temp_package} + echo $md5" "$final_path >> temp_package/DEBIAN/md5sums + fi + fi +done + +echo "" + +echo Make the package \"Pandorafms console\". +dpkg-deb --build temp_package +mv temp_package.deb pandorafms.agent_$pandora_agent_version.deb + +echo Delete the \"temp_package\" temp dir for job. +rm -rf temp_package