main
This commit is contained in:
parent
903faba54e
commit
de22cafbd0
1 changed files with 12 additions and 12 deletions
24
sh/main.sh
24
sh/main.sh
|
@ -2,19 +2,19 @@
|
|||
# │ constants │
|
||||
# ╰───────────╯
|
||||
|
||||
SH_MAIN_NAME="main.sh"
|
||||
SH_NAME="sh"
|
||||
RWX_MAIN_FILE_NAME="main.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 │
|
||||
# ╰───────────╯
|
||||
|
||||
SH_SHELL="$(cat "/proc/${$}/comm")"
|
||||
SH_USER="${HOME}/${SH_NAME}"
|
||||
RWX_SHELL="$(cat "/proc/${$}/comm")"
|
||||
RWX_ROOT_USER="${HOME}/${RWX_NAME}"
|
||||
|
||||
# ╭──────────╮
|
||||
# │ internal │
|
||||
|
@ -102,7 +102,7 @@ rwx_main_source() {
|
|||
[ -d "${path}" ] ||
|
||||
return 1
|
||||
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
|
||||
count=0
|
||||
_rwx_main_log "" \
|
||||
|
@ -130,20 +130,20 @@ rwx_main_source() {
|
|||
# run initial steps
|
||||
rwx_main() {
|
||||
# system root
|
||||
if ! rwx_main_source "${SH_ROOT}"; then
|
||||
_rwx_main_log "Not a directory: ${SH_ROOT}"
|
||||
if ! rwx_main_source "${RWX_ROOT_SYSTEM}"; then
|
||||
_rwx_main_log "Not a directory: ${RWX_ROOT_SYSTEM}"
|
||||
return 1
|
||||
fi
|
||||
# user root
|
||||
rwx_main_source "${SH_USER}"
|
||||
rwx_main_source "${RWX_ROOT_USER}"
|
||||
# run interactive extras
|
||||
if rwx_shell_interactive; then
|
||||
# check format
|
||||
rwx_log
|
||||
rwx_shfmt_check "${SH_ROOT}"
|
||||
rwx_shfmt_check "${RWX_ROOT_SYSTEM}"
|
||||
# check syntax
|
||||
rwx_log
|
||||
rwx_shellcheck_check "${SH_ROOT}"
|
||||
rwx_shellcheck_check "${RWX_ROOT_SYSTEM}"
|
||||
# help
|
||||
rwx_log
|
||||
rwx_help
|
||||
|
|
Loading…
Reference in a new issue