Add error handling in CPT scripts

This commit is contained in:
Anirudha Bose 2014-06-23 20:35:45 +05:30 committed by sftnight
parent 593b78a9cc
commit 558ea7d719
4 changed files with 14 additions and 3 deletions

View File

@ -21,6 +21,7 @@
# Uncomment the following line to trace the execution of the shell commands
# set -o xtrace
set -o errexit
# TODO: Change workdir to a suitable path on your system (or Electric Commander)
workdir=~/ec/build
@ -34,6 +35,9 @@ source ${HOST_CLING_SRC_DIR}/indep.sh
source ${HOST_CLING_SRC_DIR}/debian/debianize.sh
source ${HOST_CLING_SRC_DIR}/windows/windows_dep.sh
# Trap exceptions, call function "cleanup" and exit
trap cleanup EXIT INT TERM
function usage {
cat <<- EOT
Cling Packaging Tool

View File

@ -19,6 +19,7 @@
# Uncomment the following line to trace the execution of the shell commands
# set -o xtrace
set -o errexit
function tarball_deb {
box_draw "Compressing compiled binaries to produce a bzip2 tarball"

View File

@ -19,6 +19,7 @@
# Uncomment the following line to trace the execution of the shell commands
# set -o xtrace
set -o errexit
function platform_init {
OS=$(uname -o)
@ -295,12 +296,16 @@ function cleanup {
box_draw "Clean up"
echo "Remove directory: ${workdir}/builddir"
rm -Rf ${workdir}/builddir
echo "Remove directory: ${prefix}"
rm -Rf ${prefix}
if [ -d "${prefix}" ]; then
echo "Remove directory: ${prefix}"
rm -Rf ${prefix}
fi
echo "Remove directory: ${TMP_PREFIX}"
rm -Rf ${TMP_PREFIX}
if [ -f ${workdir}/cling.nsi ]; then
if [ -f "${workdir}/cling.nsi" ]; then
echo "Remove file: cling.nsi"
rm -Rf ${workdir}/cling.nsi
fi

View File

@ -19,6 +19,7 @@
# Uncomment the following line to trace the execution of the shell commands
# set -o xtrace
set -o errexit
function check_cygwin {
# Check for Cygwin