From 14a8d4d7a2d8e45492f3a49ab24b0412e3453584 Mon Sep 17 00:00:00 2001 From: Ricardo Tavares de Oliveira <rto07@c3sl.ufpr.br> Date: Thu, 27 May 2010 15:24:27 -0300 Subject: [PATCH] build-debian-package: Created a script to build the debian package This script will build the debian package by compiling getSchoolInfo, copying the agent files to the debian package directory structure and building the debian package itself. Acked-by: Danilo K. S. Yorinori <danilok@c3sl.ufpr.br> Acked-by: Diego Giovane Pasqualin <dgp06@c3sl.ufpr.br> Signed-off-by: Ricardo Tavares de Oliveira <rto07@c3sl.ufpr.br> --- proinfodatadeb/build-debian-package | 102 ++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 proinfodatadeb/build-debian-package diff --git a/proinfodatadeb/build-debian-package b/proinfodatadeb/build-debian-package new file mode 100755 index 0000000..d013c7a --- /dev/null +++ b/proinfodatadeb/build-debian-package @@ -0,0 +1,102 @@ +#!/bin/bash +# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre +# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR +# +# This file is part of buildpackage +# +# buildpackage is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. + +DIR=$(dirname $0) + +printf "Make sure client was already compiled. If you don't think so, run \ +build-agent-files. Continue? [y/N] " +read ans +if [[ "$ans" != "y" ]]; then + printf "Aborting.\n" + exit 0 +fi + +printf "Do you want to create a package without INEP request while boot? \ +(Needed if you want to create a package for RUCA project)? [y/N] " +read inepreq + +# Do not compile getSchoolInfo if there will not be the INEP request +if [[ "${inepreq}" != "y" ]]; then + printf "Compiling getSchoolInfo..." + + cd ${DIR}/getSchoolInfo + make + if test $? -ne 0 ; then + printf "Error while compiling getSchoolInfo! Aborting.\n" + exit 1 + fi + cd - &> /dev/null + printf "done.\n" +fi + +# Always copy the agent files +printf "Copying agent files..." + +DESTDIR=${DIR}/package/opt/seed_mec/SEED2 +mkdir -p ${DESTDIR} +cp -a ${DIR}/../agent/agent-files/SEED2-run/* ${DESTDIR} + +printf "done.\n" + +printf "Generating Debian Package..." + +# Remove /etc/{init.d/*,rc2.d/*} if there will not be the INEP request +if [[ "${inepreq}" == "y" ]]; then + TMPDIR=$(mktemp -d) + cp -a ${DIR}/package/etc/ ${TMPDIR} + rm -rf ${DIR}/package/etc +fi + +fakeroot dpkg -b package ${DIR} + +if [[ "${inepreq}" == "y" ]]; then + # Restore /etc directory + cp -a ${TMPDIR}/etc ${DIR}/package + rm -rf ${TMPDIR} +fi + +if test $? -ne 0 ; then + printf "Error while generating Debian package! Aborting.\n" + exit 2 +fi + +printf "done.\n" + +printf "Cleaning..." + +cd ${DIR}/getSchoolInfo +make distclean +makeret=$? + +cd - &>/dev/null +rm -rf ${DIR}/package/opt/ +rmret1=$? + +rm -rf ${DIR}/package/usr/ +rmret2=$? + +# If $makeret is equal to zero OR $rmret is equal to zero OR $rmret2 is +# equal to zero, print an error, but do not abort. +if test $makeret -ne 0 -o $rmret1 -ne 0 -o $rmret2 -ne 0; then + printf "Warning while cleaning!\n" +fi + +printf "done.\n" -- GitLab