Commit 6c24efa8 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: support CA certs provided as file

parent c9363de5
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -153,6 +153,15 @@ stages:
    fi
  }

  function as_content() {
    file_or_content=$1
    if [[ -f "${file_or_content}" ]]; then
      cat "${file_or_content}"
    else
      echo "${file_or_content}"
    fi
  }

  function install_ca_certs() {
    certs=$1
    if [[ -z "$certs" ]]
@@ -164,7 +173,7 @@ stages:
    pushd "/tmp/certs"

    # import in system
    if echo "$certs" | csplit -b %02d.pem -sz - /-----BEGIN\ CERTIFICATE-----/ \{\*\}
    if as_content "$certs" | csplit -b %02d.pem -sz - /-----BEGIN\ CERTIFICATE-----/ \{\*\}
    then
      log_info "CA certificates imported in \\e[33;1m/tmp/certs\\e[0m"
    fi