spcd_os_printenv

This commit is contained in:
Marc Beninca 2024-08-25 21:28:50 +02:00
parent c84480bc82
commit 161dd791f0
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -181,7 +181,7 @@ spcd_error_ci() {
spcd_error_os() { spcd_error_os() {
spcd_error_os__variable="${1}" spcd_error_os__variable="${1}"
printf "× OS: " printf "× OS: "
spcd_echo "${spcd_error_os__variable}" spcd_os_printenv "${spcd_error_os__variable}"
exit "${SPCD_ERROR_OS}" exit "${SPCD_ERROR_OS}"
} }
@ -355,11 +355,11 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
[ -n "${SPCD_PROJECT_PATH}" ] || spcd_error_ci "SPCD_PROJECT_PATH" [ -n "${SPCD_PROJECT_PATH}" ] || spcd_error_ci "SPCD_PROJECT_PATH"
[ -n "${SPCD_PROJECT_NAME}" ] || spcd_error_ci "SPCD_PROJECT_NAME" [ -n "${SPCD_PROJECT_NAME}" ] || spcd_error_ci "SPCD_PROJECT_NAME"
# #
spcd_echo "SPCD_PROJECT_BRANCH" \ spcd_os_printenv "SPCD_PROJECT_BRANCH" \
"SPCD_PROJECT_ROOT" "SPCD_PROJECT_PATH" "SPCD_PROJECT_NAME" "SPCD_PROJECT_ROOT" "SPCD_PROJECT_PATH" "SPCD_PROJECT_NAME"
# set path # set path
SPCD_PATH="$(realpath "${0}")" SPCD_PATH="$(realpath "${0}")"
spcd_echo "SPCD_PATH" spcd_os_printenv "SPCD_PATH"
# set operating system id # set operating system id
SPCD_OS_ID="$(spcd_os_grep ID)" SPCD_OS_ID="$(spcd_os_grep ID)"
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
@ -436,7 +436,7 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
*) ;; *) ;;
esac esac
spcd_split spcd_split
spcd_echo "SPCD_OS_ID" "SPCD_OS_VERSION" spcd_os_printenv "SPCD_OS_ID" "SPCD_OS_VERSION"
# universal # universal
SPCD_DNS_FILE="/etc/resolv.conf" SPCD_DNS_FILE="/etc/resolv.conf"
SPCD_PKG_CA="ca-certificates" SPCD_PKG_CA="ca-certificates"
@ -444,7 +444,7 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
SPCD_PKG_GIT="git" SPCD_PKG_GIT="git"
SPCD_PYTHON_ALIAS="python3" SPCD_PYTHON_ALIAS="python3"
spcd_split spcd_split
spcd_echo "SPCD_DNS_FILE" \ spcd_os_printenv "SPCD_DNS_FILE" \
"SPCD_PKG_CA" "SPCD_PKG_DOS2UNIX" "SPCD_PKG_GIT" "SPCD_PYTHON_ALIAS" "SPCD_PKG_CA" "SPCD_PKG_DOS2UNIX" "SPCD_PKG_GIT" "SPCD_PYTHON_ALIAS"
# set ca command & root # set ca command & root
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
@ -471,7 +471,7 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
*) ;; *) ;;
esac esac
spcd_split spcd_split
spcd_echo "SPCD_CA_ROOT" "SPCD_CMD_CA" spcd_os_printenv "SPCD_CA_ROOT" "SPCD_CMD_CA"
# set package manager # set package manager
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_ALPINE}") "${SPCD_OS_ALPINE}")
@ -509,7 +509,7 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
esac esac
# set package manager variables # set package manager variables
spcd_split spcd_split
spcd_echo "SPCD_PF" "SPCD_PM" spcd_os_printenv "SPCD_PF" "SPCD_PM"
case "${SPCD_PM}" in case "${SPCD_PM}" in
"${SPCD_PM_DNF}") "${SPCD_PM_DNF}")
SPCD_PM_CLEAN="dnf clean all" SPCD_PM_CLEAN="dnf clean all"
@ -597,10 +597,10 @@ Acquire::https::Verify-Peer False;
*) ;; *) ;;
esac esac
spcd_split spcd_split
spcd_echo "SPCD_PM_CLEAN" \ spcd_os_printenv "SPCD_PM_CLEAN" \
"SPCD_PM_INSTALL" "SPCD_PM_QUERY" "SPCD_PM_UPDATE" "SPCD_PM_UPGRADE" "SPCD_PM_INSTALL" "SPCD_PM_QUERY" "SPCD_PM_UPDATE" "SPCD_PM_UPGRADE"
spcd_split spcd_split
spcd_echo "SPCD_PKG_PKG" "SPCD_PM_CONF_PATH" "SPCD_PM_HTTPS_PATH" spcd_os_printenv "SPCD_PKG_PKG" "SPCD_PM_CONF_PATH" "SPCD_PM_HTTPS_PATH"
# specific # specific
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_ALMA}") "${SPCD_OS_ALMA}")
@ -664,7 +664,7 @@ Acquire::https::Verify-Peer False;
*) ;; *) ;;
esac esac
spcd_split spcd_split
spcd_echo "SPCD_URL_DEFAULT" "SPCD_URL_CHOSEN" spcd_os_printenv "SPCD_URL_DEFAULT" "SPCD_URL_CHOSEN"
# set python command & package # set python command & package
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}") "${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}")
@ -719,7 +719,7 @@ Acquire::https::Verify-Peer False;
*) ;; *) ;;
esac esac
spcd_split spcd_split
spcd_echo "SPCD_PYTHON_COMMAND" "SPCD_PYTHON_PACKAGE" spcd_os_printenv "SPCD_PYTHON_COMMAND" "SPCD_PYTHON_PACKAGE"
# set python packages # set python packages
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}" | \ "${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}" | \
@ -737,14 +737,14 @@ Acquire::https::Verify-Peer False;
SPCD_PYTHON_VENV_PACKAGES="\ SPCD_PYTHON_VENV_PACKAGES="\
${SPCD_PYTHON_VENV}/lib/${SPCD_PYTHON_COMMAND}/site-packages" ${SPCD_PYTHON_VENV}/lib/${SPCD_PYTHON_COMMAND}/site-packages"
spcd_split spcd_split
spcd_echo "SPCD_PYTHON_PACKAGES" "SPCD_PYTHON_VENV_PACKAGES" spcd_os_printenv "SPCD_PYTHON_PACKAGES" "SPCD_PYTHON_VENV_PACKAGES"
# variables # variables
# certificate authorities # certificate authorities
[ -n "${SPCD_CA_1}" ] && SPCD_CA=true [ -n "${SPCD_CA_1}" ] && SPCD_CA=true
# downloads # downloads
SPCD_DL="$(mktemp --directory)" SPCD_DL="$(mktemp --directory)"
spcd_split spcd_split
spcd_echo "SPCD_CA" "SPCD_DL" spcd_os_printenv "SPCD_CA" "SPCD_DL"
} }
spcd_list_working_directory() { spcd_list_working_directory() {
@ -1050,7 +1050,7 @@ spcd_write_python_module() {
PROJECT_ROOT PROJECT_PATH PROJECT_NAME \ PROJECT_ROOT PROJECT_PATH PROJECT_NAME \
PYTHON_VENV_BINARIES PYTHON_VENV_PACKAGES \ PYTHON_VENV_BINARIES PYTHON_VENV_PACKAGES \
OPEN DOWN VERT SPLT __UP SHUT; do OPEN DOWN VERT SPLT __UP SHUT; do
spcd_wpm__value="$(spcd_echo "SPCD_${spcd_wpm__variable}")" spcd_wpm__value="$(spcd_os_printenv "SPCD_${spcd_wpm__variable}")"
spcd_wpm__text="${spcd_wpm__text}${spcd_wpm__value} spcd_wpm__text="${spcd_wpm__text}${spcd_wpm__value}
" "
done done
@ -1085,12 +1085,12 @@ spcd_cat() {
fi fi
} }
spcd_echo() { spcd_os_printenv() {
if [ -n "${1}" ]; then if [ -n "${1}" ]; then
for spcd_echo__name in "${@}"; do for spcd_os_printenv__name in "${@}"; do
spcd_echo__text="" spcd_os_printenv__text=""
eval "spcd_echo__text=\"\${${spcd_echo__name}}\"" eval "spcd_os_printenv__text=\"\${${spcd_os_printenv__name}}\""
echo "${spcd_echo__name} = \"${spcd_echo__text}\"" echo "${spcd_os_printenv__name} = \"${spcd_os_printenv__text}\""
done done
fi fi
} }