Ensuring that functions are either sources locally or globally, but not both.

This commit is contained in:
Daniel Baumann 2012-12-04 12:47:40 +01:00
parent 6a206425e8
commit 19d695c05a
1 changed files with 11 additions and 4 deletions

View File

@ -6,11 +6,18 @@ then
export LIVE_BUILD
fi
# Source global functions
for FUNCTION in "${LIVE_BUILD}"/functions/*.sh /usr/share/live/build/functions/*.sh
for _DIRECTORY in "${LIVE_BUILD}/functions" /usr/share/live/build/functions
do
if [ -e "${FUNCTION}" ]
if [ -e "${_DIRECTORY}" ]
then
. "${FUNCTION}"
for _FILE in "${_DIRECTORY}"/*.sh
do
if [ -e "${_FILE}" ]
then
. "${_FILE}"
fi
done
break
fi
done