[meta-security][wrynose][PATCH 12/13] aide: fix pkg_postinst_ontarget shell script

Scott Murray <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <18c343e92eb815c9ce0d7401c9d48c70baef7aaa.1779625557.git.scott.murray@konsulko.com>
From: "jason.lau" <[email protected]>

- 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 <[email protected]>
(reworked for 0.19.3, fixed indentation)
Signed-off-by: Scott Murray <[email protected]>
---
 recipes-ids/aide/aide_0.19.3.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/recipes-ids/aide/aide_0.19.3.bb b/recipes-ids/aide/aide_0.19.3.bb
index 9a94ce2..68e3bfa 100644
--- a/recipes-ids/aide/aide_0.19.3.bb
+++ b/recipes-ids/aide/aide_0.19.3.bb
@@ -62,10 +62,10 @@ CONF_FILE = "${sysconfdir}/aide.conf"
 FILES:${PN} += "${libdir}/${PN} ${sysconfdir}/aide.conf"
 
 pkg_postinst_ontarget:${PN} () {
-    if [ ${AIDE_SCAN_POSTINIT} ]; then
+    if [ "${AIDE_SCAN_POSTINIT}" = "1" ]; then
         ${bindir}/aide -i
     fi
-    if [ ${AIDE_RESCAN_POSTINIT}  && -e ${libdir}/aide/aide.db.gz ]; then
+    if [ "${AIDE_RESCAN_POSTINIT}" = "1" ] && [ -e ${libdir}/aide/aide.db.gz ]; then
         ${bindir}/aide -C
     fi
 }
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.