Skip to content

Commit c785d2b

Browse files
Merge pull request #108 from fledge-iot/FOGL-9980
FOGL-9980 plugin post installation script fixes specific to newer Debian 12+
2 parents 0bb3ab2 + 6cd995f commit c785d2b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

plugins/packages/DEBIAN/postinst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,23 @@ if [ -f /usr/local/fledge/python/extras_install___PLUGIN_NAME__.sh ]; then
4141
fi
4242
# Install Python pip dependencies; if any
4343
if [ -f /usr/local/fledge/__INSTALL_DIR__/requirements.txt ]; then
44-
python3 -m pip install -Ir /usr/local/fledge/__INSTALL_DIR__/requirements.txt
44+
45+
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
46+
PYTHON_MAJOR=$(printf "%s" "$PYTHON_VERSION" | cut -d. -f1)
47+
PYTHON_MINOR=$(printf "%s" "$PYTHON_VERSION" | cut -d. -f2)
48+
49+
FLAG=''
50+
51+
if [ "$PYTHON_MAJOR" -eq 3 ]; then
52+
if [ "$PYTHON_MINOR" -ge 11 ] && [ "$PYTHON_MINOR" -lt 12 ]; then
53+
FLAG='--break-system-packages'
54+
elif [ "$PYTHON_MINOR" -ge 12 ]; then
55+
FLAG='--ignore-installed --break-system-packages'
56+
else
57+
FLAG=''
58+
fi
59+
fi
60+
python3 -m pip install -Ir /usr/local/fledge/__INSTALL_DIR__/requirements.txt $FLAG
4561
fi
4662

4763
# For C based plugins

0 commit comments

Comments
 (0)