]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
check suricata-update directory for suricata binary
authorJason Ish <ish@unx.ca>
Thu, 1 Feb 2018 15:57:16 +0000 (09:57 -0600)
committerJason Ish <ish@unx.ca>
Sun, 4 Feb 2018 13:26:02 +0000 (07:26 -0600)
And use those one before looking in the path. Handles the case
when when bundled and --prefix is used to install into an
alternate location.

suricata/update/engine.py

index 87694e3f06541c1a03d11fe37238a2f595d3cda6..17080d3512567cb80fe7c948aad6767d87407246 100644 (file)
@@ -20,6 +20,7 @@
 
 from __future__ import print_function
 
+import sys
 import os
 import os.path
 import subprocess
@@ -80,6 +81,13 @@ class Configuration:
 
 def get_path(program="suricata"):
     """Find Suricata in the shell path."""
+    # First look for Suricata relative to suricata-update.
+    relative_path = os.path.join(os.path.dirname(sys.argv[0]), "suricata")
+    if os.path.exists(relative_path):
+        logger.debug("Found suricata at %s" % (relative_path))
+        return relative_path
+
+    # Otherwise look for it in the path.
     for path in os.environ["PATH"].split(os.pathsep):
         if not path:
             continue