Skip to content

Commit

Permalink
Use libssl-dev on Ubuntu (microsoft#3044)
Browse files Browse the repository at this point in the history
* Use openssl on Ubuntu
  • Loading branch information
brylie authored and IlyaBiryukov committed Dec 13, 2019
1 parent a0ce9b9 commit b3196e2
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions scripts/linux-prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,23 @@ elif type apt-get > /dev/null 2>&1; then

if [ $NETCOREDEPS -ne 0 ]; then
checkNetCoreDeps aptSudoIf "install -yq libicu[0-9][0-9] libkrb5-3 zlib1g"
# Determine which version of libssl to install

# Check for openssl
# dpkg-query can return "1" in some distros if the package is not found. "2" is an unexpected error
LIBSSL=$(dpkg-query -f '${db:Status-Abbrev}\t${binary:Package}\n' -W 'libssl1\.0\.?' 2>&1)
LIBSSL=$(dpkg-query -f '${db:Status-Abbrev}\t${binary:Package}\n' -W 'openssl' 2>&1)
if [ $? -eq 2 ]; then
echo "(!) Failed see if libssl already installed!"
echo "(!) Failed see if openssl already installed!"
exitScript 1
fi
if [ "$(echo "$LIBSSL" | grep -o 'libssl1\.0\.[0-9]:' | uniq | sort | wc -l)" -eq 0 ]; then
# No libssl install 1.0.2 for Debian, 1.0.0 for Ubuntu
if [[ ! -z $(apt-cache --names-only search ^libssl1.0.2$) ]]; then
if ! aptSudoIf "install -yq libssl1.0.2"; then
echo "(!) libssl1.0.2 installation failed!"
exitScript 1
fi
else
if ! aptSudoIf "install -yq libssl1.0.0"; then
echo "(!) libssl1.0.0 installation failed!"
exitScript 1
fi

# Install openssl
if [ "$(echo "$LIBSSL" | grep -o 'openssl' | uniq | sort | wc -l)" -eq 0 ]; then
if ! aptSudoIf "install -yq openssl"; then
echo "(!) openssl installation failed!"
exitScript 1
fi
else
echo "(*) libssl1.0.x already installed."
echo "(*) openssl already installed."
fi
fi

Expand Down

0 comments on commit b3196e2

Please sign in to comment.