This commit is contained in:
Marc Beninca 2024-05-23 15:20:25 +02:00
parent 3b6803e2da
commit fb8ff9af61
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

11
cd.sh
View file

@ -38,7 +38,7 @@ cd_main () {
cd_set_environment_variables () { cd_set_environment_variables () {
cd_step "Set environment variables" cd_step "Set environment variables"
# operating system # set operating system id
CD_OS_ID="$(cd_grep_os ID)" CD_OS_ID="$(cd_grep_os ID)"
case "${CD_OS_ID}" in case "${CD_OS_ID}" in
"almalinux") CD_OS_ID="${CD_OS_ALMA}" ;; "almalinux") CD_OS_ID="${CD_OS_ALMA}" ;;
@ -50,6 +50,7 @@ cd_set_environment_variables () {
"ubuntu") CD_OS_ID="${CD_OS_UBUNTU}" ;; "ubuntu") CD_OS_ID="${CD_OS_UBUNTU}" ;;
*) cd_error_os "CD_OS_ID" ;; *) cd_error_os "CD_OS_ID" ;;
esac esac
# set operating system version
case "${CD_OS_ID}" in case "${CD_OS_ID}" in
"${CD_OS_ALMA}"|"${CD_OS_ARCH}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}") "${CD_OS_ALMA}"|"${CD_OS_ARCH}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}")
CD_OS_VERSION=$(cd_grep_os VERSION_ID \ CD_OS_VERSION=$(cd_grep_os VERSION_ID \
@ -63,6 +64,7 @@ cd_set_environment_variables () {
CD_OS_VERSION="$(cd_grep_os VERSION_CODENAME)" CD_OS_VERSION="$(cd_grep_os VERSION_CODENAME)"
;; ;;
esac esac
# check operating system version
case "${CD_OS_ID}" in case "${CD_OS_ID}" in
"${CD_OS_ALMA}"|"${CD_OS_ROCKY}") "${CD_OS_ALMA}"|"${CD_OS_ROCKY}")
case "${CD_OS_VERSION}" in case "${CD_OS_VERSION}" in
@ -108,7 +110,7 @@ cd_set_environment_variables () {
CD_PKG_GIT="git" CD_PKG_GIT="git"
cd_split cd_split
cd_echo "CD_DNS_FILE" "CD_PKG_CA" "CD_PKG_GIT" cd_echo "CD_DNS_FILE" "CD_PKG_CA" "CD_PKG_GIT"
# shared # set ca command & root
case "${CD_OS_ID}" in case "${CD_OS_ID}" in
"${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}") "${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}")
CD_CA_ROOT="/etc/pki/ca-trust/source/anchors" CD_CA_ROOT="/etc/pki/ca-trust/source/anchors"
@ -129,7 +131,7 @@ cd_set_environment_variables () {
esac esac
cd_split cd_split
cd_echo "CD_CA_ROOT" "CD_CMD_CA" cd_echo "CD_CA_ROOT" "CD_CMD_CA"
# common # set package manager
case "${CD_OS_ID}" in case "${CD_OS_ID}" in
"${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}") "${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}")
CD_PM="${CD_PM_DNF}" CD_PM="${CD_PM_DNF}"
@ -253,7 +255,7 @@ Dir::Etc::SourceParts \"\";
esac esac
cd_split cd_split
cd_echo "CD_URL_DEFAULT" "CD_URL_CHOSEN" cd_echo "CD_URL_DEFAULT" "CD_URL_CHOSEN"
# python # set python command & package
case "${CD_OS_ID}" in case "${CD_OS_ID}" in
"${CD_OS_ALMA}"|"${CD_OS_ROCKY}") "${CD_OS_ALMA}"|"${CD_OS_ROCKY}")
CD_PYTHON_COMMAND="python3.11" CD_PYTHON_COMMAND="python3.11"
@ -286,6 +288,7 @@ Dir::Etc::SourceParts \"\";
CD_PYTHON_PACKAGE="python3" CD_PYTHON_PACKAGE="python3"
;; ;;
esac esac
# set python packages
case "${CD_OS_ID}" in case "${CD_OS_ID}" in
"${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}") "${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}")
CD_PYTHON_PACKAGES="/usr/lib64/${CD_PYTHON_COMMAND}/site-packages" CD_PYTHON_PACKAGES="/usr/lib64/${CD_PYTHON_COMMAND}/site-packages"