client: src: refactor system checks

- UID and dependency checks are done in internal `lib_docker`/`lib_env`
- Moves `sed` check to appropriate `lib_env`
This commit is contained in:
2024-09-22 18:33:10 -07:00
parent d8222c60fb
commit c3cf81572b
2 changed files with 4 additions and 22 deletions

View File

@@ -34,23 +34,13 @@ if [ $UID -lt 1000 ]; then
lib_utils::die_fatal "Do not run as root or system user!"
fi
# Dependencies
deps=("sed")
lib_utils::deps_check "${deps[@]}"
# IMPORTANT: keep umask for security
umask o-rwx
if ! docker compose version 1>/dev/null; then
lib_utils::die_fatal "Docker compose plugin not installed"
fi
if [ -z "$EDITOR" ]; then
editors=("vim" "vi" "emacs" "nano")
for editor in "${editors[@]}"; do
hash "$editor" &>/dev/null && export EDITOR="$editor" && break
done
if [ $? -ne 0 ]; then
lib_utils::die_fatal "Shell EDITOR is not set, export EDITOR in your shell"
fi
fi
#
# "Constructor" for environment generation
#

View File

@@ -47,14 +47,6 @@ source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_uti
# Implementation
#
if [ $UID -lt 1000 ]; then
lib_utils::die_fatal "Do not run as root or system user!"
fi
# Dependencies
deps=("sed")
lib_utils::deps_check "${deps[@]}"
# Top-level caller
global_basename="$(basename -- $0)"
declare -rx global_basename