]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
config: use datarootdir from build info for dist rules
authorJason Ish <jason.ish@oisf.net>
Wed, 2 Oct 2019 20:53:15 +0000 (14:53 -0600)
committerJason Ish <jason.ish@oisf.net>
Fri, 11 Oct 2019 15:17:04 +0000 (09:17 -0600)
When looking for Suricata provided rules, put the highest
priority on the datarootdir from the build info.

suricata/update/config.py
suricata/update/engine.py

index 312f07e19a7050b632858110ee8dd77184453457..0aafc96f2bba4d2a6b95c0ce3ae25fd816b66c74 100644 (file)
@@ -208,9 +208,15 @@ def init(args):
                 0, os.path.join(
                     build_info["sysconfdir"], "suricata/suricata.yaml"))
 
+        # Amend the path to look for Suricata provided rules based on
+        # the build info. As we are inserting at the front, put the
+        # highest priority path last.
         if "sysconfdir" in build_info:
             DEFAULT_DIST_RULE_PATH.insert(
                 0, os.path.join(build_info["sysconfdir"], "suricata/rules"))
+        if "datarootdir" in build_info:
+            DEFAULT_DIST_RULE_PATH.insert(
+                0, os.path.join(build_info["datarootdir"], "suricata/rules"))
 
         # Set the data-directory prefix to that of the --localstatedir
         # found in the build-info.
index 1abd1f7cf49a26919570c0f532f4bd7507f29566..8d9512930a38e40f0bbf2b2a95ac63baadae9f75 100644 (file)
@@ -47,6 +47,8 @@ def get_build_info(suricata):
             build_info["sysconfdir"] = line.split()[-1].strip()
         elif line.startswith("--localstatedir"):
             build_info["localstatedir"] = line.split()[-1].strip()
+        elif line.startswith("--datarootdir"):
+            build_info["datarootdir"] = line.split()[-1].strip()
         elif line.startswith("Features:"):
             build_info["features"] = line.split()[1:]
         elif line.startswith("This is Suricata version"):