2009-11-03 18:18:52 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2009-11-10 01:33:16 +01:00
|
|
|
# Pandora FMS- http://pandorafms.com
|
2009-11-03 18:18:52 +01:00
|
|
|
# ==================================================
|
2010-02-23 18:49:05 +01:00
|
|
|
# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
2009-11-03 18:18:52 +01:00
|
|
|
# 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.
|
|
|
|
|
2017-10-11 00:01:25 +02:00
|
|
|
pandora_version="7.0NG.713-171011"
|
2009-11-03 18:18:52 +01:00
|
|
|
|
2010-11-25 23:48:13 +01:00
|
|
|
package_cpan=0
|
2010-05-19 19:09:15 +02:00
|
|
|
package_pandora=1
|
|
|
|
for param in $@
|
|
|
|
do
|
|
|
|
if [ $param = "-h" -o $param = "--help" ]
|
|
|
|
then
|
|
|
|
echo "For only make packages of cpan type +cpan"
|
|
|
|
echo "For not make packages of cpan type -cpan"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $param = "+cpan" ]
|
|
|
|
then
|
|
|
|
package_pandora=0
|
|
|
|
fi
|
|
|
|
if [ $param = "-cpan" ]
|
|
|
|
then
|
|
|
|
package_cpan=0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2009-11-03 18:18:52 +01:00
|
|
|
echo "This script to make deb must run as root (because the dh-make-perl need this). Then test if you are root."
|
|
|
|
if [ `id -u` != 0 ]
|
|
|
|
then
|
|
|
|
echo "You aren't root."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2010-05-19 19:09:15 +02:00
|
|
|
if [ $package_cpan -eq 1 ]
|
2010-01-14 10:02:49 +01:00
|
|
|
then
|
2010-05-19 19:09:15 +02:00
|
|
|
echo "Test if you has the tools for to make the packages."
|
|
|
|
whereis dh-make-perl | cut -d":" -f2 | grep dh-make-perl > /dev/null
|
|
|
|
if [ $? = 1 ]
|
|
|
|
then
|
|
|
|
echo "No found \"dh-make-perl\" aplication, please install."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Found \"dh-make-perl\"."
|
|
|
|
fi
|
2010-01-14 10:02:49 +01:00
|
|
|
fi
|
|
|
|
|
2009-11-04 16:45:24 +01:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "Make a \"temp_package\" temp dir for job."
|
2009-11-03 18:18:52 +01:00
|
|
|
mkdir temp_package
|
|
|
|
|
2010-05-19 19:58:52 +02:00
|
|
|
if [ $package_pandora -eq 1 ]
|
|
|
|
then
|
2010-06-08 16:41:18 +02:00
|
|
|
mkdir -p temp_package/usr/bin/
|
|
|
|
mkdir -p temp_package/usr/sbin/
|
|
|
|
mkdir -p temp_package/etc/init.d/
|
2016-04-24 00:35:03 +02:00
|
|
|
mkdir -p temp_package/lib/systemd/system/
|
2010-06-08 16:41:18 +02:00
|
|
|
mkdir -p temp_package/etc/pandora/
|
|
|
|
mkdir -p temp_package/var/spool/pandora/data_in
|
2010-09-23 14:06:15 +02:00
|
|
|
chmod 770 temp_package/var/spool/pandora/data_in
|
2010-06-08 16:41:18 +02:00
|
|
|
mkdir -p temp_package/var/spool/pandora/data_in/conf
|
|
|
|
mkdir -p temp_package/var/spool/pandora/data_in/md5
|
2010-07-19 12:49:40 +02:00
|
|
|
chmod 770 temp_package/var/spool/pandora/data_in/md5
|
2010-07-19 12:17:17 +02:00
|
|
|
mkdir -p temp_package/var/spool/pandora/data_in/collections
|
2010-07-19 12:49:40 +02:00
|
|
|
chmod 770 temp_package/var/spool/pandora/data_in/collections
|
2012-01-24 19:46:00 +01:00
|
|
|
mkdir -p temp_package/var/spool/pandora/data_in/netflow
|
|
|
|
chmod 770 temp_package/var/spool/pandora/data_in/netflow
|
2016-06-13 14:34:30 +02:00
|
|
|
mkdir -p temp_package/var/spool/pandora/data_in/trans
|
|
|
|
chmod 770 temp_package/var/spool/pandora/data_in/trans
|
2010-06-08 16:41:18 +02:00
|
|
|
mkdir -p temp_package/var/log/pandora/
|
|
|
|
mkdir -p temp_package/usr/share/pandora_server/conf/
|
|
|
|
mkdir -p temp_package/usr/lib/perl5/
|
2010-06-09 14:13:37 +02:00
|
|
|
mkdir -p temp_package/usr/share/man/man1/
|
2015-11-16 17:29:58 +01:00
|
|
|
mkdir -p temp_package/etc/logrotate.d/
|
2010-06-08 16:41:18 +02:00
|
|
|
|
|
|
|
cp -aRf bin/pandora_server temp_package/usr/bin/
|
2010-11-10 13:59:07 +01:00
|
|
|
cp -aRf bin/pandora_exec temp_package/usr/bin/pandora_exec.server
|
2010-06-08 16:41:18 +02:00
|
|
|
cp -aRf bin/tentacle_server temp_package/usr/bin/
|
|
|
|
|
|
|
|
cp -aRf conf/* temp_package/usr/share/pandora_server/conf/
|
|
|
|
cp -aRf util temp_package/usr/share/pandora_server/
|
|
|
|
cp -aRf lib/* temp_package/usr/lib/perl5/
|
2014-09-15 11:33:53 +02:00
|
|
|
cp -aRf AUTHORS COPYING README temp_package/usr/share/pandora_server/
|
2010-06-08 16:41:18 +02:00
|
|
|
|
|
|
|
cp -aRf util/pandora_server temp_package/etc/init.d/
|
|
|
|
cp -aRf util/tentacle_serverd temp_package/etc/init.d/
|
2016-04-24 00:35:03 +02:00
|
|
|
|
|
|
|
cp -aRf util/pandora_server.service temp_package/lib/systemd/system/
|
|
|
|
cp -aRf util/tentacle_serverd.service temp_package/lib/systemd/system/
|
2010-06-08 16:41:18 +02:00
|
|
|
|
2010-06-09 14:13:37 +02:00
|
|
|
cp -aRf man/man1/* temp_package/usr/share/man/man1/
|
|
|
|
|
2015-11-16 17:29:58 +01:00
|
|
|
cp -aRf util/pandora_server_logrotate temp_package/etc/logrotate.d/pandora_server
|
|
|
|
|
2010-06-08 16:41:18 +02:00
|
|
|
rm -f temp_package/usr/share/pandora_server/util/PandoraFMS
|
|
|
|
rm -f temp_package/usr/share/pandora_server/bin/PandoraFMS
|
2014-01-16 18:44:41 +01:00
|
|
|
rm -f temp_package/usr/share/pandora_server/util/recon_scripts/PandoraFMS
|
2010-05-19 19:58:52 +02:00
|
|
|
|
2010-05-20 12:58:40 +02:00
|
|
|
cp -R DEBIAN temp_package/
|
2010-05-20 15:07:43 +02:00
|
|
|
chmod 755 -R temp_package/DEBIAN
|
2010-05-20 12:58:40 +02:00
|
|
|
|
2010-05-19 19:09:15 +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
|
2009-11-03 18:18:52 +01:00
|
|
|
#last command success
|
2010-05-19 19:09:15 +02:00
|
|
|
if [ $? -eq 0 ]
|
2009-11-03 18:18:52 +01:00
|
|
|
then
|
2010-05-19 19:09:15 +02:00
|
|
|
rm -rf $item
|
2009-11-03 18:18:52 +01:00
|
|
|
fi
|
2010-05-19 19:09:15 +02:00
|
|
|
|
|
|
|
echo $item | grep "make_deb_package.sh" > /dev/null
|
|
|
|
#last command success
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
|
|
|
rm -rf $item
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "END"
|
2010-05-20 12:58:40 +02:00
|
|
|
|
|
|
|
echo " "
|
|
|
|
pwd
|
|
|
|
echo " "
|
2010-05-19 19:09:15 +02:00
|
|
|
|
|
|
|
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
|
2009-11-03 18:18:52 +01:00
|
|
|
|
2010-05-19 19:09:15 +02:00
|
|
|
echo "END"
|
2010-01-14 10:02:49 +01:00
|
|
|
|
2010-05-19 19:09:15 +02:00
|
|
|
echo "Make the package \"Pandorafms server\"."
|
|
|
|
dpkg-deb --build temp_package
|
2010-05-20 15:07:43 +02:00
|
|
|
mv temp_package.deb pandorafms.server_$pandora_version.deb
|
|
|
|
chmod 777 pandorafms.server_$pandora_version.deb
|
2010-05-19 19:09:15 +02:00
|
|
|
fi
|
2010-01-14 10:02:49 +01:00
|
|
|
|
2010-05-19 19:09:15 +02:00
|
|
|
if [ $package_cpan -eq 1 ]
|
|
|
|
then
|
|
|
|
echo "Make the package \"libnet-traceroute-pureperl-perl\"."
|
|
|
|
cd temp_package
|
|
|
|
dh-make-perl --build --cpan Net::Traceroute::PurePerl
|
|
|
|
chmod 777 libnet-traceroute-pureperl-perl*.deb
|
|
|
|
mv libnet-traceroute-pureperl-perl*.deb ..
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "Make the package \"libnet-traceroute-perl\"."
|
|
|
|
cd temp_package
|
|
|
|
dh-make-perl --build --cpan Net::Traceroute
|
|
|
|
chmod 777 libnet-traceroute-perl*.deb
|
|
|
|
mv libnet-traceroute-perl*.deb ..
|
|
|
|
cd ..
|
|
|
|
fi
|
2009-11-03 18:18:52 +01:00
|
|
|
|
2009-11-04 16:45:24 +01:00
|
|
|
echo "Delete the \"temp_package\" temp dir for job."
|
2010-05-20 15:07:43 +02:00
|
|
|
rm -rf temp_package
|