[ADD] install_script: auto detection of wkhtmltopdf version

19.0
Christian Fernández 1 day ago committed by GitHub
parent ff38f9f870
commit 4b2bdceba0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,4 +1,5 @@
# [Odoo](https://www.odoo.com "Odoo's Homepage") Install Script # [Odoo](https://www.odoo.com "Odoo's Homepage") Install Script X86 X32 ARM
# Arch detection + wkhtmltopdf via Ubuntu repos (arm64/amd64/i386)
This script is based on the install script from André Schenkels (https://github.com/aschenkels-ictstudio/openerp-install-scripts) This script is based on the install script from André Schenkels (https://github.com/aschenkels-ictstudio/openerp-install-scripts)
but goes a bit further and has been improved. This script will also give you the ability to define an xmlrpc_port in the .conf file that is generated under /etc/ but goes a bit further and has been improved. This script will also give you the ability to define an xmlrpc_port in the .conf file that is generated under /etc/

@ -54,22 +54,45 @@ pip_install() {
fi fi
} }
## ##
### WKHTMLTOPDF download links
## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links, ## ### WKHTMLTOPDF download & arch detection (x86/x86_64/ARM) ##
## in order to have correct version of wkhtmltopdf installed, for a danger note refer to # Installed from the Ubuntu 24.04 repositories
## https://github.com/odoo/odoo/wiki/Wkhtmltopdf ):
## https://www.odoo.com/documentation/19.0/administration/install.html detect_arch() {
local arch_raw
# Check if the operating system is Ubuntu 24.04 arch_raw="$(dpkg --print-architecture 2>/dev/null || uname -m)"
if [[ $(lsb_release -r -s) == "24.04" ]]; then
WKHTMLTOX_X64="https://packages.ubuntu.com/jammy/wkhtmltopdf" case "$arch_raw" in
WKHTMLTOX_X32="https://packages.ubuntu.com/jammy/wkhtmltopdf" amd64|x86_64) ARCH_DEB="amd64";;
#No Same link works for both 64 and 32-bit on Ubuntu 24.04 i386|i686) ARCH_DEB="i386";;
else arm64|aarch64) ARCH_DEB="arm64";;
# For older versions of Ubuntu armhf|armv7l) ARCH_DEB="armhf";;
WKHTMLTOX_X64="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb" *) ARCH_DEB="$arch_raw";;
WKHTMLTOX_X32="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_i386.deb" esac
fi
UBUNTU_CODENAME="$(lsb_release -c -s 2>/dev/null || echo noble)"
UBUNTU_RELEASE="$(lsb_release -r -s 2>/dev/null || echo 24.04)"
}
install_wkhtmltopdf_from_ubuntu() {
sudo apt-get update -y
if sudo apt-get install -y wkhtmltopdf; then
echo "wkhtmltopdf installed from Ubuntu repositories ($ARCH_DEB)."
return 0
fi
return 1
wkhtml_create_symlinks_if_needed() {
# symlinks
if [ -x /usr/local/bin/wkhtmltopdf ] && ! command -v wkhtmltopdf >/dev/null 2>&1; then
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin || true
fi
if [ -x /usr/local/bin/wkhtmltoimage ] && ! command -v wkhtmltoimage >/dev/null 2>&1; then
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin || true
fi
}
detect_arch
#-------------------------------------------------- #--------------------------------------------------
# Update Server # Update Server
@ -110,7 +133,6 @@ else
sudo apt-get install postgresql postgresql-server-dev-all -y sudo apt-get install postgresql postgresql-server-dev-all -y
fi fi
echo -e "\n---- Creating the ODOO PostgreSQL User ----" echo -e "\n---- Creating the ODOO PostgreSQL User ----"
sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true
@ -135,28 +157,24 @@ sudo npm install -g rtlcss
# Install Wkhtmltopdf if needed # Install Wkhtmltopdf if needed
#-------------------------------------------------- #--------------------------------------------------
if [ "$INSTALL_WKHTMLTOPDF" = "True" ]; then if [ "$INSTALL_WKHTMLTOPDF" = "True" ]; then
echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 13 ----" echo -e "\n---- Installing wkhtmltopdf (architecture detected: $ARCH_DEB) ----"
#pick up correct one from x64 & x32 versions:
if [ "`getconf LONG_BIT`" == "64" ];then if install_wkhtmltopdf_from_ubuntu; then
_url=$WKHTMLTOX_X64 :
else else
_url=$WKHTMLTOX_X32 echo -e "\n---- Could not install from the Ubuntu repositories ----."
fi fi
sudo wget $_url
echo -e "\n---- Ensure that the links are in /usr/local/bin ----"
wkhtml_create_symlinks_if_needed
if [[ $(lsb_release -r -s) == "24.04" ]]; then if command -v wkhtmltopdf >/dev/null 2>&1; then
# Ubuntu 24.04 LTS echo -e "\n---- wkhtmltopdf available at: $(command -v wkhtmltopdf) ----"
sudo apt install wkhtmltopdf -y
else else
# For older versions of Ubuntu echo -e "\n----- WARNING: wkhtmltopdf was not installed. You can install it manually later ----"
sudo gdebi --n `basename $_url`
fi fi
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
else else
echo "Wkhtmltopdf isn't installed due to the choice of the user!" echo -e "\n---- Wkhtmltopdf will not be installed at the user's choice ----"
fi fi
echo -e "\n---- Create ODOO system user ----" echo -e "\n---- Create ODOO system user ----"

Loading…
Cancel
Save