Skip to content

Commit 6a66a86

Browse files
committed
plugin post installation script fixes specific to newer Debian-based systems like Ubuntu 24.04 and Debian 12+
Signed-off-by: ashish-jabble <[email protected]>
1 parent 0bb3ab2 commit 6a66a86

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

plugins/packages/DEBIAN/postinst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,21 @@ 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+
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
45+
PYTHON_MAJOR=$(echo "$PYTHON_VERSION" | cut -d. -f1)
46+
PYTHON_MINOR=$(echo "$PYTHON_VERSION" | cut -d. -f2)
47+
48+
if [ "$PYTHON_MAJOR" -eq 3 ]; then
49+
if [ "$PYTHON_MINOR" -ge 11 ] && [ "$PYTHON_MINOR" -lt 12 ]; then
50+
FLAG="--break-system-packages"
51+
elif [ "$PYTHON_MINOR" -ge 12 ]; then
52+
FLAG="--ignore-installed --break-system-packages"
53+
else
54+
# Default to empty flag
55+
FLAG=""
56+
fi
57+
fi
58+
python3 -m pip install -Ir /usr/local/fledge/__INSTALL_DIR__/requirements.txt $FLAG
4559
fi
4660

4761
# For C based plugins

0 commit comments

Comments
 (0)