From 3796d80263d48c5e4c7023f1e9440891d23e122a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mahmut=20H=C4=B1zal?= Date: Mon, 27 May 2024 23:54:19 +0300 Subject: [PATCH] Update odoo_install.sh --- odoo_install.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/odoo_install.sh b/odoo_install.sh index 52a7902..0fabbac 100644 --- a/odoo_install.sh +++ b/odoo_install.sh @@ -93,6 +93,28 @@ fi echo -e "\n---- Creating the ODOO PostgreSQL User ----" sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true +#-------------------------------------------------- +# Check Python version and install Python 3.10 if not present +#-------------------------------------------------- +echo -e "\n---- Checking for Python 3.10 installation ----" +PYTHON_VERSION=$(python3 -V 2>&1 | grep -Po '(?<=Python )(.+)') +if [[ -z "$PYTHON_VERSION" ]]; then + echo "Python 3 is not installed. Installing Python 3.10..." + sudo apt-get install -y software-properties-common + sudo add-apt-repository -y ppa:deadsnakes/ppa + sudo apt-get update + sudo apt-get install -y python3.10 +elif [[ $(printf '3.10\n%s' "$PYTHON_VERSION" | sort -V | head -n1) != "3.10" ]]; then + echo "Python 3.10 or greater is not installed. Upgrading to Python 3.10..." + sudo apt-get install -y software-properties-common + sudo add-apt-repository -y ppa:deadsnakes/ppa + sudo apt-get update + sudo apt-get install -y python3.10 +else + echo "Python 3.10 or greater is already installed." +fi + + #-------------------------------------------------- # Install Dependencies #--------------------------------------------------