Browse Source

implement loadModule()

master
belliash 8 years ago
parent
commit
920be6204a
1 changed files with 32 additions and 0 deletions
  1. +32
    -0
      libraries/common

+ 32
- 0
libraries/common View File

@@ -159,6 +159,38 @@ function loadLibraries() {
source ${EZROOT}/libraries/repositories &> /dev/null || panic
}

#-------------------------------------------------------------------------------
# Loads and executes given EzBuild module
# Parameters: %module% %step%
#-------------------------------------------------------------------------------
function loadModule() {
local MODULE="${1}"
local FUNCTION="${EZNAME}_${2}"
if [ -e ${MODULESCUSTOMDIR}/${MODULE}.ezmod ]; then
source ${MODULESCUSTOMDIR}/${MODULE}.ezmod &> /dev/null
else
source ${EZROOT}/modules/${MODULE}.ezmod &> /dev/null
fi
if [ ${?} -eq 0 ] && hasElement ${EZNAME} ${EZMOD_COMPATIBILITY}; then
if [ -e ${MODULESCUSTOMDIR}/${MODULE}.conf ]; then
source ${EZROOT}/config/modules/${MODULE}.conf &> /dev/null
source ${MODULESCUSTOMDIR}/${MODULE}.conf &> /dev/null
elif [ -e /etc/ezbuild/modules/${MODULE}.conf ]; then
source ${EZROOT}/config/modules/${MODULE}.conf &> /dev/null
source /etc/ezbuild/modules/${MODULE}.conf &> /dev/null
fi
if [ ${?} -eq 0 ]; then
if functionExists ${FUNCTION}; then
eval ${FUNCTION}
return ${?}
else
return 255
fi
fi
fi
return 1
}

#-------------------------------------------------------------------------------
# Saves specified message into a log file
# Parameters: %message% [%level%]

Loading…
Cancel
Save