From e4902a3f1cf0c28e8cc9363276ca52687d04fff9 Mon Sep 17 00:00:00 2001 From: Erik Alexandre Pucci <eap08@c3sl.ufpr.br> Date: Tue, 26 Apr 2011 17:03:10 -0300 Subject: [PATCH] build-install-package: Added checks at some important points These checks force the script to exit on error. Signed-off-by: Erik Alexandre Pucci <eap08@c3sl.ufpr.br> Acked-by: Danilo Kiyoshi Simizu Yorinori <danilok@c3sl.ufpr.br> Acked-by: Tiago Rodrigo Kepe <trk08@c3sl.ufpr.br> --- build-install-package | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build-install-package b/build-install-package index 0a06236..359a2f8 100755 --- a/build-install-package +++ b/build-install-package @@ -48,7 +48,13 @@ printf "Creating tree..." rm -Rf "/tmp/${INEP}" mkdir -p "/tmp/${INEP}" -cp -r "${AGENT_FILES}/SEED2-run" "/tmp/${INEP}/SEED2" +# 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: Failed to copy agent files.\n" + exit 2 +fi + mkdir -p "/tmp/${INEP}/SEED2/client/conf" echo "${INEP}" > "/tmp/${INEP}/SEED2/client/conf/inep" FILE="/tmp/${INEP}/SEED2/client/conf/inep" @@ -74,7 +80,12 @@ FILE="/tmp/${INEP}/SEED2/.backup/client/conf/proxy" md5sum "${FILE}" |cut -d' ' -f1 > \ "/tmp/${INEP}/SEED2/.md5sum/.backup/client/conf/proxy" -cp -r "${AGENT_FILES}/bootstrap-install" "/tmp/${INEP}" +# Copy the bootstrap-install to the temporary directory +if ! cp -r "${AGENT_FILES}/${BOOTSTRAP}" "/tmp/${INEP}"; then + printf "ERROR: Failed to copy ${BOOTSTRAP} to the %b" \ + "temporary directory.\n" + exit 3 +fi printf "done.\n" @@ -82,7 +93,10 @@ printf "done.\n" printf "Packaging..." cd "/tmp/${INEP}" -tar -czf SEED2.tgz SEED2 +if ! tar -czf SEED2.tgz SEED2; then + printf "ERROR: Failed to compress the agent package.\n" + exit 4 +fi # Create the tar md5 and compute the bootstrap lines MD5_CHECK=$(md5sum SEED2.tgz | awk '{print $1}') -- GitLab