openssl.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 6+ Debian 8+ and Ubuntu 14+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. Install_openSSL() {
  11. if [ -e "${openssl_install_dir}/lib/libssl.a" ]; then
  12. echo "${CWARNING}openSSL already installed! ${CEND}"
  13. else
  14. pushd ${oneinstack_dir}/src > /dev/null
  15. tar xzf openssl-${openssl_ver}.tar.gz
  16. pushd openssl-${openssl_ver} > /dev/null
  17. make clean
  18. ./config -Wl,-rpath=${openssl_install_dir}/lib -fPIC --prefix=${openssl_install_dir} --openssldir=${openssl_install_dir}
  19. make depend
  20. make -j ${THREAD} && make install
  21. popd > /dev/null
  22. if [ -f "${openssl_install_dir}/lib/libcrypto.a" ]; then
  23. echo "${CSUCCESS}openssl installed successfully! ${CEND}"
  24. /bin/cp cacert.pem ${openssl_install_dir}/cert.pem
  25. rm -rf openssl-${openssl_ver}
  26. else
  27. echo "${CFAILURE}openSSL install failed, Please contact the author! ${CEND}" && lsb_release -a
  28. kill -9 $$
  29. fi
  30. popd > /dev/null
  31. fi
  32. }