diff --git a/odoo_install.sh b/odoo_install.sh index 7a95315..8e7c31e 100644 --- a/odoo_install.sh +++ b/odoo_install.sh @@ -1,9 +1,9 @@ #!/bin/bash ################################################################################ -# Script for installing Odoo on Ubuntu 16.04, 18.04 and 20.04 (could be used for other version too) +# Script for installing Odoo on Ubuntu 16.04, 18.04, 20.04 and 22.04 (could be used for other version too) # Author: Yenthe Van Ginneken #------------------------------------------------------------------------------- -# This script will install Odoo on your Ubuntu 16.04 server. It can install multiple Odoo instances +# This script will install Odoo on your Ubuntu server. It can install multiple Odoo instances # in one Ubuntu because of the different xmlrpc_ports #------------------------------------------------------------------------------- # Make a new file: @@ -51,15 +51,24 @@ ADMIN_EMAIL="odoo@example.com" ## https://github.com/odoo/odoo/wiki/Wkhtmltopdf ): ## https://www.odoo.com/documentation/16.0/administration/install.html -WKHTMLTOX_X64="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb" -WKHTMLTOX_X32="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_i386.deb" +# Check if the operating system is Ubuntu 22.04 +if [[ $(lsb_release -r -s) == "22.04" ]]; then + WKHTMLTOX_X64="https://packages.ubuntu.com/jammy/wkhtmltopdf" + WKHTMLTOX_X32="https://packages.ubuntu.com/jammy/wkhtmltopdf" + #No Same link works for both 64 and 32-bit on Ubuntu 22.04 +else + # For older versions of Ubuntu + WKHTMLTOX_X64="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb" + WKHTMLTOX_X32="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_i386.deb" +fi + #-------------------------------------------------- # Update Server #-------------------------------------------------- echo -e "\n---- Update Server ----" # universe package is for Ubuntu 18.x sudo add-apt-repository universe -# libpng12-0 dependency for wkhtmltopdf +# libpng12-0 dependency for wkhtmltopdf for older Ubuntu versions sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ xenial main" sudo apt-get update sudo apt-get upgrade -y @@ -110,7 +119,16 @@ if [ $INSTALL_WKHTMLTOPDF = "True" ]; then _url=$WKHTMLTOX_X32 fi sudo wget $_url - sudo gdebi --n `basename $_url` + + + if [[ $(lsb_release -r -s) == "22.04" ]]; then + # Ubuntu 22.04 LTS + sudo apt install wkhtmltopdf -y + else + # For older versions of Ubuntu + sudo gdebi --n `basename $_url` + fi + sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin else @@ -371,13 +389,22 @@ fi #-------------------------------------------------- if [ $INSTALL_NGINX = "True" ] && [ $ENABLE_SSL = "True" ] && [ $ADMIN_EMAIL != "odoo@example.com" ] && [ $WEBSITE_NAME != "_" ];then - sudo add-apt-repository ppa:certbot/certbot -y && sudo apt-get update -y + sudo apt-get update -y + sudo apt install snapd -y + sudo snap install core; snap refresh core + sudo snap install --classic certbot sudo apt-get install python3-certbot-nginx -y sudo certbot --nginx -d $WEBSITE_NAME --noninteractive --agree-tos --email $ADMIN_EMAIL --redirect sudo service nginx reload echo "SSL/HTTPS is enabled!" else echo "SSL/HTTPS isn't enabled due to choice of the user or because of a misconfiguration!" + if $ADMIN_EMAIL = "odoo@example.com" then + echo "Certbot does not support registering odoo@example.com. You should use real e-mail address." + fi + if $WEBSITE_NAME = "_" then + echo "Website name is set as _. Cannot obtain SSL Certificate for _. You should use real website address." + fi fi echo -e "* Starting Odoo Service"