fix: Fixes let's encrypt for latest ubuntu versions. (#11434)

* fix: Fixes let's encrypt for latest ubuntu versions.

* squash: Simplifies the logic.
This commit is contained in:
Дамян Минков 2022-04-26 13:48:25 -05:00 committed by GitHub
parent 20f6ba1736
commit 0ae2693116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 21 deletions

View File

@ -27,30 +27,25 @@ CERTBOT="$(command -v certbot || true)"
if [ ! -x "$CERTBOT" ] ; then
DISTRO=$(lsb_release -is)
DISTRO_VERSION=$(lsb_release -rs)
if [ "$DISTRO" = "Debian" ]; then
apt-get update
apt-get -y install certbot
elif [ "$DISTRO" = "Ubuntu" ]; then
if [ "$DISTRO_VERSION" = "20.04" ] || [ "$DISTRO_VERSION" = "19.10" ]; then
apt-get update
apt-get -y install software-properties-common
add-apt-repository -y universe
apt-get update
apt-get -y install certbot
elif [ "$DISTRO_VERSION" = "18.04" ]; then
apt-get update
apt-get -y install software-properties-common
add-apt-repository -y universe
add-apt-repository -y ppa:certbot/certbot
apt-get update
apt-get -y install certbot
fi
else
if [ "$DISTRO" != "Debian" ] && [ "$DISTRO" != "Ubuntu" ]; then
echo "$DISTRO $DISTRO_VERSION is not supported"
echo "Only Debian 9,10 and Ubuntu 18.04,19.10,20.04 are supported"
echo "Only Debian and Ubuntu 18.04+ are supported"
exit 1
fi
if [ "$DISTRO" = "Ubuntu" ]; then
apt-get update
apt-get -y install software-properties-common
add-apt-repository -y universe
if [ "$DISTRO_VERSION" = "18.04" ]; then
add-apt-repository -y ppa:certbot/certbot
fi
fi
apt-get update
apt-get -y install certbot
CERTBOT="$(command -v certbot)"
fi