fail2ban: replace fail2ban-python shebang with python3

In Yocto, there is only one Python interpreter (python3), and the
auto-generated "fail2ban-python" symlink is not used. To ensure
all installed scripts can run correctly, replace the shebang line
from "#!/usr/bin/env fail2ban-python" to "#!/usr/bin/env python3"
during installation.

Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com>
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
This commit is contained in:
Haixiao Yan
2025-10-24 19:09:54 +08:00
committed by Scott Murray
parent 2fb507fc9a
commit 4c8212c19f

View File

@@ -44,6 +44,7 @@ do_install:append () {
chown -R root:root ${D}/${bindir}
rm -rf ${D}/run
find ${D}${sysconfdir} -type f -exec sed -i '1s/env fail2ban-python/env python3/' {} +
}
do_install_ptest:append () {
@@ -61,6 +62,8 @@ do_install_ptest:append () {
install -m 0644 ${S}/README.md ${D}${PTEST_PATH}
sed -i -e 's|^logpath = README.md|logpath = ${PTEST_PATH}/README.md|g' \
${D}${PYTHON_SITEPACKAGES_DIR}/fail2ban/tests/config/jail.conf
find ${D}${PYTHON_SITEPACKAGES_DIR} -type f -exec sed -i \
'1s/env fail2ban-python/env python3/' {} +
}
INITSCRIPT_PACKAGES = "${PN}"