From 5787bf6fcafc176d2aa7292670ae142824f32ae8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 08:38:49 +0200 Subject: [PATCH] if inside https functions --- cd.sh | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/cd.sh b/cd.sh index 6eff02a..d5a54ae 100644 --- a/cd.sh +++ b/cd.sh @@ -15,12 +15,12 @@ cd_main () { cd_set_packages_repositories cd_set_packages_configuration cd_write_ca_certificates - [ "${CD_CA}" ] && cd_set_https_verification_off + cd_set_https_verification_off cd_update_packages_catalog cd_install_packages_tools cd_install_ca_certificates cd_update_ca_certificates - [ "${CD_CA}" ] && cd_set_https_verification_on + cd_set_https_verification_on cd_update_packages_catalog cd_upgrade_packages cd_install_git @@ -175,20 +175,22 @@ local text } cd_set_https_verification_off () { - cd_step "Set HTTPS verification off" - case "${CD_OS_NAME}" in - "debian") - cd_write "/etc/apt/apt.conf.d/https" "\ + if [ "${CD_CA}" ] ; then + cd_step "Set HTTPS verification off" + case "${CD_OS_NAME}" in + "debian") + cd_write "/etc/apt/apt.conf.d/https" "\ Acquire::https::Verify-Peer False; " - ;; - "alma") - cd_write "/etc/dnf/dnf.conf.d/https.conf" "\ + ;; + "alma") + cd_write "/etc/dnf/dnf.conf.d/https.conf" "\ sslverify=False " - ;; - *) cd_error_os "cd_set_https_verification_off" ;; - esac + ;; + *) cd_error_os "cd_set_https_verification_off" ;; + esac + fi } cd_update_packages_catalog () { @@ -224,12 +226,14 @@ cd_update_ca_certificates () { } cd_set_https_verification_on () { - cd_step "Set HTTPS verification on" - case "${CD_OS_NAME}" in - "debian") cd_rm "/etc/apt/apt.conf.d/https" ;; - "alma") cd_rm "/etc/dnf/dnf.conf.d/https.conf" ;; - *) cd_error_os "cd_set_https_verification_on" ;; - esac + if [ "${CD_CA}" ] ; then + cd_step "Set HTTPS verification on" + case "${CD_OS_NAME}" in + "debian") cd_rm "/etc/apt/apt.conf.d/https" ;; + "alma") cd_rm "/etc/dnf/dnf.conf.d/https.conf" ;; + *) cd_error_os "cd_set_https_verification_on" ;; + esac + fi } cd_upgrade_packages () {