Skip to content
Snippets Groups Projects
Commit 44f100e9 authored by Thiago H. S. Picharski's avatar Thiago H. S. Picharski
Browse files

Merge remote branch 'le-proinfodata/master'

parents 5c6b05b1 3378a246
No related branches found
No related tags found
No related merge requests found
Showing
with 289933 additions and 0 deletions
1.2.2
#!/bin/bash
# gerar.sh
# Copyright (c) 2006 by Bruno Ribas <ribas@ufpr.br>
DIRTMP=$(mktemp -d)
VERSAO=$(cat VERSAO)
#arrumar versao
#$1 tipo de incremento
MAJOR=$(echo $VERSAO| cut -d'.' -f1)
MINOR=$(echo $VERSAO| cut -d'.' -f2)
REVISION=$(echo $VERSAO| cut -d'.' -f3)
case $1 in
Minor)
((MINOR++))
REVISION=0
;;
Major)
((MAJOR++))
MINOR=0
REVISION=0
;;
help)
echo "Uso: $0 Major|Minor|Revision"
echo ' Major - Altera versao Major'
echo ' Minor - Altera versao Minor'
exit
;;
*)
((REVISION++))
;;
esac
# Gera o instalador do PROINFODATA
./proinfodata-installer.sh
VERSAO="${MAJOR}.${MINOR}.${REVISION}"
echo "$VERSAO" > VERSAO
#Compila a documentacao do pacote no diretorio doc/
#cd doc/
#hevea -text *.tex
#hevea -text *.tex
#cd ../
cp -r pacote $DIRTMP
#Copia a documentacao compilada para dentro do pacote.
#cp doc/*.txt $DIRTMP/pacote/usr/share/doc/prd-*
cd $DIRTMP
find . -name ".svn" -exec rm -rf {} \; &>/dev/null
sed -i -e "s/Version:/Version: $VERSAO/" pacote/DEBIAN/control
fakeroot dpkg -b pacote .
cd -
cp $DIRTMP/*deb .
rm -rf $DIRTMP
# vim:tabstop=4:shiftwidth=4:encoding=iso-8859-1
Package: le-proinfodata
Version:
Maintainer: <proinfodata@c3sl.ufpr.br>
Architecture: i386
Section: main
Priority: important
Pre-Depends: le-inep
Depends: dialog, wget, passwd, sudo, cron, bash, coreutils
Description: Agent of PROINFODATA project designed for the LE project
Coleta de dados do projeto ProInfo/MEC de inclusão digital nas escolas
públicas brasileiras (PROINFODATA) is a project supported by Ministério da
Educação e Cultura (MEC) that collects some information about computer
laboratories at public schools in Brazil and make these data avaiable
through a website.
This agent periodically collects the data of the computer that it is
installed and sends them to a webservice running on internet.
#!/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 proinfodata
#
# proinfodata 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 postinst of proinfodata
SEED_MEC_HOME="/opt/seed_mec"
BACKUP_DIR="/opt/seed_mec_backup"
# Install the PROINFODATA agent
bash /tmp/agent.run
# Check if there is a backup for the inep and proxy files and restore it
if test -f "${BACKUP_DIR}/SEED2/client/conf/inep"; then
# Restore the inep and proxy files, and also their backup and md5sum
# counterparts
for FILE in "proxy" "inep"; do
cp -af "${BACKUP_DIR}/SEED2/.backup/client/conf/${FILE}" \
"${SEED_MEC_HOME}/SEED2/.backup/client/conf/${FILE}"
cp -af "${BACKUP_DIR}/SEED2/.md5sum/client/conf/${FILE}" \
"${SEED_MEC_HOME}/SEED2/.md5sum/client/conf/${FILE}"
cp -af "${BACKUP_DIR}/SEED2/.md5sum/.backup/client/conf/${FILE}" \
"${SEED_MEC_HOME}/SEED2/.md5sum/.backup/client/conf/${FILE}"
cp -af "${BACKUP_DIR}/SEED2/client/conf/${FILE}" \
"${SEED_MEC_HOME}/SEED2/client/conf/${FILE}"
done
# Remove the auxiliar directory
rm -rf "${BACKUP_DIR}"
fi
# Make sure the owner of ~seed_mec is seed_mec
chown -R seed_mec:seed_mec "${SEED_MEC_HOME}"
# Remove seed_mec from the KDM user list
kwriteconfig --file /etc/kde4/kdm/kdmrc --group X-*-Greeter \
--key HiddenUsers seed_mec
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 le-proinfodata
#
# le-proinfodata 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 postrm of proinfodata
SEED_MEC_HOME="/opt/seed_mec"
if test "$1" != "purge" -a -f "${SEED_MEC_HOME}/SEED2/client/conf/inep"; then
rm -rf "${SEED_MEC_HOME}/SEED2/"[^c]* \
"${SEED_MEC_HOME}/SEED2/"c[^l]* \
"${SEED_MEC_HOME}/SEED2/client/"[^c]* \
"${SEED_MEC_HOME}/SEED2/client/common.sh" \
"${SEED_MEC_HOME}/SEED2/client/conf/version"
else
rm -rf "${SEED_MEC_HOME}"
fi
# Files to divert
DIVERTS="
/etc/init/dbus.conf \
/etc/init/tty1.conf
"
if [[ "$1" != "upgrade" ]]; then
for file in $DIVERTS; do
dpkg-divert --package le-proinfodata --remove --rename \
--divert ${file}{.real,}
done
fi
exit 0
#!/bin/bash -e
# 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 proinfodata
#
# proinfodata 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 preinst of proinfodata
SEED_MEC_HOME="/opt/seed_mec"
CONF="${SEED_MEC_HOME}/SEED2/client/conf/"
BKPCONF="${SEED_MEC_HOME}/SEED2/.backup/client/conf/"
MD5CONF="${SEED_MEC_HOME}/SEED2/.md5sum/client/conf/"
MD5BKPCONF="${SEED_MEC_HOME}/SEED2/.md5sum/.backup/client/conf/"
BKP="/opt/seed_mec_backup"
BKP_CONF="${BKP}/SEED2/client/conf/"
BKP_BKPCONF="${BKP}/SEED2/.backup/client/conf/"
BKP_MD5CONF="${BKP}/SEED2/.md5sum/client/conf/"
BKP_MD5BKPCONF="${BKP}/SEED2/.md5sum/.backup/client/conf/"
# Check if there is a previously configured INEP and no backup before creating
# the backup for both the inep and proxy files
if test -f "${CONF}/inep" -a ! -f "${BKP_CONF}/inep"; then
# Create auxiliar directories
mkdir -p "${BKP_CONF}"
mkdir -p "${BKP_BKPCONF}"
mkdir -p "${BKP_MD5CONF}"
mkdir -p "${BKP_MD5BKPCONF}"
# Copy the inep and proxy files, and also their backup and md5sum
# counterparts. The last copied file is the inep, so the verification of its
# existence always means the other ones also exist
for FILE in "proxy" "inep"; do
if test -f "${BKPCONF}/${FILE}"; then
cp -af "${BKPCONF}/${FILE}" "${BKP_BKPCONF}/${FILE}"
else
cp -af "${CONF}/${FILE}" "${BKP_BKPCONF}/${FILE}"
fi
if test -f "${MD5CONF}/${FILE}"; then
cp -af "${MD5CONF}/${FILE}" "${BKP_MD5CONF}/${FILE}"
else
md5sum "${CONF}/${FILE}" | cut -d' ' -f1 > "${BKP_MD5CONF}/${FILE}"
fi
if test -f "${MD5BKPCONF}/${FILE}"; then
cp -af "${MD5BKPCONF}/${FILE}" "${BKP_MD5BKPCONF}/${FILE}"
else
md5sum "${CONF}/${FILE}" | cut -d' ' -f1 > \
"${BKP_MD5BKPCONF}/${FILE}"
fi
cp -af "${CONF}/${FILE}" "${BKP_CONF}/${FILE}"
done
fi
# Files to divert
DIVERTS="
/etc/init/dbus.conf \
/etc/init/tty1.conf
"
# Divert files
for file in $DIVERTS; do
dpkg-divert --package le-proinfodata --add --rename \
--divert ${file}{.real,}
done
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 proinfodata
#
# proinfodata 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 prerm of proinfodata
# Delete the crontab of seed_mec
crontab -u seed_mec -r
# Delete user seed_mec
userdel seed_mec
# Delete group seed_mec
groupdel seed_mec
exit 0
# dbus - D-Bus system message bus
#
# The D-Bus system message bus allows system daemons and user applications
# to communicate.
description "D-Bus system message bus"
start on local-filesystems
stop on runlevel [06]
expect fork
respawn
pre-start script
# Does the INEP file exist?
INEPFILE=/opt/seed_mec/SEED2/client/conf/inep
if ! test -f ${INEPFILE} -a -n "$(cat ${INEPFILE})"; then
/usr/sbin/le-askINEP.sh
fi
mkdir -p /var/run/dbus
chown messagebus:messagebus /var/run/dbus
exec dbus-uuidgen --ensure
end script
exec dbus-daemon --system --fork
post-start exec kill -USR1 1
# tty1 - getty
#
# This service maintains a getty on tty1 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
INEPFILE=/opt/seed_mec/SEED2/client/conf/inep
# Do not open getty if a dialog is about to be shown
if test -f ${INEPFILE} -a -n "$(cat ${INEPFILE})"; then
exec /sbin/getty -8 38400 tty1
fi
This diff is collapsed.
# LE-BASE
C3SL - Centro de Computacao Cientifica e Software Livre
Bruno Cesar Ribas
Carlos Carvalho
Cleide Luzia Bonfim Possamai
Daniel Weingaertner
Danilo Kiyoshi Simizu Yorinori
Diego Giovane Pasqualin
Edson Ramiro Lucas Filho
Eduardo Cunha de Almeida
Erik Alexandre Pucci
Fabiano Silva
Jorge Augusto Meira
Josiney de Souza
Juliana Bueno
Lucio Foltran da Silva
Luis Carlos Erpen de Bona
Marcos Castilho
Pedro Eugenio Rocha
Renan Franca De Miranda
Ricardo Tavares De Oliveira
Rubens Massayuki Suguimoto
Thiago Henrique Dos Santos Picharski
Tiago Rodrigo Kepe
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 le-proinfodata
#
# le-proinfodata 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 script will ask some configurations needed by the PROINFODATA agent
# Check if it's running on the live CD by checking the installation of ubiquity
if dpkg -l ubiquity-le 2>/dev/null | grep -q '^ii'; then
# ubiquity is installed, so we are in the live CD. Exit.
exit 0
fi
DIALOG="dialog --backtitle PROINFODATA --shadow --title"
TTY=/dev/tty1
TIMETOREAD=3
# LE ZONE
LEZONE=/etc/le-proinfodata/le.zone
# INEP file
SEED_HOME=/opt/seed_mec
INEPFILE="${SEED_HOME}/SEED2/client/conf/inep"
MD5INEPFILE="${SEED_HOME}/SEED2/.md5sum/client/conf/inep"
BACKUPINEPFILE="${SEED_HOME}/SEED2/.backup/client/conf/inep"
MD5BACKUPINEPFILE="${SEED_HOME}/SEED2/.md5sum/.backup/client/conf/inep"
# Proxy file
PROXYFILE="${SEED_HOME}/SEED2/client/conf/proxy"
MD5PROXYFILE="${SEED_HOME}/SEED2/.md5sum/client/conf/proxy"
BACKUPPROXYFILE="${SEED_HOME}/SEED2/.backup/client/conf/proxy"
MD5BACKUPPROXYFILE="${SEED_HOME}/SEED2/.md5sum/.backup/client/conf/proxy"
# "I'll do it later" message
LATER="quero digitar o inep da minha escola depois"
# Create a temp file to store some dialog answers.
ans=$(mktemp)
# test_exit exits if the given argument is equal to 255.
# This is used to test if the user pressed the ESC key.
function test_exit() {
if test $1 -eq 255 ; then
# Remove ans file.
rm -f ${ans}
# Start it again and exit.
$0
exit 0
fi
}
# Welcome message
${DIALOG} PROINFODATA --msgbox "
O agente de acompanhamento do projeto PROINFODATA foi instalado nesta
máquina. Para torná-lo funcional, entretanto, é necessário fornecer
informações sobre as configurações de proxy, além do número INEP da
instituição. Para saber mais sobre o projeto, visite o site
http://seed.c3sl.ufpr.br ." 0 0 > ${TTY}
valid=1
while test ${valid} -ne 0; do
# Ask INEP
${DIALOG} INEP --inputbox " Digite seu INEP ou a mensagem '${LATER}':" 0 0 > ${TTY} 2> ${ans}
test_exit $?
INEP=$(cat ${ans})
# INEP empty, try again
if test -z "${INEP}"; then
continue
fi
# "Later" message?
if [[ "${INEP}" == "${LATER}" ]]; then
${DIALOG} ATENÇÃO --msgbox "
O número INEP será requisitado novamente na próxima vez que este computador for ligado." 0 0 > ${TTY}
clear > ${TTY}
exit 0
fi
# Search the INEP in our base
LINE=$(grep "^ ${INEP} " ${LEZONE})
if [[ -z "${LINE}" ]]; then
# Warning!
${DIALOG} ATENÇÃO --msgbox "
O INEP fornecido é inválido. Por favor verifique o número INEP
correspondente a sua instituição de ensino e tente novamente ou digite
'${LATER}'." 0 0 > ${TTY}
valid=1
else
state=$(echo ${LINE} | awk -F'|' '{print $2}')
city=$(echo ${LINE} | awk -F'|' '{print $3}')
school=$(echo ${LINE} | awk -F'|' '{print $4}')
zip=$(echo ${LINE} | awk -F'|' '{print $5}')
${DIALOG} Confirmação --yesno "\
INEP: ${INEP} \n\
Estado: ${state} \n\
Cidade: ${city} \n\
Escola: ${school} \n\
CEP: ${zip} \n\
Essas informações estão corretas?" 0 0 > ${TTY}
valid=$?
test_exit ${valid}
fi
done
# INEP set. Ask for proxy configuration
${DIALOG} proxy --yesno "Você possui informações de proxy?" 0 0 > ${TTY}
has_proxy=$?
test_exit ${has_proxy}
if test ${has_proxy} -eq 0; then
valid=1
while test ${valid} -ne 0; do
declare -a formans
${DIALOG} proxy --form "Preencha as informações de proxy:" 12 55 5 \
"Host:" 1 1 "" 1 20 100 100 \
"Porta:" 2 1 "" 2 20 100 100 \
"Usuario:" 3 1 "" 3 20 100 100 \
> ${TTY} 2> ${ans}
test_exit $?
i=0
while read line; do
formans[${i}]=${line}
(( i++ ))
done < ${ans}
phost=${formans[0]}
pport=${formans[1]}
puid=${formans[2]}
equalpass=1
while test ${equalpass} -ne 0 ; do
${DIALOG} proxy --insecure --passwordform "Preencha a senha do \
proxy, se necessário:" 12 55 5 \
"Senha:" 1 1 "" 1 20 100 100 \
"Confirmar Senha:" 2 1 "" 2 20 100 100 \
> ${TTY} 2> ${ans}
test_exit $?
i=0
while read line; do
formans[${i}]=${line}
(( i++ ))
done < ${ans}
if [[ "${formans[0]}" != "${formans[1]}" ]]; then
${DIALOG} proxy --sleep ${TIMETOREAD} --infobox "As senhas \
não conferem!" 0 0 > ${TTY}
else
equalpass=0
fi
done
ppasswd=${formans[0]}
${DIALOG} Confirmação --yesno "\
Host: ${phost} \n\
Porta: ${pport} \n\
Usuário: ${puid} \n\
Essas informações estão corretas?" 0 0 > ${TTY}
valid=$?
test_exit ${valid}
done
else
phost=
pport=
puid=
ppasswd=
fi
# set files
${DIALOG} PROINFO --msgbox "Processo concluido!" 0 0 > ${TTY}
# Set variables
echo "${INEP}" > ${INEPFILE}
echo "phost=${phost}" > ${PROXYFILE}
echo "pport=${pport}" >> ${PROXYFILE}
echo "puid=${puid}" >> ${PROXYFILE}
echo "ppasswd=${ppasswd}" >> ${PROXYFILE}
# Generate md5 hashs for the files
md5sum ${INEPFILE} | cut -d' ' -f1 > ${MD5INEPFILE}
md5sum ${PROXYFILE} | cut -d' ' -f1 > ${MD5PROXYFILE}
# Backup the files
cp ${INEPFILE} ${BACKUPINEPFILE}
cp ${PROXYFILE} ${BACKUPPROXYFILE}
cp ${MD5INEPFILE} ${MD5BACKUPINEPFILE}
cp ${MD5PROXYFILE} ${MD5BACKUPPROXYFILE}
chown seed_mec:seed_mec ${INEPFILE}
chown seed_mec:seed_mec ${PROXYFILE}
clear > ${TTY}
exit 0
#!/bin/bash
# This script generates the PROINFODATA installer
# Copyright (C) 2010-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-proinfodata
#
# le-proinfodata 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
}
# ------------------------------------------------------------------------------
PREFIX="$(dirname $(readlink -f $0))"
BPURL="http://git.c3sl.ufpr.br/pub/scm/proinfodata/buildpackage.git"
BPDIR="${PREFIX}/buildpackage"
AUXDIR="${PREFIX}/git"
PIDDEST="${PREFIX}/pacote/tmp"
PIDINSTALLER="${PIDDEST}/agent.run"
FAKEINEP="99999999"
AGENT_FILES="./agent-files"
BOOTSTRAP="bootstrap-install"
MD5DIR="${AGENT_FILES}/SEED2-run/.md5sum"
MD5DIRESC="$(echo ${MD5DIR} | sed "s/\./\\\./g")"
# ------------------------------------------------------------------------------
# Check if the PROINFODATA installer already exists
if test -f "${PIDINSTALLER}"; then
printf "PROINFODATA installer already exists. Skipping generation.\n"
exit 0
fi
# Check if the buildpackage repository directory already exists, cloning it
# otherwise
if ! test -d "${BPDIR}"; then
if ! git clone "${BPURL}" "${BPDIR}"; then
printf "ERROR (1): problems while executing git clone(1).\n"
exit 1
fi
fi
# Change to buildpackage directory
cd "${BPDIR}"
# Ensure the buildpackage repository is updated
if ! git pull; then
printf "ERROR (2): problems while executing git pull(1).\n"
exit 2
fi
# Create auxiliar directory used by the buildpackage scripts
mkdir -p "${AUXDIR}"
# ------------------------------------------------------------------------------
# Compile the wget
printf "\nIf there's no compiled wget, run build-wget...\n"
if ! test -f "${BPDIR}/wget-"*"/src/wget" && ! ./build-wget; then
printf "ERROR (3): problems while building wget.\n"
exit 3
fi
printf "Wget compiled.\n"
# ------------------------------------------------------------------------------
# Get agent files
printf "\nExecuting build-agent-files...\n"
if ! ./build-agent-files; then
printf "ERROR (4): problems while building the agent files.\n"
exit 4
fi
printf "Agent files prepared.\n"
# ------------------------------------------------------------------------------
# Create integrity system
printf "\nCreating integrity system...\n"
if ! ./create-integrity-system; then
printf "ERROR (5): problems while creating the integrity system.\n"
exit 5
fi
printf "Integrity system ready.\n"
# ------------------------------------------------------------------------------
# Generate the PROINFODATA installer
printf "\nBuilding PROINFODATA installation package...\n"
# Change to the agent directory
cd agent
# 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 (6): problems while building the installation %b" \
"package - file(s) corrupted.\n"
exit 6
fi
done
printf "done.\n"
# Start the tree creation process, removing any possible garbage before
# creating the FAKEINEP specific temporary directory
printf "Creating tree... "
rm -rf "/tmp/${FAKEINEP}"
mkdir -p "/tmp/${FAKEINEP}"
# Copy the agent files to the temporary directory where the installation package
# will be generated
if ! cp -r "${AGENT_FILES}/SEED2-run" "/tmp/${FAKEINEP}/SEED2"; then
printf "ERROR (7): problems while building the installation %b" \
"package - failed to copy agent files.\n"
exit 7
fi
# Copy the bootstrap-install to the temporary directory
if ! cp -r "${AGENT_FILES}/${BOOTSTRAP}" "/tmp/${FAKEINEP}"; then
printf "ERROR (8): problems while building the installation %b%b" \
"package - failed to copy ${BOOTSTRAP} to the " \
"temporary directory.\n"
exit 8
fi
printf "done.\n"
# End of tree creation process
# The tree is ready, we need to compress it now (tar+gz)
printf "Packaging... "
cd "/tmp/${FAKEINEP}"
if ! tar -czf SEED2.tgz SEED2; then
printf "ERROR (9): problems while building the installation %b" \
printf "package - failed to compress the agent package.\n"
exit 9
fi
# Create the tar md5 and compute the bootstrap lines
MD5_CHECK=$(md5sum SEED2.tgz | awk '{print $1}')
LINENUM=$(( $(wc -l "${BOOTSTRAP}" | cut -d' ' -f1) + 1 ))
# Edit the bootstrap and start the real package
sed "s/BOOTSTRAP_LINES=/BOOTSTRAP_LINES=${LINENUM}/g; \
s/MD5_CHECK=/MD5_CHECK=\"${MD5_CHECK}\"/g" \
"${BOOTSTRAP}" > agent_${FAKEINEP}.run
# Insert the tar on the package and finish
cat "SEED2.tgz" >> "agent_${FAKEINEP}.run"
mv "agent_${FAKEINEP}.run" "/tmp"
printf "done.\n"
# End of packaging step
# Remove temporary files
printf "Removing temporary files... "
cd ..
rm -rf "${FAKEINEP}" 2> /dev/null
printf "done.\n"
# End of temporary files removal
printf "Installation package generated.\n"
# ------------------------------------------------------------------------------
# Ensure the directory where the PROINFODATA installer should be placed exists
mkdir -p "${PIDDEST}"
# Move the PROINFODATA installer to the correct place
mv "/tmp/agent_${FAKEINEP}.run" "${PIDINSTALLER}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment