From 611286837493ee8aab9a10203ce574f380081eab Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 26 Aug 2024 11:16:53 +0200 Subject: [PATCH] ca/root --- spcd/bootstrap.sh | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 6851b6e..2ff6903 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -600,24 +600,6 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")" SPCD_PYTHON_ALIAS="python3" spcd_split spcd_os_printenv "SPCD_DNS_FILE" "SPCD_PKG_CA" "SPCD_PYTHON_ALIAS" - # set ca command & root - case "${SPCD_OS_ID}" in - "${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}") - SPCD_CA_ROOT="/etc/pki/ca-trust/source/anchors" - ;; - "${SPCD_OS_ALPINE}" | "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") - SPCD_CA_ROOT="/usr/local/share/ca-certificates" - ;; - "${SPCD_OS_ARCH}") - SPCD_CA_ROOT="/etc/ca-certificates/trust-source/anchors" - ;; - "${SPCD_OS_OPENSUSE}") - SPCD_CA_ROOT="/etc/pki/trust/anchors" - ;; - *) ;; - esac - spcd_split - spcd_os_printenv "SPCD_CA_ROOT" # set package manager case "${SPCD_OS_ID}" in "${SPCD_OS_ALPINE}") @@ -1039,12 +1021,27 @@ spcd_ca_install_package() { spcd_ca_write_certificates() { spcd_step "Write certificates" - spcd_os_mkdir "${SPCD_CA_ROOT}" + case "${SPCD_OS_ID}" in + "${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}") + spcd_wcc__root="/etc/pki/ca-trust/source/anchors" + ;; + "${SPCD_OS_ALPINE}" | "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") + spcd_wcc__root="/usr/local/share/ca-certificates" + ;; + "${SPCD_OS_ARCH}") + spcd_wcc__root="/etc/ca-certificates/trust-source/anchors" + ;; + "${SPCD_OS_OPENSUSE}") + spcd_wcc__root="/etc/pki/trust/anchors" + ;; + *) ;; + esac + spcd_os_mkdir "${spcd_wcc__root}" while true; do spcd_wcc__index=$((spcd_wcc__index + 1)) eval "spcd_wcc__text=\"\${SPCD_CA_${spcd_wcc__index}}\"" [ -n "${spcd_wcc__text}" ] || break - spcd_wcc__path="${SPCD_CA_ROOT}/${spcd_wcc__index}.crt" + spcd_wcc__path="${spcd_wcc__root}/${spcd_wcc__index}.crt" spcd_split spcd_os_write "${spcd_wcc__path}" "${spcd_wcc__text}" spcd_openssl_x509 "${spcd_wcc__path}"