2010-05-19 19:12:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#Pandora FMS- http:#pandorafms.com
|
|
|
|
# ==================================================
|
|
|
|
# Copyright (c) 2005-2010 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.
|
|
|
|
|
2010-06-08 19:06:14 +02:00
|
|
|
pandora_version="3.1"
|
2010-05-19 19:12:25 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "Make a \"temp_package\" temp dir for job."
|
2010-05-20 18:16:34 +02:00
|
|
|
|
|
|
|
mkdir -p temp_package/usr
|
|
|
|
mkdir -p temp_package/usr/share/pandora_agent/
|
|
|
|
mkdir -p temp_package/usr/bin/
|
|
|
|
mkdir -p temp_package/usr/sbin/
|
2010-06-01 15:11:02 +02:00
|
|
|
mkdir -p temp_package/etc/pandora/plugins
|
2010-05-19 19:12:25 +02:00
|
|
|
mkdir -p temp_package/etc/init.d/
|
2010-05-20 18:16:34 +02:00
|
|
|
mkdir -p temp_package/var/log/pandora/
|
2010-06-09 14:15:48 +02:00
|
|
|
mkdir -p temp_package/usr/share/man/man1/
|
2010-05-19 19:12:25 +02:00
|
|
|
|
|
|
|
echo "Make directory system tree for package."
|
|
|
|
cp DEBIAN temp_package -R
|
2010-05-20 15:09:50 +02:00
|
|
|
chmod 755 -R temp_package/DEBIAN
|
2010-05-19 19:12:25 +02:00
|
|
|
|
2010-05-20 18:16:34 +02:00
|
|
|
cp -aRf * temp_package/usr/share/pandora_agent/
|
|
|
|
cp -aRf tentacle_client temp_package/usr/bin/
|
|
|
|
cp -aRf pandora_agent temp_package/usr/bin/
|
2010-06-18 14:36:19 +02:00
|
|
|
cp -aRf pandora_exec temp_package/usr/bin/
|
2010-05-20 18:16:34 +02:00
|
|
|
cp -aRf pandora_agent_daemon temp_package/etc/init.d/pandora_agent_daemon
|
|
|
|
cp Linux/pandora_agent.conf temp_package/etc/pandora/
|
2010-05-19 19:12:25 +02:00
|
|
|
|
2010-06-09 14:15:48 +02:00
|
|
|
cp -aRf man/man1/* temp_package/usr/share/man/man1/
|
|
|
|
|
2010-05-19 19:12:25 +02:00
|
|
|
echo "Remove the SVN files and other temp 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
|
|
|
|
|
|
|
|
echo $item | grep "make_deb_package.sh" > /dev/null
|
|
|
|
#last command success
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
|
|
|
rm -rf $item
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "END"
|
|
|
|
|
|
|
|
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 "END"
|
|
|
|
|
|
|
|
echo "Make the package \"Pandorafms console\"."
|
|
|
|
dpkg-deb --build temp_package
|
2010-05-20 20:12:26 +02:00
|
|
|
mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb
|
2010-05-19 19:12:25 +02:00
|
|
|
|
|
|
|
echo "Delete the \"temp_package\" temp dir for job."
|
|
|
|
rm -rf temp_package
|