From: Jason Ish Date: Thu, 1 Feb 2018 15:57:16 +0000 (-0600) Subject: check suricata-update directory for suricata binary X-Git-Tag: 1.0.0rc1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a01ac5b25e9be6832a35b146f0a66173daa4ce5;p=thirdparty%2Fsuricata-update.git check suricata-update directory for suricata binary 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. --- diff --git a/suricata/update/engine.py b/suricata/update/engine.py index 87694e3..17080d3 100644 --- a/suricata/update/engine.py +++ b/suricata/update/engine.py @@ -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