This commit is contained in:
Marc Beninca 2024-05-03 21:28:37 +02:00
parent 288f1a3101
commit 84ccc6f215
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

15
cd.sh
View file

@ -65,6 +65,7 @@ cd_set_environment_variables () {
*) cd_error_os "CD_OS_VERSION" ;; *) cd_error_os "CD_OS_VERSION" ;;
esac esac
CD_CA_ROOT="/etc/pki/ca-trust/source/anchors" CD_CA_ROOT="/etc/pki/ca-trust/source/anchors"
CD_CMD_CA="update-ca-trust"
CD_CMD_CLEAN="dnf clean all" CD_CMD_CLEAN="dnf clean all"
CD_CMD_UPGRADE="dnf upgrade --assumeyes" CD_CMD_UPGRADE="dnf upgrade --assumeyes"
CD_FILE_HTTPS="/etc/dnf/dnf.conf.d/https.conf" CD_FILE_HTTPS="/etc/dnf/dnf.conf.d/https.conf"
@ -80,6 +81,7 @@ cd_set_environment_variables () {
*) cd_error_os "CD_OS_VERSION" ;; *) cd_error_os "CD_OS_VERSION" ;;
esac esac
CD_CA_ROOT="/usr/local/share/ca-certificates" CD_CA_ROOT="/usr/local/share/ca-certificates"
CD_CMD_CA="update-ca-certificates"
CD_CMD_CLEAN="apt-get clean" CD_CMD_CLEAN="apt-get clean"
CD_CMD_UPGRADE="apt-get upgrade --assume-yes" CD_CMD_UPGRADE="apt-get upgrade --assume-yes"
CD_FILE_HTTPS="/etc/apt/apt.conf.d/https" CD_FILE_HTTPS="/etc/apt/apt.conf.d/https"
@ -217,6 +219,8 @@ cd_install_packages_tools () {
esac esac
} }
# agnostic steps
cd_install_ca_certificates () { cd_install_ca_certificates () {
cd_step "Install CA" cd_step "Install CA"
cd_install_package "${CD_CA_PACKAGE}" cd_install_package "${CD_CA_PACKAGE}"
@ -225,7 +229,7 @@ cd_install_ca_certificates () {
cd_write_ca_certificates () { cd_write_ca_certificates () {
local index local index
local text local text
cd_step "Copy CA" cd_step "Write CA certificates"
cd_mkdir "${CD_CA_ROOT}" cd_mkdir "${CD_CA_ROOT}"
index=1 index=1
eval "text=\"\${CD_CA_${index}}\"" eval "text=\"\${CD_CA_${index}}\""
@ -237,15 +241,10 @@ local text
} }
cd_update_ca_certificates () { cd_update_ca_certificates () {
cd_step "Update CA" cd_step "Update CA certificates"
case "${CD_OS_ID}" in ${CD_CMD_CA} || exit
"${CD_OS_ALMA}") update-ca-trust || exit ;;
"${CD_OS_DEBIAN}") update-ca-certificates || exit ;;
esac
} }
# agnostic steps
cd_set_https_verification_on () { cd_set_https_verification_on () {
if [ "${CD_CA}" -o "${CD_OS_ID}" = "${CD_OS_DEBIAN}" ] ; then if [ "${CD_CA}" -o "${CD_OS_ID}" = "${CD_OS_DEBIAN}" ] ; then
cd_step "Set HTTPS verification on" cd_step "Set HTTPS verification on"