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 #--------------------------------------------------