main/file
This commit is contained in:
parent
b170098755
commit
3ffc60e4f1
1 changed files with 6 additions and 5 deletions
11
bash/main.sh
11
bash/main.sh
|
@ -12,21 +12,22 @@ function main_link_bashrc {
|
||||||
|
|
||||||
# import modules
|
# import modules
|
||||||
function main_import_modules {
|
function main_import_modules {
|
||||||
local root="${1}"
|
local file="${1}"
|
||||||
if [ -d "${root}" ] ; then
|
if [ -f "${file}" ] ; then
|
||||||
|
local root="$(dirname "${file}")"
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local modules=($(find "${root}" -type 'f' -name '*.sh'))
|
local modules=($(find "${root}" -type 'f' -name '*.sh'))
|
||||||
local module
|
local module
|
||||||
for module in "${modules[@]}" ; do
|
for module in "${modules[@]}" ; do
|
||||||
if [ "${module}" != "${MAIN_BASH_FILE}" ] ; then
|
if [ "${module}" != "${file}" ] ; then
|
||||||
source "${module}"
|
source "${module}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
log_trace "${modules[@]}"
|
log_trace "${modules[@]}"
|
||||||
else
|
else
|
||||||
log_fatal "No directory: ${root}"
|
log_fatal "No file: ${file}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# import modules
|
# import modules
|
||||||
main_import_modules "${MAIN_BASH_ROOT}"
|
main_import_modules "${MAIN_BASH_FILE}"
|
||||||
|
|
Loading…
Reference in a new issue