Skip to content

Commit f3a1f73

Browse files
[FIX] Final version of wkhtmltopdf. [FIX] Certbot installation
Wkhtmltopdf has finally been published for 22.04. Added real link. Certbot URL has been depreceated and uses Snap. Added functionality.
1 parent 35efd9e commit f3a1f73

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

odoo_install.sh

+23-5
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ ADMIN_EMAIL="odoo@example.com"
5353

5454
# Check if the operating system is Ubuntu 22.04
5555
if [[ $(lsb_release -r -s) == "22.04" ]]; then
56-
WKHTMLTOX_X64="https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb"
57-
#No 32 bit version available for Ubuntu 22.04
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
5859
else
5960
# For older versions of Ubuntu
6061
WKHTMLTOX_X64="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb"
@@ -67,7 +68,7 @@ fi
6768
echo -e "\n---- Update Server ----"
6869
# universe package is for Ubuntu 18.x
6970
sudo add-apt-repository universe
70-
# libpng12-0 dependency for wkhtmltopdf
71+
# libpng12-0 dependency for wkhtmltopdf for older Ubuntu versions
7172
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ xenial main"
7273
sudo apt-get update
7374
sudo apt-get upgrade -y
@@ -118,7 +119,15 @@ if [ $INSTALL_WKHTMLTOPDF = "True" ]; then
118119
_url=$WKHTMLTOX_X32
119120
fi
120121
sudo wget $_url
121-
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
122131

123132
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
124133
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
@@ -380,13 +389,22 @@ fi
380389
#--------------------------------------------------
381390

382391
if [ $INSTALL_NGINX = "True" ] && [ $ENABLE_SSL = "True" ] && [ $ADMIN_EMAIL != "odoo@example.com" ] && [ $WEBSITE_NAME != "_" ];then
383-
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
384396
sudo apt-get install python3-certbot-nginx -y
385397
sudo certbot --nginx -d $WEBSITE_NAME --noninteractive --agree-tos --email $ADMIN_EMAIL --redirect
386398
sudo service nginx reload
387399
echo "SSL/HTTPS is enabled!"
388400
else
389401
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
390408
fi
391409

392410
echo -e "* Starting Odoo Service"

0 commit comments

Comments
 (0)