cache/wip

This commit is contained in:
Marc Beninca 2025-07-03 21:11:39 +02:00
parent ebc41e8a53
commit 8c55351aae
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -37,6 +37,8 @@ RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}"
# run initial steps # run initial steps
rwx_main() { rwx_main() {
# cache main
rwx_cache "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"
# source system root # source system root
if ! rwx_source "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"; then if ! rwx_source "${RWX_ROOT_SYSTEM}" "${RWX_MAIN_NAME}"; then
__rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}" __rwx_log "Not a directory: ${RWX_ROOT_SYSTEM}"
@ -53,6 +55,28 @@ rwx_main() {
fi fi
} }
# ╭──────┬───────╮
# │ main │ cache │
# ╰──────┴───────╯
rwx_cache() {
local root="${1}"
local module="${2}"
local name="${module%.sh}"
local path="${root}/${module}"
local text="$(cat "${path}")"
case "${text}" in
"#!"*) RWX_CODE="${text}" ;;
*) RWX_CODE="${RWX_CODE}
# ╭╮
# │ ${name} │
# ╰╯
${text}" ;;
esac
}
# ╭──────┬────────╮ # ╭──────┬────────╮
# │ main │ source │ # │ main │ source │
# ╰──────┴────────╯ # ╰──────┴────────╯
@ -71,9 +95,10 @@ rwx_source() {
for module in $(rwx_find_shell "${root}" "${file}"); do for module in $(rwx_find_shell "${root}" "${file}"); do
count=$((count + 1)) count=$((count + 1))
__rwx_log "$(printf "%02d" "${count}") ${module%.sh}" __rwx_log "$(printf "%02d" "${count}") ${module%.sh}"
module="${root}/${module}"
# shellcheck disable=SC1090 # shellcheck disable=SC1090
. "${module}" . "${root}/${module}"
# cache code
rwx_cache "${root}" "${module}"
done done
rwx_ifs_unset rwx_ifs_unset
} }