diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-02-17 16:16:04 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-02-17 16:16:04 -0500 |
commit | ec5f3d2cbadb2a983ac4bcac65366ef32e6d8f0a (patch) | |
tree | b435b4cbf08d77f2814512cde7eed53318b6d9cc /etc/pkgs/003-openssl.sh | |
parent | 01747a3252407bd014398f5650fcb9757e95ce04 (diff) | |
download | docker-base-ec5f3d2cbadb2a983ac4bcac65366ef32e6d8f0a.tar.gz |
Consolidate base packages
Diffstat (limited to 'etc/pkgs/003-openssl.sh')
-rwxr-xr-x | etc/pkgs/003-openssl.sh | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/etc/pkgs/003-openssl.sh b/etc/pkgs/003-openssl.sh new file mode 100755 index 0000000..92a4658 --- /dev/null +++ b/etc/pkgs/003-openssl.sh @@ -0,0 +1,76 @@ +#!/bin/bash +set -x + +name="openssl" +version="1.1.0j" + +tarball="${name}-${version}.tar.gz" +dest="${tarball%%.tar.gz}" +url="https://www.openssl.org/source/${tarball}" +prefix="${TOOLCHAIN}" + + +function pre() +{ + curl -LO "${url}" + tar xf "${tarball}" +} + + +function get_system_cacert() { + local paths=( + /etc/ssl/cert.pem + /etc/ssl/cacert.pem + /etc/ssl/certs/cacert.pem + /etc/ssl/certs/ca-bundle.crt + ) + for bundle in "${paths[@]}" + do + if [[ -f ${bundle} ]]; then + echo "${bundle}" + break + fi + done +} + + +function build() +{ + pre + pushd "${dest}" + export PATH="${prefix}/bin:${PATH}" + export KERNEL_BITS=64 + target="linux-x86_64" + + sed -i -e "s@./demoCA@${TOOLCHAIN}/ssl@" \ + apps/openssl.cnf \ + apps/CA.pl.in + + ./Configure \ + --prefix="${prefix}" \ + --openssldir="ssl" \ + --libdir="lib" \ + ${LDFLAGS} \ + ${target} \ + enable-ec_nistp_64_gcc_128 \ + zlib-dynamic \ + shared \ + no-ssl3-method + make -j${_maxjobs} + make install MANDIR="${prefix}/share/man" MANSUFFIX=ssl + popd + post +} + +function post() +{ + bundle=$(get_system_cacert) + install -D -m644 "${bundle}" "${prefix}/ssl/cert.pem" + rm -rf "${prefix}/share/doc/openssl/html" + rm -rf "${dest}" + rm -rf "${tarball}" + echo "All done." +} + +# Main +build |