Check system OS for install certbot

This commit is contained in:
staff 2019-12-10 06:48:21 +01:00
parent adfb14d2b9
commit 79a8057306
1 changed files with 16 additions and 3 deletions

19
ssl.sh
View File

@ -28,10 +28,23 @@ nonssl(){
sed -i '/ssl_certificate/d' /etc/nginx/conf.d/nextcloud.conf sed -i '/ssl_certificate/d' /etc/nginx/conf.d/nextcloud.conf
} }
install_certbot(){ 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 sudo apt update
apt update if [[ $(grep buster /etc/os-release) ]]; then
apt install certbot python-certbot-nginx -t buster-backports -y [[ -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() { create_certificate() {