From e058a92450aab89c8744dd3f613716bd23d3c41c Mon Sep 17 00:00:00 2001 From: belliash Date: Wed, 28 Dec 2011 14:35:43 +0100 Subject: [PATCH] implement panic() and make a use of it --- libraries/common | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libraries/common b/libraries/common index 14c84f0..fe6950e 100644 --- a/libraries/common +++ b/libraries/common @@ -47,17 +47,26 @@ function isSet() { # Loads EzBuild configuration #------------------------------------------------------------------------------- function loadConfiguration() { - source ${EZROOT}/config/${EZNAME}.conf - source ${EZROOT}/config/layout.conf - source /etc/ezbuild/${EZNAME}.conf - source /etc/ezbuild/layout.conf + source ${EZROOT}/config/${EZNAME}.conf &> /dev/null || panic "Unable to load configuration files!\nYour EzBuild installation seems to be broken..." + source ${EZROOT}/config/layout.conf &> /dev/null || panic "Unable to load configuration files!\nYour EzBuild installation seems to be broken..." + source /etc/ezbuild/${EZNAME}.conf &> /dev/null || panic "Unable to load configuration files!\nYour EzBuild installation seems to be broken..." + source /etc/ezbuild/layout.conf &> /dev/null || panic "Unable to load configuration files!\nYour EzBuild installation seems to be broken..." } #------------------------------------------------------------------------------- # Loads all EzBuild Libraries #------------------------------------------------------------------------------- function loadLibraries() { - source ${EZROOT}/libraries/colors + source ${EZROOT}/libraries/colors &> /dev/null || panic "Unable to load necessary libraries!\nYour EzBuild installation seems to be broken..." +} + +#------------------------------------------------------------------------------- +# Outputs error message and aborts program execution +# Parameters: %message% +#------------------------------------------------------------------------------- +function panic() { + echo -e "FATAL ERROR: ${@}" + exit 1 } #-------------------------------------------------------------------------------