diff mbox series

[yocto-patches,meta-security] aide: fix pkg_postinst_ontarget shell script

Message ID 20260428091942.3915623-1-haitao.liu@windriver.com
State New
Headers show
Series [yocto-patches,meta-security] aide: fix pkg_postinst_ontarget shell script | expand

Commit Message

Haitao Liu April 28, 2026, 9:19 a.m. UTC
- Fix conditional checks for AIDE_SCAN_POSTINIT and AIDE_RESCAN_POSTINIT:
    '[ 0 ]' always evaluates to true since it's a non-empty string.
    Use string comparison '= "1"' instead.
  - Fix invalid use of '&&' inside '[ ]' test brackets. Use separate
    test expressions joined by shell '&&'.

Signed-off-by: Haitao Liu <haitao.liu@windriver.com>
---
 recipes-ids/aide/aide_0.18.8.bb | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/recipes-ids/aide/aide_0.18.8.bb b/recipes-ids/aide/aide_0.18.8.bb
index 2912cb2..7d1c05a 100644
--- a/recipes-ids/aide/aide_0.18.8.bb
+++ b/recipes-ids/aide/aide_0.18.8.bb
@@ -63,12 +63,13 @@  CONF_FILE = "${sysconfdir}/aide.conf"
 FILES:${PN} += "${libdir}/${PN} ${sysconfdir}/aide.conf"
 
 pkg_postinst_ontarget:${PN} () {
-    if [ ${AIDE_SCAN_POSTINIT} ]; then
-        ${bindir}/aide -i
-    fi
-    if [ ${AIDE_RESCAN_POSTINIT}  && -e ${libdir}/aide/aide.db.gz ]; then
-        ${bindir}/aide -C
-    fi
+    if [ "${AIDE_SCAN_POSTINIT}" = "1" ]; then
+          ${bindir}/aide -i
+      fi
+      if [ "${AIDE_RESCAN_POSTINIT}" = "1" ] && [ -e ${libdir}/aide/aide.db.gz ]; then
+          ${bindir}/aide -C
+      fi
+
 }
 
 RDEPENDS:${PN} = "bison libpcre"