azure / script /install_openssl.sh
HoneyTian's picture
update
49426b3
#!/usr/bin/env bash
# bash script/install_openssl.sh --system_version ubuntu --openssl_version 1.1.1
# params:
system_version="centos";
# https://www.openssl.org/source/old/
openssl_version=1.1.1t
# parse options
while true; do
[ -z "${1:-}" ] && break; # break if there are no arguments
case "$1" in
--*) name=$(echo "$1" | sed s/^--// | sed s/-/_/g);
eval '[ -z "${'"$name"'+xxx}" ]' && echo "$0: invalid option $1" 1>&2 && exit 1;
old_value="(eval echo \\$$name)";
if [ "${old_value}" == "true" ] || [ "${old_value}" == "false" ]; then
was_bool=true;
else
was_bool=false;
fi
# Set the variable to the right value-- the escaped quotes make it work if
# the option had spaces, like --cmd "queue.pl -sync y"
eval "${name}=\"$2\"";
# Check that Boolean-valued arguments are really Boolean.
if $was_bool && [[ "$2" != "true" && "$2" != "false" ]]; then
echo "$0: expected \"true\" or \"false\": $1 $2" 1>&2
exit 1;
fi
shift 2;
;;
*) break;
esac
done
echo "system_version: ${system_version}";
if [ ${system_version} = "centos" ] || [ ${system_version} = "ubuntu" ]; then
mkdir -p /data/dep
cd /data/dep || exit 1;
if [ ! -e openssl-${openssl_version}.tar.gz ]; then
wget "https://www.openssl.org/source/openssl-${openssl_version}.tar.gz" --no-check-certificate
fi
cd /data/dep || exit 1;
if [ ! -d openssl-${openssl_version} ]; then
tar -zxvf openssl-${openssl_version}.tar.gz
cd /data/dep/openssl-${openssl_version} || exit 1;
fi
mkdir -p /usr/local/openssl
./config --prefix=/usr/local/openssl
#./Configure --prefix=/usr/local/openssl
make -j && make install
fi