mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
* fix: Add installer check for python version
Closes #7439
Closes #7437
Closes #7377
* fix error message
* Add color
(cherry picked from commit 960c27b142
)
Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
parent
d7c76aab9d
commit
f1dfced89b
@ -2,6 +2,8 @@
|
||||
#
|
||||
# packager.io postinstall script functions
|
||||
#
|
||||
Color_Off='\033[0m'
|
||||
On_Red='\033[41m'
|
||||
|
||||
function detect_docker() {
|
||||
if [ -n "$(grep docker </proc/1/cgroup)" ]; then
|
||||
@ -50,9 +52,19 @@ function detect_python() {
|
||||
echo "# Python environment already present"
|
||||
# Extract earliest python version initialised from /opt/inventree/env/lib
|
||||
SETUP_PYTHON=$(ls -1 ${APP_HOME}/env/bin/python* | sort | head -n 1)
|
||||
echo "# Found earliest version: ${SETUP_PYTHON}"
|
||||
echo "# Found earlier used version: ${SETUP_PYTHON}"
|
||||
else
|
||||
echo "# No python environment found - using ${SETUP_PYTHON}"
|
||||
echo "# No python environment found - using environment variable: ${SETUP_PYTHON}"
|
||||
fi
|
||||
|
||||
# Ensure python can be executed - abort if not
|
||||
if [ -z "$(which ${SETUP_PYTHON})" ]; then
|
||||
echo "${On_Red}"
|
||||
echo "# Python ${SETUP_PYTHON} not found - aborting!"
|
||||
echo "# Please ensure python can be executed with the command '$SETUP_PYTHON' by the current user '$USER'."
|
||||
echo "# If you are using a different python version, please set the environment variable SETUP_PYTHON to the correct command - eg. 'python3.10'."
|
||||
echo "${Color_Off}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user