Skip to content

Commit 6720ff2

Browse files
committed
Simplify installation on debian-like systems, make python2 support optional
1 parent 57d26a8 commit 6720ff2

File tree

4 files changed

+43
-13
lines changed

4 files changed

+43
-13
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
In previous version latest stable version was installed by default.
2020
- [openupgradelib](https://github.com/OCA/openupgradelib) now will be downloaded from pypi.
2121
It seems that now relevant versions of this lib are published on pypi
22+
- Simplify installation for debian-like systems: automatically install preprequirements
23+
- Python2 support is not installed only for Odoo 10.0 and below.
2224

2325

2426
## Release 0.12.1 (2021-10-25)

install-system.bash

+19-6
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ set -e; # Fail on each error
3030

3131
# Install git if not installed yet
3232
if ! command -v git >/dev/null 2>&1 || ! command -v wget >/dev/null 2>&1; then
33-
echo -e "${BLUEC}INFO${NC}: Installing minimal system dependencies...${NC}";
34-
apt-get install -yqq --no-install-recommends git wget;
33+
if [ -e "/etc/debian_version" ]; then
34+
echo -e "${BLUEC}INFO${NC}: Installing minimal system dependencies...${NC}";
35+
apt-get install -yqq --no-install-recommends git wget;
36+
else
37+
echo -e "${REDC}ERROR${NC}: Please, install wget and git to be able to install odoo-helper-scripts!"
38+
exit 2;
39+
fi
3540
fi
3641

3742
# define vars
@@ -73,13 +78,21 @@ for oh_cmd in $ODOO_HELPER_BIN/*; do
7378
fi
7479
done
7580

81+
82+
if [ -e "/etc/debian_version" ]; then
83+
odoo-helper install pre-requirements;
84+
ODOO_HELPER_PRE_REQUIREMENTS_INSTALLED=1;
85+
fi
86+
7687
echo -e "${YELLOWC}odoo-helper-scripts${GREENC} seems to be successfully installed system-wide!${NC}";
7788
echo -e "Install path is ${YELLOWC}${INSTALL_PATH}${NC}";
7889
echo;
79-
echo -e "${YELLOWC}NOTE${NC}: Do not forget to install odoo-helper system dependencies.";
80-
echo -e "To do this for debian-like systems run following command (${YELLOWC}sudo access required${NC}):";
81-
echo -e " $ ${BLUEC}odoo-helper install pre-requirements${NC}";
82-
echo;
90+
if [ -z "$ODOO_HELPER_PRE_REQUIREMENTS_INSTALLED" ]; then
91+
echo -e "${YELLOWC}NOTE${NC}: Do not forget to install odoo-helper system dependencies.";
92+
echo -e "To do this for debian-like systems run following command (${YELLOWC}sudo access required${NC}):";
93+
echo -e " $ ${BLUEC}odoo-helper install pre-requirements${NC}";
94+
echo;
95+
fi
8396
echo -e "${YELLOWC}NOTE2${NC}: Do not forget to install and configure postgresql.";
8497
echo -e "To do this for debian-like systems run following command (${YELLOWC}sudo access required${NC}):";
8598
echo -e " $ ${BLUEC}odoo-helper install postgres${NC}";

lib/install.bash

+20-7
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ function install_wkhtmltopdf {
213213
read -ra wkhtmltox_deps < <(dpkg -f "$wkhtmltox_path" Depends | sed -r 's/,//g');
214214
if ! (install_sys_deps_internal "${wkhtmltox_deps[@]}" && with_sudo dpkg -i "$wkhtmltox_path"); then
215215
echoe -e "${REDC}ERROR:${NC} Error caught while installing ${BLUEC}wkhtmltopdf${NC}.";
216+
rm "$wkhtmltox_path" || true; # try to remove downloaded file, ignore errors
217+
return 2;
216218
fi
217219

218220
rm "$wkhtmltox_path" || true; # try to remove downloaded file, ignore errors
@@ -402,6 +404,12 @@ function install_sys_deps_for_odoo_version {
402404
return 1;
403405
fi
404406

407+
local odoo_major_version="${odoo_version%.*}";
408+
if [ "$odoo_major_version" -lt 11 ]; then
409+
# We have to install python2 support for odoo versions less than 11.0
410+
install_python2_support;
411+
fi
412+
405413
odoo_branch=${odoo_branch:-$odoo_version};
406414
local control_url="https://raw.githubusercontent.com/odoo/odoo/$odoo_branch/debian/control";
407415
local tmp_control;
@@ -588,6 +596,17 @@ function install_and_configure_postgresql {
588596
}
589597

590598

599+
function install_python2_support {
600+
echo -e "${BLUEC}Installing python2 dependencies (to support odoo 10 and below)...${NC}";
601+
if ! install_sys_deps_internal python2-dev python2-pip-whl; then
602+
echo -e "${YELLOWC}WARNING${NC}: It seems that it is too old version of OS, trying old version of python2 support...";
603+
if ! install_sys_deps_internal python-dev; then
604+
echo -e "${YELLOWC}WARNING${NC}: Cannot install python2 support... skipping...";
605+
fi
606+
fi
607+
}
608+
609+
591610
# install_system_prerequirements
592611
function install_system_prerequirements {
593612
local usage="
@@ -634,15 +653,9 @@ function install_system_prerequirements {
634653
libsasl2-dev libldap2-dev libssl-dev libffi-dev fontconfig \
635654
libmagic1 python3-virtualenv;
636655

637-
echo -e "${BLUEC}Installing python2 dependencies (to support odoo 10 and below)...${NC}";
638-
if ! install_sys_deps_internal python2-dev python2-pip-whl; then
639-
echo -e "${YELLOWC}WARNING${NC}: It seems that it is too old version of OS, trying old version of python2 support...";
640-
if ! install_sys_deps_internal python-dev; then
641-
echo -e "${YELLOWC}WARNING${NC}: Cannot install python2 support... skipping...";
642-
fi
643-
fi
644656
if ! install_wkhtmltopdf; then
645657
echoe -e "${YELLOWC}WARNING:${NC} Cannot install ${BLUEC}wkhtmltopdf${NC}!!! Skipping...";
658+
echoe -e "${LBLUEC}HINT:${NC} If your system has wkhtmltopdf>=0.12.5 then try to install system package.";
646659
fi
647660
}
648661

lib/system.bash

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ function system_update_odoo_helper_scripts {
6464
fi
6565
fi
6666
done
67+
68+
echoe -e "${LBLUEC}HINT${NC}: Update pre-requirements to ensure all system dependencies are installed.";
6769
cd "$cdir";
6870
}
6971

0 commit comments

Comments
 (0)