erplibre/script/install_debian_dependancy.sh
Mathieu Benoit 2888cbf890 [ADD] poetry support
- Auto regenerate poetry pyproject.toml from all requirements.txt with
script poetry_update.py
- Sort dependancy in pyproject.toml
- Rename directory venv to .venv
- In bash, use USER instead of whoami
- Remove python3 from ubuntu dependancy. Ignore python from system.
- Use pyenv with poetry
- Simplify pip installation script
2020-09-30 20:51:57 -04:00

96 lines
3.5 KiB
Bash
Executable file

#!/usr/bin/env bash
. ./env_var.sh
EL_USER=${USER}
#EL_INSTALL_WKHTMLTOPDF="True"
##
### WKHTMLTOPDF download links
## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links,
## in order to have correct version of wkhtmltopdf installed, for a danger note refer to
## https://github.com/odoo/odoo/wiki/Wkhtmltopdf ):
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb
WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_i386.deb
#--------------------------------------------------
# Update Server
#--------------------------------------------------
echo -e "\n---- Update Server ----"
# add-apt-repository can install add-apt-repository Ubuntu 18.x
sudo apt-get install software-properties-common curl -y
# universe package is for Ubuntu 18.x
sudo add-apt-repository universe
# libpng12-0 dependency for wkhtmltopdf
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ xenial main"
sudo apt-get update
sudo apt-get upgrade -y
#--------------------------------------------------
# Install PostgreSQL Server
#--------------------------------------------------
echo -e "\n---- Install PostgreSQL Server ----"
sudo apt-get install postgresql libpq-dev -y
echo -e "\n---- Creating the ERPLibre PostgreSQL User ----"
sudo su - postgres -c "createuser -s ${EL_USER}" 2> /dev/null || true
#--------------------------------------------------
# Install Dependencies
#--------------------------------------------------
echo -e "\n--- Installing debian dependancy --"
sudo apt-get install git build-essential wget libxslt-dev libzip-dev libldap2-dev libsasl2-dev node-less libpng12-0 gdebi-core libffi-dev -y
sudo apt-get install libmariadbd-dev -y
echo -e "\n---- Installing nodeJS NPM and rtlcss for LTR support ----"
sudo apt-get install nodejs npm -y
sudo npm install -g rtlcss
sudo npm install -g lessc
if [ ${EL_INSTALL_NGINX} = "True" ]; then
echo -e "\n---- Installing nginx ----"
sudo apt install nginx -y
fi
echo -e "\n---- Installing python 3.7.7 with pyenv ----"
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
export PATH="/home/${USER}/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
yes n|pyenv install 3.7.7
pyenv local 3.7.7
python_exec="$(pyenv root)/versions/3.7.7/bin/python"
echo -e "\n---- Installing poetry for reliable python package ----"
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | ${python_exec}
#/home/"${USER}"/.poetry/bin/poetry env use ${python_exec}
#source $HOME/.poetry/env
#--------------------------------------------------
# Install Wkhtmltopdf if needed
#--------------------------------------------------
if [ ${EL_INSTALL_WKHTMLTOPDF} = "True" ]; then
echo -e "\n---- Installing wkhtml ----"
INSTALLED=$(dpkg -s wkhtmltox|grep installed)
if [ "" == "${INSTALLED}" ]; then
echo -e "\n---- Install wkhtml and place shortcuts on correct place ----"
#pick up correct one from x64 & x32 versions:
if [ "`getconf LONG_BIT`" == "64" ];then
_url=${WKHTMLTOX_X64}
else
_url=${WKHTMLTOX_X32}
fi
sudo wget ${_url}
sudo gdebi --n `basename ${_url}`
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
else echo -e "\n---- Already installed wkhtml ----"
fi
else
echo "Wkhtmltopdf isn't installed due to the choice of the user!"
fi