Skip to content

Commit 0aafdd6

Browse files
authored
[IMP] install_script: 22.04 (wkhtmltopdf) support
2 parents f2ade58 + f3a1f73 commit 0aafdd6

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

odoo_install.sh

+34-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
################################################################################
3-
# Script for installing Odoo on Ubuntu 16.04, 18.04 and 20.04 (could be used for other version too)
3+
# Script for installing Odoo on Ubuntu 16.04, 18.04, 20.04 and 22.04 (could be used for other version too)
44
# Author: Yenthe Van Ginneken
55
#-------------------------------------------------------------------------------
6-
# This script will install Odoo on your Ubuntu 16.04 server. It can install multiple Odoo instances
6+
# This script will install Odoo on your Ubuntu server. It can install multiple Odoo instances
77
# in one Ubuntu because of the different xmlrpc_ports
88
#-------------------------------------------------------------------------------
99
# Make a new file:
@@ -51,15 +51,24 @@ ADMIN_EMAIL="odoo@example.com"
5151
## https://github.com/odoo/odoo/wiki/Wkhtmltopdf ):
5252
## https://www.odoo.com/documentation/16.0/administration/install.html
5353

54-
WKHTMLTOX_X64="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb"
55-
WKHTMLTOX_X32="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_i386.deb"
54+
# Check if the operating system is Ubuntu 22.04
55+
if [[ $(lsb_release -r -s) == "22.04" ]]; then
56+
WKHTMLTOX_X64="https://packages.ubuntu.com/jammy/wkhtmltopdf"
57+
WKHTMLTOX_X32="https://packages.ubuntu.com/jammy/wkhtmltopdf"
58+
#No Same link works for both 64 and 32-bit on Ubuntu 22.04
59+
else
60+
# For older versions of Ubuntu
61+
WKHTMLTOX_X64="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb"
62+
WKHTMLTOX_X32="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_i386.deb"
63+
fi
64+
5665
#--------------------------------------------------
5766
# Update Server
5867
#--------------------------------------------------
5968
echo -e "\n---- Update Server ----"
6069
# universe package is for Ubuntu 18.x
6170
sudo add-apt-repository universe
62-
# libpng12-0 dependency for wkhtmltopdf
71+
# libpng12-0 dependency for wkhtmltopdf for older Ubuntu versions
6372
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ xenial main"
6473
sudo apt-get update
6574
sudo apt-get upgrade -y
@@ -110,7 +119,16 @@ if [ $INSTALL_WKHTMLTOPDF = "True" ]; then
110119
_url=$WKHTMLTOX_X32
111120
fi
112121
sudo wget $_url
113-
sudo gdebi --n `basename $_url`
122+
123+
124+
if [[ $(lsb_release -r -s) == "22.04" ]]; then
125+
# Ubuntu 22.04 LTS
126+
sudo apt install wkhtmltopdf -y
127+
else
128+
# For older versions of Ubuntu
129+
sudo gdebi --n `basename $_url`
130+
fi
131+
114132
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
115133
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
116134
else
@@ -371,13 +389,22 @@ fi
371389
#--------------------------------------------------
372390

373391
if [ $INSTALL_NGINX = "True" ] && [ $ENABLE_SSL = "True" ] && [ $ADMIN_EMAIL != "odoo@example.com" ] && [ $WEBSITE_NAME != "_" ];then
374-
sudo add-apt-repository ppa:certbot/certbot -y && sudo apt-get update -y
392+
sudo apt-get update -y
393+
sudo apt install snapd -y
394+
sudo snap install core; snap refresh core
395+
sudo snap install --classic certbot
375396
sudo apt-get install python3-certbot-nginx -y
376397
sudo certbot --nginx -d $WEBSITE_NAME --noninteractive --agree-tos --email $ADMIN_EMAIL --redirect
377398
sudo service nginx reload
378399
echo "SSL/HTTPS is enabled!"
379400
else
380401
echo "SSL/HTTPS isn't enabled due to choice of the user or because of a misconfiguration!"
402+
if $ADMIN_EMAIL = "odoo@example.com" then
403+
echo "Certbot does not support registering odoo@example.com. You should use real e-mail address."
404+
fi
405+
if $WEBSITE_NAME = "_" then
406+
echo "Website name is set as _. Cannot obtain SSL Certificate for _. You should use real website address."
407+
fi
381408
fi
382409

383410
echo -e "* Starting Odoo Service"

0 commit comments

Comments
 (0)