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__variable="${1}"
printf "× OS: "
spcd_echo "${spcd_error_os__variable}"
spcd_os_printenv "${spcd_error_os__variable}"
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_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"
# set path
SPCD_PATH="$(realpath "${0}")"
spcd_echo "SPCD_PATH"
spcd_os_printenv "SPCD_PATH"
# set operating system id
SPCD_OS_ID="$(spcd_os_grep ID)"
case "${SPCD_OS_ID}" in
@ -436,7 +436,7 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
*) ;;
esac
spcd_split
spcd_echo "SPCD_OS_ID" "SPCD_OS_VERSION"
spcd_os_printenv "SPCD_OS_ID" "SPCD_OS_VERSION"
# universal
SPCD_DNS_FILE="/etc/resolv.conf"
SPCD_PKG_CA="ca-certificates"
@ -444,7 +444,7 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
SPCD_PKG_GIT="git"
SPCD_PYTHON_ALIAS="python3"
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"
# set ca command & root
case "${SPCD_OS_ID}" in
@ -471,7 +471,7 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
*) ;;
esac
spcd_split
spcd_echo "SPCD_CA_ROOT" "SPCD_CMD_CA"
spcd_os_printenv "SPCD_CA_ROOT" "SPCD_CMD_CA"
# set package manager
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALPINE}")
@ -509,7 +509,7 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
esac
# set package manager variables
spcd_split
spcd_echo "SPCD_PF" "SPCD_PM"
spcd_os_printenv "SPCD_PF" "SPCD_PM"
case "${SPCD_PM}" in
"${SPCD_PM_DNF}")
SPCD_PM_CLEAN="dnf clean all"
@ -597,10 +597,10 @@ Acquire::https::Verify-Peer False;
*) ;;
esac
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_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
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALMA}")
@ -664,7 +664,7 @@ Acquire::https::Verify-Peer False;
*) ;;
esac
spcd_split
spcd_echo "SPCD_URL_DEFAULT" "SPCD_URL_CHOSEN"
spcd_os_printenv "SPCD_URL_DEFAULT" "SPCD_URL_CHOSEN"
# set python command & package
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}")
@ -719,7 +719,7 @@ Acquire::https::Verify-Peer False;
*) ;;
esac
spcd_split
spcd_echo "SPCD_PYTHON_COMMAND" "SPCD_PYTHON_PACKAGE"
spcd_os_printenv "SPCD_PYTHON_COMMAND" "SPCD_PYTHON_PACKAGE"
# set python packages
case "${SPCD_OS_ID}" in
"${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}/lib/${SPCD_PYTHON_COMMAND}/site-packages"
spcd_split
spcd_echo "SPCD_PYTHON_PACKAGES" "SPCD_PYTHON_VENV_PACKAGES"
spcd_os_printenv "SPCD_PYTHON_PACKAGES" "SPCD_PYTHON_VENV_PACKAGES"
# variables
# certificate authorities
[ -n "${SPCD_CA_1}" ] && SPCD_CA=true
# downloads
SPCD_DL="$(mktemp --directory)"
spcd_split
spcd_echo "SPCD_CA" "SPCD_DL"
spcd_os_printenv "SPCD_CA" "SPCD_DL"
}
spcd_list_working_directory() {
@ -1050,7 +1050,7 @@ spcd_write_python_module() {
PROJECT_ROOT PROJECT_PATH PROJECT_NAME \
PYTHON_VENV_BINARIES PYTHON_VENV_PACKAGES \
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}
"
done
@ -1085,12 +1085,12 @@ spcd_cat() {
fi
}
spcd_echo() {
spcd_os_printenv() {
if [ -n "${1}" ]; then
for spcd_echo__name in "${@}"; do
spcd_echo__text=""
eval "spcd_echo__text=\"\${${spcd_echo__name}}\""
echo "${spcd_echo__name} = \"${spcd_echo__text}\""
for spcd_os_printenv__name in "${@}"; do
spcd_os_printenv__text=""
eval "spcd_os_printenv__text=\"\${${spcd_os_printenv__name}}\""
echo "${spcd_os_printenv__name} = \"${spcd_os_printenv__text}\""
done
fi
}