Ensuring that functions are either sources locally or globally, but not both.
authorDaniel Baumann <daniel@debian.org>
Tue, 4 Dec 2012 11:47:40 +0000 (12:47 +0100)
committerDaniel Baumann <daniel@debian.org>
Tue, 4 Dec 2012 11:47:40 +0000 (12:47 +0100)
scripts/build.sh

index 21ff520..2e4a79e 100755 (executable)
@@ -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