From bfb2b0eea854ac5039ba9241acd0bf978826dd55 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 21 Dec 2022 00:25:29 -0500 Subject: [PATCH] [UPD] support ubuntu 22.04 --- script/install_debian_dependency.sh | 113 +++++++++++++++++++++++----- script/install_dev.sh | 6 +- script/install_locally.sh | 3 + 3 files changed, 100 insertions(+), 22 deletions(-) diff --git a/script/install_debian_dependency.sh b/script/install_debian_dependency.sh index 2dd5eda..0eb100d 100755 --- a/script/install_debian_dependency.sh +++ b/script/install_debian_dependency.sh @@ -14,10 +14,14 @@ EL_USER=${USER} UBUNTU_VERSION=$(lsb_release -rs) if [ "20.04" == "${UBUNTU_VERSION}" ]; then WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb +elif [ "22.04" == "${UBUNTU_VERSION}" ]; then + WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb elif [ "18.04" == "${UBUNTU_VERSION}" ]; then WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb else - WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb + # TODO support debian + echo "Your version of Ubuntu is not supported, only support 18.04, 20.04 and 22.04" + exit 1 fi #-------------------------------------------------- @@ -25,49 +29,114 @@ fi #-------------------------------------------------- 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 +if [ "18.04" == "${UBUNTU_VERSION}" ]; then + # 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 +fi #-------------------------------------------------- # Install PostgreSQL Server #-------------------------------------------------- echo -e "\n---- Install PostgreSQL Server ----" sudo apt-get install postgresql libpq-dev postgis -y +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "apt-get install postgresql installation error." + exit 1 +fi echo -e "\n---- Creating the ERPLibre PostgreSQL User ----" -sudo su - postgres -c "createuser -s ${EL_USER}" 2> /dev/null || true +sudo su - postgres -c "createuser -s ${EL_USER}" 2>/dev/null || true #-------------------------------------------------- # Install Dependencies #-------------------------------------------------- echo -e "\n--- Installing debian dependency --" -sudo apt-get install git build-essential wget libxslt-dev libzip-dev libldap2-dev libsasl2-dev libpng12-0 gdebi-core libffi-dev libbz2-dev parallel -y +sudo apt-get install git build-essential wget libxslt-dev libzip-dev libldap2-dev libsasl2-dev gdebi-core libffi-dev libbz2-dev parallel -y +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "apt-get debian tool installation error." + exit 1 +fi sudo apt-get install libmariadbd-dev -y +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "apt-get libmariadb installation error." + exit 1 +fi +if [ "18.04" == "${UBUNTU_VERSION}" ]; then + sudo apt-get install libpng12-0 -y + retVal=$? + if [[ $retVal -ne 0 ]]; then + echo "apt-get libpng installation error." + exit 1 + fi +fi # Dependencies for pyenv sudo apt-get install make libssl-dev zlib1g-dev libreadline-dev libsqlite3-dev curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev liblzma-dev -y +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "apt-get pyenv dependencies installation error." + exit 1 +fi echo -e "\n---- Installing nodeJS NPM and rtlcss for LTR support ----" curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - sudo apt-get install -y nodejs +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "apt-get nodejs installation error." + exit 1 +fi sudo npm install npm@latest -g +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "npm install npm lastest installation error." + exit 1 +fi sudo npm install -g rtlcss +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "npm install rtlcss installation error." + exit 1 +fi sudo npm install -g less +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "npm install less installation error." + exit 1 +fi echo -e "\n---- Test tool ----" sudo npm install -g prettier +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "npm install prettier installation error." + exit 1 +fi sudo npm install -g prettier @prettier/plugin-xml +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "npm install prettier plugin-xml installation error." + exit 1 +fi sudo ln -fs /usr/local/bin/lessc /usr/bin/lessc if [ ${EL_INSTALL_NGINX} = "True" ]; then echo -e "\n---- Installing nginx ----" sudo apt install nginx -y + retVal=$? + if [[ $retVal -ne 0 ]]; then + echo "apt install nginx installation error." + exit 1 + fi fi #-------------------------------------------------- @@ -75,15 +144,21 @@ fi #-------------------------------------------------- if [ ${EL_INSTALL_WKHTMLTOPDF} = "True" ]; then echo -e "\n---- Installing wkhtml ----" - INSTALLED=$(dpkg -s wkhtmltox|grep installed) + INSTALLED=$(dpkg -s wkhtmltox | grep installed) if [ "" == "${INSTALLED}" ]; then - echo -e "\n---- Install wkhtml and place shortcuts on correct place ----" - _url=${WKHTMLTOX_X64} - 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 ----" + echo -e "\n---- Install wkhtml and place shortcuts on correct place ----" + _url=${WKHTMLTOX_X64} + sudo wget ${_url} + sudo gdebi --n $(basename ${_url}) + retVal=$? + if [[ $retVal -ne 0 ]]; then + echo "gdebi install wkhtmltopdf installation error." + exit 1 + fi + sudo ln -fs /usr/local/bin/wkhtmltopdf /usr/bin + sudo ln -fs /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!" diff --git a/script/install_dev.sh b/script/install_dev.sh index 22f0135..4c54048 100755 --- a/script/install_dev.sh +++ b/script/install_dev.sh @@ -4,14 +4,14 @@ if [[ "${OSTYPE}" == "linux-gnu" ]]; then OS=$(lsb_release -si) VERSION=$(cat /etc/issue) if [[ "${OS}" == "Ubuntu" ]]; then - if [[ "${VERSION}" == Ubuntu\ 18.04* || "${VERSION}" == Ubuntu\ 20.04* ]]; then + if [[ "${VERSION}" == Ubuntu\ 18.04* || "${VERSION}" == Ubuntu\ 20.04* || "${VERSION}" == Ubuntu\ 22.04* ]]; then echo "\n---- linux-gnu installation process started ----" ./script/install_debian_dependency.sh else - echo "Your version is not supported, only support 18.04 and 20.04 : ${VERSION}" + echo "Your version is not supported, only support 18.04, 20.04 and 22.04 : ${VERSION}" fi else - echo "Your Linux system is not supported, only support Ubuntu 18.04 or Ubuntu 20.04." + echo "Your Linux system is not supported, only support Ubuntu 18.04 or Ubuntu 20.04 or Ubuntu 22.04." fi elif [[ "${OSTYPE}" == "darwin"* ]]; then echo "\n---- Darwin installation process started ----" diff --git a/script/install_locally.sh b/script/install_locally.sh index 7b85aa5..d63b8da 100755 --- a/script/install_locally.sh +++ b/script/install_locally.sh @@ -128,6 +128,9 @@ if [[ ! -f "${POETRY_PATH}" ]]; then ${VENV_PATH}/bin/pip install vatnumber ${VENV_PATH}/bin/pip install suds-jurko fi +${VENV_PATH}/bin/pip install vatnumber +${VENV_PATH}/bin/pip install suds-jurko + # Delete artifacts created by pip, cause error in next "poetry install" rm -rf artifacts