Skip to content
Snippets Groups Projects
Commit 14a8d4d7 authored by Ricardo Tavares de Oliveira's avatar Ricardo Tavares de Oliveira Committed by Vinicius Ruoso
Browse files

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: default avatarDanilo K. S. Yorinori <danilok@c3sl.ufpr.br>
Acked-by: default avatarDiego Giovane Pasqualin <dgp06@c3sl.ufpr.br>
Signed-off-by: default avatarRicardo Tavares de Oliveira <rto07@c3sl.ufpr.br>
parent 6e609ec7
No related branches found
No related tags found
No related merge requests found
#!/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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment