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
|
|
|
# ==================================================
|
|
|
|
# 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.
|
|
|
|
|
2010-01-13 19:33:04 +01:00
|
|
|
pandora_server_version="3.0.0"
|
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
|
|
|
|
|
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
|
|
|
|
|
2009-11-04 16:45:24 +01:00
|
|
|
echo "Make the perl of Pandora Server."
|
2009-11-03 18:18:52 +01:00
|
|
|
perl Makefile.PL
|
|
|
|
make
|
2009-12-18 19:22:33 +01:00
|
|
|
|
|
|
|
# Adjust Makefile to use our "fake" root dir to install libraries and also binaries"
|
2009-11-03 18:18:52 +01:00
|
|
|
cat Makefile | sed -e "s/PREFIX = \/usr/PREFIX = temp_package\/usr/" > Makefile.temp
|
2009-12-18 19:22:33 +01:00
|
|
|
|
|
|
|
# This is needed to create .DEB in OpenSUSE.
|
|
|
|
|
|
|
|
cat Makefile.temp | sed -e "s/INSTALLBIN = .*/INSTALLBIN = temp_package\/usr\/bin/" > Makefile
|
|
|
|
cat Makefile | sed -e "s/INSTALLSITEBIN = .*/INSTALLSITEBIN = temp_package\/usr\/bin/" > Makefile.temp
|
|
|
|
cat Makefile.temp | sed -e "s/INSTALLVENDORBIN = .*/INSTALLVENDORBIN = temp_package\/usr\/bin/" > Makefile
|
|
|
|
cat Makefile | sed -e "s/INSTALLSCRIPT = .*/INSTALLSCRIPT = temp_package\/usr\/bin/" > Makefile.temp
|
|
|
|
cat Makefile.temp | sed -e "s/INSTALLSITESCRIPT = .*/INSTALLSITESCRIPT = temp_package\/usr\/bin/" > Makefile
|
|
|
|
cat Makefile | sed -e "s/INSTALLVENDORSCRIPT = .*/INSTALLVENDORSCRIPT = temp_package\/usr\/bin/" > Makefile.temp
|
|
|
|
|
2009-11-03 18:18:52 +01:00
|
|
|
mv Makefile.temp Makefile
|
2010-01-13 19:22:52 +01:00
|
|
|
|
2009-11-03 18:18:52 +01:00
|
|
|
make install
|
|
|
|
|
2009-11-04 16:45:24 +01:00
|
|
|
echo "Copy other files in fake file."
|
2009-11-03 18:18:52 +01:00
|
|
|
cp -R DEBIAN temp_package/
|
|
|
|
|
2009-11-04 16:45:24 +01:00
|
|
|
echo "Remove the SVN files and other temp files."
|
2009-11-03 18:18:52 +01:00
|
|
|
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
|
2009-11-04 16:45:24 +01:00
|
|
|
|
2010-01-13 19:22:52 +01:00
|
|
|
echo $item | grep "perllocal.pod" > /dev/null
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
|
|
|
rm -rf $item
|
|
|
|
fi
|
|
|
|
|
2009-11-04 16:45:24 +01:00
|
|
|
echo $item | grep "make_deb_package.sh" > /dev/null
|
|
|
|
#last command success
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
|
|
|
rm -rf $item
|
|
|
|
fi
|
2009-11-03 18:18:52 +01:00
|
|
|
done
|
2009-11-04 16:45:24 +01:00
|
|
|
echo "END"
|
2009-11-03 18:18:52 +01:00
|
|
|
|
2009-11-04 16:45:24 +01:00
|
|
|
echo "Calcule md5sum for md5sums file control of package."
|
2009-11-03 18:18:52 +01:00
|
|
|
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}
|
2009-12-16 19:15:25 +01:00
|
|
|
echo $md5" "$final_path >> temp_package/DEBIAN/md5sums
|
2009-11-03 18:18:52 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2009-11-04 16:45:24 +01:00
|
|
|
echo "END"
|
2009-11-03 18:18:52 +01:00
|
|
|
|
|
|
|
echo "Make the package \"Pandorafms server\"."
|
|
|
|
dpkg-deb --build temp_package
|
2010-01-13 19:33:04 +01:00
|
|
|
mv temp_package.deb pandorafms.server_enterprise_$pandora_server_version.deb
|
|
|
|
chmod 777 pandorafms.server_enterprise_$pandora_server_version.deb
|
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-01-13 19:22:52 +01:00
|
|
|
rm Makefile
|
|
|
|
rm -rf blib
|
|
|
|
rm pm_to_blib
|
2009-11-03 18:18:52 +01:00
|
|
|
rm -rf temp_package
|