le-proinfodata: Fix #959 Restructure packages le-proinfodata* for new git repositories.

Signed-off-by: 's avatarEdileuton Henrique de Oliveira <eho09@c3sl.ufpr.br>
parent 2a07b0ee
This diff is collapsed.
......@@ -34,24 +34,17 @@ check_file_integrity(){
# ------------------------------------------------------------------------------
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")"
LBFILE="${PREFIX}/pacote/etc/le-proinfodata/le.zone"
AGENTURL="http://proinfodata.c3sl.ufpr.br/seed/install/Pacote_de_Instalacao_SEED2_v1.4.0.run"
# ------------------------------------------------------------------------------
# Compressing the local base
if ! bzip2 ${LBFILE}; then
printf "ERROR (10): problems while Compressing the local base"
exit 10
printf "ERROR (1): problems while Compressing the local base"
exit 1
fi
# ------------------------------------------------------------------------------
......@@ -61,142 +54,10 @@ if test -f "${PIDINSTALLER}"; then
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}"
mkdir $PIDDEST
# Download the agent
if ! wget $AGENTURL -O $PIDINSTALLER; then
printf "ERROR (2): problems while downloading the agent"
exit 2
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment