2023-05-09 22:09:01 +02:00
|
|
|
#! /usr/bin/env bash
|
2023-05-12 23:38:42 +02:00
|
|
|
MAIN_FILE="$(realpath "${BASH_SOURCE[0]}")"
|
|
|
|
MAIN_ROOT="$(dirname "${MAIN_FILE}")"
|
|
|
|
|
|
|
|
function link_bashrc {
|
|
|
|
local file='/etc/bash.bashrc'
|
|
|
|
rm --force "${file}"
|
|
|
|
ln --symbolic "${MAIN_FILE}" "${file}"
|
|
|
|
}
|
2023-05-09 22:09:01 +02:00
|
|
|
|
2023-05-14 14:46:23 +02:00
|
|
|
# import modules
|
2023-05-14 13:59:46 +02:00
|
|
|
function main_import_modules {
|
2023-05-14 14:46:23 +02:00
|
|
|
local IFS=$'\n'
|
|
|
|
local modules=($(find "${MAIN_ROOT}" -type 'f' -name '*.sh'))
|
|
|
|
local module
|
|
|
|
for module in "${modules[@]}" ; do
|
2023-05-12 23:38:42 +02:00
|
|
|
if [ "${module}" != "${MAIN_FILE}" ] ; then
|
2023-05-14 14:46:23 +02:00
|
|
|
echo
|
|
|
|
echo "${module}"
|
2023-05-09 22:15:40 +02:00
|
|
|
source "${module}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
2023-05-09 22:09:01 +02:00
|
|
|
|
2023-05-14 14:46:23 +02:00
|
|
|
# import modules
|
2023-05-14 13:59:46 +02:00
|
|
|
main_import_modules
|