This commit is contained in:
Marc Beninca 2024-11-29 19:41:07 +01:00
parent 903faba54e
commit de22cafbd0
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -2,19 +2,19 @@
# │ constants │ # │ constants │
# ╰───────────╯ # ╰───────────╯
SH_MAIN_NAME="main.sh" RWX_MAIN_FILE_NAME="main.sh"
SH_NAME="sh" RWX_NAME="sh"
SH_ROOT="/etc/${SH_NAME}" RWX_ROOT_SYSTEM="/etc/${RWX_NAME}"
SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" RWX_MAIN="${RWX_ROOT_SYSTEM}/${RWX_MAIN_FILE_NAME}"
# ╭───────────╮ # ╭───────────╮
# │ variables │ # │ variables │
# ╰───────────╯ # ╰───────────╯
SH_SHELL="$(cat "/proc/${$}/comm")" RWX_SHELL="$(cat "/proc/${$}/comm")"
SH_USER="${HOME}/${SH_NAME}" RWX_ROOT_USER="${HOME}/${RWX_NAME}"
# ╭──────────╮ # ╭──────────╮
# │ internal │ # │ internal │
@ -102,7 +102,7 @@ rwx_main_source() {
[ -d "${path}" ] || [ -d "${path}" ] ||
return 1 return 1
local cmd count module modules local cmd count module modules
modules="$(rwx_find_sh "${path}" "${SH_MAIN_NAME}")" modules="$(rwx_find_sh "${path}" "${RWX_MAIN_FILE_NAME}")"
rwx_ifs_set rwx_ifs_set
count=0 count=0
_rwx_main_log "" \ _rwx_main_log "" \
@ -130,20 +130,20 @@ rwx_main_source() {
# run initial steps # run initial steps
rwx_main() { rwx_main() {
# system root # system root
if ! rwx_main_source "${SH_ROOT}"; then if ! rwx_main_source "${RWX_ROOT_SYSTEM}"; then
_rwx_main_log "Not a directory: ${SH_ROOT}" _rwx_main_log "Not a directory: ${RWX_ROOT_SYSTEM}"
return 1 return 1
fi fi
# user root # user root
rwx_main_source "${SH_USER}" rwx_main_source "${RWX_ROOT_USER}"
# run interactive extras # run interactive extras
if rwx_shell_interactive; then if rwx_shell_interactive; then
# check format # check format
rwx_log rwx_log
rwx_shfmt_check "${SH_ROOT}" rwx_shfmt_check "${RWX_ROOT_SYSTEM}"
# check syntax # check syntax
rwx_log rwx_log
rwx_shellcheck_check "${SH_ROOT}" rwx_shellcheck_check "${RWX_ROOT_SYSTEM}"
# help # help
rwx_log rwx_log
rwx_help rwx_help