Commit 251ef5cb authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci

Merge remote branch 'buildpackage/master'

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
parents 7599cbac edc57d72
C3SL - Centro de Computacao Cientifica e Software Livre
Agtha Cristina de Nadai
Adriano da Luz
Aryane Ast dos Santos
Bruno Cesar Ribas
Carlos Carvalho
Cleide Luzia Bonfim Possamai
Daniel Weingaertner
Danilo Kiyoshi Simizu Yorinori
Diego Giovane Pasqualin
Eduardo Cunha de Almeida
Erik Alexandre Pucci
Fabiano Silva
Felipe Cys Laskoski
Guilherme Zasyeki Machado
Jorge Augusto Meira
Josiney de Souza
Juliana Bueno
Klismann Smoger Mottin
Luis Carlos Erpen de Bona
Marcos Castilho
Marcos Sunye
Pedro Eugenio Rocha
Renan Franca De Miranda
Ricardo Tavares De Oliveira
Rubens Massayuki Suguimoto
Thiago Henrique Dos Santos Picharski
Tiago Rodrigo Kepe
Victor Tarabola Cortiano
Vinicius Kwiecien Ruoso
This diff is collapsed.
#!/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.
# This is the installation bootstrap
# This function checks the integrity of tar package
verify_md5(){
printf "Verificando MD5... " >&3
if [[ ${MD5_CHECK} == $(md5sum ${FILE} | awk '{print $1}') ]] ; then
printf "OK!\n" >&3
else
printf "ERRO: Este pacote está corrompido. %b" \
"Por favor, faça um novo download.\n" >&3
rm -rf "${FILE}" &> /dev/null
exit 4
fi
}
# This function collects the agent log, data and runs some tests, in case some
# error ocurred during the installation
collect_information(){
printf "\nAlgumas informações referentes ao agente PROINFODATA %b%b%b%b" \
"recém instalado serão coletadas. O resultado da coleta " \
"será armazenado no arquivo temporário \"${LOGFILE}\". Favor " \
"enviar esse arquivo para \"proinfodata@c3sl.ufpr.br\". Assim " \
"a equipe ficará ciente do problema para resolvê-lo.\n\n" >&3
printf "Iniciando coleta das informações (isso pode demorar alguns %b" \
"minutos)... " >&3
printf " Configuration files\n%b" \
" ===================\n\n"
printf "version\n"
cat ${AGENT_DIR}/client/conf/version
printf "proxy\n"
cat ${AGENT_DIR}/client/conf/proxy
printf "inep\n"
cat ${AGENT_DIR}/client/conf/inep
printf "\n\n----------------------------------\n\n"
printf " OS information\n%b" \
" ==============\n\n"
printf "Distro\n"
DISTRO=$(cut -sd ' ' -f1 /etc/issue | head -n 1)
if test -f "/etc/le_version"; then
printf "Linux Educacional $(cat /etc/le_version)\n"
elif test "${DISTRO}" = "Ubuntu" -a -f "/usr/lib/edu/fbedu/tutorial.htm"; then
printf "Linux Educacional\n"
fi
printf "Kernel\n"
cut -d " " -f3 /proc/version
printf "\n\n----------------------------------\n\n"
printf " Commands\n%b" \
" ========\n\n"
printf "seed_mec user crontab\n"
crontab -u seed_mec -l
printf "ifconfig\n"
/sbin/ifconfig
printf "route\n"
/sbin/route
printf "Routes test\n"
for interface in $(/sbin/route | grep default | awk '{print $NF}'); do
printf "Tested interface: ${interface}\n"
# Send ICMP ECHO_REQUEST to root server I or J
ping -c 1 -I ${interface} 192.36.148.17
ping -c 1 -I ${interface} 192.58.128.30
done
printf "\n\n----------------------------------\n\n"
printf " seed_mec user files\n%b" \
" ===================\n\n"
ls -lR "${SEED_MEC_HOME}"
printf "\n\n----------------------------------\n\n"
printf " Inventory XML\n%b" \
" =============\n\n"
cat ${AGENT_DIR}/data/collect-data.xml
printf "\n\n----------------------------------\n\n"
printf " run.sh\n%b" \
" ========\n\n"
cat ${AGENT_DIR}/client/run.sh
printf "\n\n----------------------------------\n\n"
printf " agent.sh\n%b" \
" ========\n\n"
cat ${AGENT_DIR}/agent.sh
printf "\n\n----------------------------------\n\n"
printf " Collect agent log\n%b" \
" =================\n\n"
cat ${AGENT_DIR}/log/collect.log
printf "\n\n----------------------------------\n\n"
printf " Web service client log\n%b" \
" ======================\n\n"
cat ${AGENT_DIR}/client/run.log
printf "\n\n----------------------------------\n\n"
printf " TincUCA client log\n%b" \
" ==================\n\n"
cat ${AGENT_DIR}/log/tincucaclient-install.log
printf "\n\n----------------------------------\n\n"
printf "feito!\n\nFavor enviar o arquivo temporário \"${LOGFILE}\"%b%b%b" \
" para \"proinfodata@c3sl.ufpr.br\".\n\n" \
"Em caso de dúvidas, acesse o portal do PROINFODATA:\n" \
"seed.c3sl.ufpr.br\n" >&3
}
printf "Iniciando instalação do agente PROINFODATA. Tenha certeza de %b%b%b" \
"estar conectado à Internet e executando este arquivo como super-" \
"usuário (root). Além disso, para o agente funcionar é necessário " \
"ter instalado no sistema os pacotes \"cron\" e \"sudo\".\n"
# These variables will be replaced when generating the installation package
MD5_CHECK=
BOOTSTRAP_LINES=
# Set variables
FILE="SEED2.tgz"
PROJECTOR=$(grep "Projetor ProInfo" /etc/issue 2> /dev/null)
UCA_SERVER=$(grep "Metasys School Server" /etc/issue 2> /dev/null)
UCA_CLASSMATE=$(grep "Metasys ClassmatePC" /etc/issue 2> /dev/null)
if test -f "/usr/sbin/projetor" -o -n "${PROJECTOR}"; then
SEED_MEC_HOME="/mnt/conf/seed_mec"
else
SEED_MEC_HOME="/opt/seed_mec"
fi
AGENT_DIR="${SEED_MEC_HOME}/SEED2"
LOGFILE=/tmp/collected-information.log
# Save stdout to file descriptor 3 and redirect all output to $LOGFILE
exec 3>&1 &> ${LOGFILE}
# Create seed_mec group and exit on error (except by the error of previous
# existence of seed_mec group)
if ! groupadd -f seed_mec; then
printf "ERRO: Falha ao criar o grupo seed_mec.\n"
exit 1
fi
# Create the directory path to make sure useradd(1) will be able to create the
# home for seed_mec user
mkdir -p "$(dirname ${SEED_MEC_HOME})"
# This is a temporary skel directory to avoid installing in the default skel
TMPSKEL=$(mktemp -d)
# Create seed_mec user with seed_mec as group, BASH as default shell,
# $SEED_MEC_HOME as home and $TMPSKEL as temporary skel
useradd -m -g seed_mec -s /bin/bash -d "${SEED_MEC_HOME}" \
-k "${TMPSKEL}" seed_mec
RETVAL=$?
# If an error occurred (return isn't 0), besides the previous existence of
# seed_mec user (return 9, which means the agent will be reinstalled), print an
# error message and exit
if test ${RETVAL} -ne 0 -a ${RETVAL} -ne 9; then
printf "ERRO: Falha ao criar o usuário seed_mec.\n"
exit 2
fi
# Remove the temporary skel, as it isn't needed anymore
rmdir "${TMPSKEL}"
# Remove old crontab of seed_mec, in case there's one, avoinding a specific
# error of wrong owner/lack of permissions
crontab -u seed_mec -r
# Check if this is not an UCA Classmate, UCA Server nor ProInfo Projector, and
# if the line that gives root permission doesn't exist before adding it
if ! test -n "${PROJECTOR}" -o -f "/usr/sbin/projetor" -o \
-f "/etc/cmpc-release" -o -n "${UCA_SERVER}" -o \
-n "${UCA_CLASSMATE}"; then
# Remove any possible line containing a rule for seed_mec user before adding
# root permissions in the sudoers file
TMPFILE=$(mktemp)
sed '/^seed_mec[\t ]*ALL=(ALL/d' /etc/sudoers > "${TMPFILE}"
mv "${TMPFILE}" /etc/sudoers
chmod 440 /etc/sudoers
# Add root permissions to seed_mec user, without the need of password
if ! $(echo -e "seed_mec\tALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers)
then
printf "ERRO: Falha ao adicionar permissões de super-usuário %b" \
"ao usuário seed_mec.\n"
exit 3
fi
fi
# Uncompress tar package and check its integrity
tail -n +${BOOTSTRAP_LINES} $0 > "${SEED_MEC_HOME}/${FILE}"
cd "${SEED_MEC_HOME}"
verify_md5
# Remove old agent and extract the new one
rm -rf "${AGENT_DIR}" &> /dev/null
tar xzf "${FILE}" &> /dev/null
rm -rf "${FILE}" &> /dev/null
# Change files owner
if ! chown -R seed_mec:seed_mec "${SEED_MEC_HOME}"; then
rm -rf "${SEED_MEC_HOME}" &> /dev/null
printf "ERRO: Falha ao mudar dono dos arquivos.\n"
exit 5
fi
# Export a variable to inform the agent that this is its first execution
export FIRST_EXECUTION=1
# Run the agent and check if its execution was alright, exiting in case of error
if ! su -c "bash ${AGENT_DIR}/agent.sh" seed_mec; then
printf "ERRO: Falha na execução do novo agente.\n"
collect_information
exit 6
fi
# Restore stdout and close fd 3
exec >&3 3>&-
printf "\nO agente PROINFODATA foi instalado com sucesso. %b%b" \
"Em caso de dúvidas, acesse o portal do PROINFODATA:\n" \
"seed.c3sl.ufpr.br\n"
exit 0
#!/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.
# This is the update bootstrap
# That function verify the md5 of package is correct
verify_md5(){
printf "[SEED2-update] Checking md5... "
if [[ ${MD5_CHECK} == $(md5sum "${SEED_MEC_HOME}/update/tmp/${FILE}" | \
awk '{print $1}') ]]; then
printf "OK!\n"
else
printf "ERROR: This package is currupted. Please, download it again.\n"
rm -rf ${FILE} &> /dev/null
exit 1
fi
}
# Re-create the md5 from inep and proxy
restore_inep_proxy_md5sum(){
for FILE in inep proxy; do
md5sum "${SEED_MEC_HOME}/SEED2/client/conf/${FILE}" |cut -d' ' -f1 > \
"${SEED_MEC_HOME}/${UPDATE_DIR}/.md5sum/client/conf/${FILE}"
# The backup md5 is the same
cp -a "${SEED_MEC_HOME}/${UPDATE_DIR}/.md5sum/client/conf/${FILE}" \
"${SEED_MEC_HOME}/${UPDATE_DIR}/.md5sum/.backup/client/conf/"
done
}
# Re-create the backup inep and proxy files and copy the md5 files
restore_inep_proxy_backup(){
for FILE in inep proxy; do
# The backup itself
cp -a "${SEED_MEC_HOME}/SEED2/client/conf/${FILE}" \
"${SEED_MEC_HOME}/${UPDATE_DIR}/.backup/client/conf/"
done
}
# These variables will be replaced when generating package
FILE=
MD5_CHECK=
BOOTSTRAP_LINES=
if test -n "${HOME}"; then
SEED_MEC_HOME=${HOME}
else
SEED_MEC_HOME=/opt/seed_mec
fi
UPDATE_DIR="update/tmp/SEED2-run"
# Begin of script
# Create auxiliar directories
mkdir -p "${SEED_MEC_HOME}/update/tmp"
mkdir -p "${SEED_MEC_HOME}/update/old"
# Extract the tar package
tail -n +${BOOTSTRAP_LINES} "$0" > "${SEED_MEC_HOME}/update/tmp/${FILE}"
verify_md5
cd "${SEED_MEC_HOME}/update/tmp"
tar xzf "${FILE}" &> /dev/null
cd - &> /dev/null
# Copy the configuration files and dependents to new tree
mkdir -p "${SEED_MEC_HOME}/update/tmp/SEED2-run/client/conf"
# Check if inep and proxy files exist
ERROR=0
INEP_PROXY="${SEED_MEC_HOME}/SEED2/client/conf/inep
${SEED_MEC_HOME}/SEED2/client/conf/proxy"
for FILE in ${INEP_PROXY}; do
test -f "${FILE}" || ERROR=1
done
# Do nothing if there's no inep or proxy conf files
if test "${ERROR}" -eq 0; then
# Copy inep and proxy to new tree
cp -a "${SEED_MEC_HOME}/SEED2/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/client/conf/"
# Copy or create the md5 files from inep and proxy
(test -d "${SEED_MEC_HOME}/SEED2/.md5sum" &&
cp -a "${SEED_MEC_HOME}/SEED2/.md5sum/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/.md5sum/client/conf/") ||
restore_inep_proxy_md5sum
# Copy or create the backup files from inep and proxy
(test -d "${SEED_MEC_HOME}/SEED2/.backup" &&
cp -a "${SEED_MEC_HOME}/SEED2/.backup/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/.backup/client/conf/") ||
restore_inep_proxy_backup
fi
# -----------------------------------------------------------------------------
# TODO: do some security backup???
#cp -ra "${SEED_MEC_HOME}/SEED2/" "${SEED_MEC_HOME}/old/"
# If something interrupt the script here, the tree will not be entirely
# correct, so we create a file to mark that something happened and on the
# next execution the package will try to recover itself
##### CRITICAL #####
touch "${SEED_MEC_HOME}/SEED2/updating"
# md5sum and backup folders
rm -rf "${SEED_MEC_HOME}/SEED2/.md5sum" \
"${SEED_MEC_HOME}/SEED2/.backup" &> /dev/null
mv -f "${SEED_MEC_HOME}/update/tmp/SEED2-run/"{.md5*,.back*}* \
"${SEED_MEC_HOME}/SEED2/"
# The files itself
rm -rf "${SEED_MEC_HOME}/SEED2/"{bin,lib,net,client,scripts,extra} &> /dev/null
mv -f "${SEED_MEC_HOME}/update/tmp/SEED2-run/"* \
"${SEED_MEC_HOME}/SEED2/"
rm -f "${SEED_MEC_HOME}/SEED2/updating" &> /dev/null
### END CRITICAL ###
# Remove auxiliar directories
rm -rf "${SEED_MEC_HOME}/update" &> /dev/null
# Call the agent
"${SEED_MEC_HOME}/SEED2/agent.sh"
exit 0
#!/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.
PREFIX="$(dirname $0)"
GITURL="http://git.c3sl.ufpr.br/pub/scm/proinfodata/"
GITBASEDIR="${PREFIX}/source"
WEBSERVICE="seed.c3sl.ufpr.br"
# Get the configuration
if ! source "${PREFIX}/buildpackage.conf" 2> /dev/null; then
printf "ERROR (1): Failed to load buildpackage.conf.\n"
exit 1
fi
# Customizable variables. Please refer to buildpackage.conf to change these
# values
: ${AGENTDIR:="agent-files"}
: ${AGENTPACKAGEDIR:="SEED2-run"}
printf "====================\n$0 v0.1\n\n"
printf "**** Make sure that ${WEBSERVICE} webservice are up and running!!!\n"
printf "\nNOTE: This will take a while.\n"
printf " Make sure the git update process below will run ok.\n"
printf "====================\n\n"
# Check if wget have been build
if ! test -f "${PREFIX}/wget-"*"/src/wget"; then
printf "ERROR (2): Please run build-wget before running this script. %b" \
"Aborting...\n"
exit 2
fi
# Sanity check, we do not want dynamic linked binaries on the package
ldd "${PREFIX}/wget-"*"/src/wget" &> /dev/null
if ! test $? -eq 1; then
printf "ERROR (3): The wget binary wasn't compiled with static library.%b" \
"\nPlease, build wget using build-wget. Aborting...\n"
exit 3
fi
# Ensure $GITBASEDIR directory exists
mkdir -p "${GITBASEDIR}"
# Ensure all repositories are ok
printf "Updating git repositories...\n"
for repo in "${GITBASEDIR}/client:client" "${GITBASEDIR}/collect:collect"; do
REPOPATH="$(echo $repo |cut -d: -f1)"
REPONAME="$(echo $repo |cut -d: -f2)"
printf "${REPONAME}...\n"
# Check the environment
if ! cd "${REPOPATH}" 2> /dev/null; then
if ! cd "${GITBASEDIR}" 2> /dev/null; then
printf "ERROR (4): Something went wrong.\nMake sure that %b%b" \
"GITBASEDIR exists and the script has access to it. " \
"Aborting...\n"
exit 4
else
printf "git clone ${REPONAME}...\n"
if git clone ${GITURL}${REPONAME}.git
then
cd - &> /dev/null
cd "${REPOPATH}"
else
printf "ERROR (5): Something went wrong.\nProblems %b" \
"executing git clone(1). Aborting...\n"
exit 5
fi
fi
fi
if ! git pull; then
printf "ERROR (6): Something went wrong.\n Problems executing %b" \
"git pull(1). Aborting...\n"
exit 6
fi
cd - &> /dev/null
done
printf "\n\n"
# Compile the collect agent and the client
printf "Starting compilation process...\n\n"
printf "Starting client compilation...\n\n"
sleep 1
cd "${GITBASEDIR}/client"
if make && make install; then
printf "\n\nClient compilation is finished.\n%b" \
"Everything was fine.\n\n"
else
printf "\n\n"
printf "ERROR (7): Client compilation is finished.\n%b" \
"Something went wrong. Aborting...\n\n"
exit 7
fi
cd -
printf "Starting collect-parser compilation...\n\n"
sleep 1
cd "${GITBASEDIR}/collect"
if make && make install; then
printf "\n\n"
printf "Collect-parser compilation is finished.\n%b" \
"Everything was fine.\n\n"
else
printf "\n\n"
printf "ERROR (8): Collect-parser compilation is finished.\n%b" \
"Something went wrong. Aborting...\n\n"
exit 8
fi
cd -
# Build the package itself
printf "Starting to build the package...\n"
OUTDIR="${AGENTDIR}/${AGENTPACKAGEDIR}/"
rm -Rf "${OUTDIR}"
mkdir -p "${OUTDIR}/client/"
mkdir -p "${OUTDIR}/lib/"
EXCLUDEFILE=$(tempfile --prefix=build-package-exclude)
cat > ${EXCLUDEFILE} << EOF
src
lib/include
lib/libxml2*/*
lib/*.tar.gz
Makefile
COPYING
INSTALL
NEWS
README
AUTHORS
TODO
tests
version
net/*.c
EOF
printf "Copying collect files... "
rsync -aHx --delete --exclude-from=${EXCLUDEFILE} \
"${GITBASEDIR}/collect/"* "${OUTDIR}"
rm -Rf "${OUTDIR}/lib/libxml2"*
printf "done.\n"
cat > ${EXCLUDEFILE} << EOF
src
lib
Makefile
run-config.sh
COPYING
INSTALL
NEWS
README
AUTHORS
TODO
tests
EOF
printf "Copying client files... "
rsync -aHx --delete --exclude-from=${EXCLUDEFILE} \
"${GITBASEDIR}/client/"* "${OUTDIR}/client/"
printf "done.\n"
BOOTSTRAP="${PREFIX}/bootstraps/bootstrap-install"
printf "Copying bootstrap... "
cp -a "${BOOTSTRAP}" "${AGENTDIR}"/
printf "done.\n"
printf "Copying wget binary... "
cp -a "${PREFIX}/wget-"*"/src/wget" "${OUTDIR}/bin/"
printf "done.\n"
rm -f "${EXCLUDEFILE}"
printf "\nAll done.\n\n"
#!/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.
# This function checks one file integrity
check_file_integrity(){
FILE="$*"
FILEREAL="$(echo ${FILE} | sed "s#^${MD5DIRESC}##g")"
test -f "${AGENT_FILES}/SEED2-run/${FILEREAL}" || return 1
(md5sum "${AGENT_FILES}/SEED2-run/${FILEREAL}" | cut -d' ' -f1 | \
diff - "${FILE}" &> /dev/null) || return 1
}
AGENT_FILES="./agent-files"
BOOTSTRAP="bootstrap-install"
INEP=$1
MD5DIR="${AGENT_FILES}/SEED2-run/.md5sum"
MD5DIRESC="$(echo ${MD5DIR} | sed "s/\./\\\./g")"
# Ensure proxy variables are empty
PHOST=
PPORT=
PUID=
PPASSWD=
# If the parameter isn't quotation marks, add its value to the respective proxy
# information variable
test "$2" = '""' || PHOST=$2
test "$3" = '""' || PPORT=$3
test "$4" = '""' || PUID=$4
test "$5" = '""' || PPASSWD=$5
# Check if $INEP is empty
if test -z "${INEP}"; then
printf "ERROR (1): Empty INEP.\n"
exit 1
fi
# -----------------------------------------------------------------------------
# Check all MD5 files
printf "Checking SEED2-run files integrity... "
for FILE in $(find "${MD5DIR}" -type f); do
if ! check_file_integrity "${FILE}"; then
printf "ERROR (2): File(s) corrupted. Please, re-create integrity or %b"
"rebuild the agent files.\n"
exit 2
fi
done
printf "done.\n"
# -----------------------------------------------------------------------------
# Start the tree creation process, removing any possible garbage before
# creating the INEP specific temporary directory
printf "Creating tree... "
rm -rf "/tmp/${INEP}"
mkdir -p "/tmp/${INEP}"
# Copy the agent files to the temporary directory where the installation package
# will be generated
if ! cp -r "${AGENT_FILES}/SEED2-run" "/tmp/${INEP}/SEED2"; then
printf "ERROR (3): Failed to copy agent files.\n"
exit 3
fi
# Create client conf directory and the inep file with the school INEP
mkdir -p "/tmp/${INEP}/SEED2/client/conf"
echo "${INEP}" > "/tmp/${INEP}/SEED2/client/conf/inep"
# Create the md5 files of inep and inep backup
FILE="/tmp/${INEP}/SEED2/client/conf/inep"
md5sum "${FILE}" |cut -d' ' -f1 > \
"/tmp/${INEP}/SEED2/.md5sum/client/conf/inep"
cp -a "${FILE}" "/tmp/${INEP}/SEED2/.backup/client/conf/inep"
FILE="/tmp/${INEP}/SEED2/.backup/client/conf/inep"
md5sum "${FILE}" |cut -d' ' -f1 > \
"/tmp/${INEP}/SEED2/.md5sum/.backup/client/conf/inep"
# Create the proxy file with all necessary proxy information, and its md5
echo "phost=$PHOST" > "/tmp/${INEP}/SEED2/client/conf/proxy"