From: Jason Ish Date: Wed, 2 Oct 2019 20:53:15 +0000 (-0600) Subject: config: use datarootdir from build info for dist rules X-Git-Tag: 1.1.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da03dba524d8345534c8a64f042b3820b749a170;p=thirdparty%2Fsuricata-update.git config: use datarootdir from build info for dist rules When looking for Suricata provided rules, put the highest priority on the datarootdir from the build info. --- diff --git a/suricata/update/config.py b/suricata/update/config.py index 312f07e..0aafc96 100644 --- a/suricata/update/config.py +++ b/suricata/update/config.py @@ -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. diff --git a/suricata/update/engine.py b/suricata/update/engine.py index 1abd1f7..8d95129 100644 --- a/suricata/update/engine.py +++ b/suricata/update/engine.py @@ -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"):