2023-05-09 20:09:01 +00:00
|
|
|
#! /usr/bin/env bash
|
2023-05-15 07:19:43 +00:00
|
|
|
|
2024-11-13 08:41:47 +00:00
|
|
|
MAIN_USERS_FILE="$(readlink --canonicalize-existing "${0}")"
|
2023-05-15 07:19:43 +00:00
|
|
|
|
2024-11-13 08:41:47 +00:00
|
|
|
MAIN_USERS_ROOT="$(dirname "${MAIN_USERS_FILE}")"
|
2023-05-12 21:38:42 +00:00
|
|
|
|
2024-11-12 06:44:21 +00:00
|
|
|
main_link_bashrc() {
|
2024-11-12 09:14:08 +00:00
|
|
|
local file="/etc/bash.bashrc"
|
|
|
|
rm --force "${file}"
|
2024-11-13 08:41:47 +00:00
|
|
|
ln --symbolic "${MAIN_USERS_FILE}" "${file}"
|
2023-05-12 21:38:42 +00:00
|
|
|
}
|
2023-05-09 20:09:01 +00:00
|
|
|
|
2023-05-14 12:46:23 +00:00
|
|
|
# import modules
|
2024-11-12 06:44:21 +00:00
|
|
|
main_import_modules() {
|
2024-11-12 09:14:08 +00:00
|
|
|
local file="${1}"
|
|
|
|
if [ -f "${file}" ] ; then
|
|
|
|
local path="$(realpath "${file}")"
|
|
|
|
local root="$(dirname "${path}")"
|
|
|
|
local IFS=$'\n'
|
|
|
|
local modules=($(find "${root}" -type "f" -name "*.sh" | sort))
|
|
|
|
local module
|
|
|
|
for module in "${modules[@]}" ; do
|
|
|
|
if [ "${module}" != "${path}" ] ; then
|
|
|
|
. "${module}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
log_trace "${modules[@]}"
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
log_fatal "No file: ${file}"
|
|
|
|
return 1
|
|
|
|
fi
|
2023-05-09 20:15:40 +00:00
|
|
|
}
|
2023-05-09 20:09:01 +00:00
|
|
|
|
2023-05-14 12:46:23 +00:00
|
|
|
# import modules
|
2024-11-13 08:41:47 +00:00
|
|
|
main_import_modules "${MAIN_USERS_FILE}"
|