From 79a8057306ca9c5f8dd9452dc30a1b6ba1c4ce78 Mon Sep 17 00:00:00 2001 From: staff Date: Tue, 10 Dec 2019 06:48:21 +0100 Subject: [PATCH] Check system OS for install certbot --- ssl.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ssl.sh b/ssl.sh index f1a98c5..8e9521a 100755 --- a/ssl.sh +++ b/ssl.sh @@ -28,10 +28,23 @@ nonssl(){ sed -i '/ssl_certificate/d' /etc/nginx/conf.d/nextcloud.conf } + install_certbot(){ - [[ -z $(cat /etc/apt/sources.list | grep "buster-backports main") ]] && echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list - apt update - apt install certbot python-certbot-nginx -t buster-backports -y + sudo apt update + if [[ $(grep buster /etc/os-release) ]]; then + [[ -z $(cat /etc/apt/sources.list | grep "buster-backports main") ]] && echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list + sudo apt install certbot python-certbot-nginx -t buster-backports -y + elif [[ $(grep stretch /etc/os-release) ]]; then + sudo apt install certbot python-certbot-nginx -y + elif [[ $(grep -E '16.|17.|18.|19.' /etc/os-release) ]]; then + sudo apt install software-properties-common + sudo add-apt-repository universe + sudo add-apt-repository ppa:certbot/certbot + sudo apt update + sudo apt install certbot python-certbot-nginx + else + echo "OS non supporté pour certbot." && exit 1 + fi } create_certificate() {