]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
bin/suricata-update: handle non-standard install prefixes.
authorJason Ish <ish@unx.ca>
Wed, 31 Jan 2018 22:31:37 +0000 (16:31 -0600)
committerJason Ish <ish@unx.ca>
Sun, 4 Feb 2018 13:26:02 +0000 (07:26 -0600)
Look to see if the modules are in a known location relative to
the location of suricata-update and to the sys.path if found.

Allows suricata-update to be installed with non-standard
--prefixes.

bin/suricata-update

index e8230cfb0fcc54b2388581cf64f401ef559ead7d..f2e85577380d43704c1124e409af5f5d1031e96a 100755 (executable)
 import sys
 import os
 
+exec_dir = os.path.dirname(__file__)
+version_info = sys.version_info
+pyver = "%d.%d" % (version_info.major, version_info.minor)
+site_path = "%s/../lib/python%s/site-packages" % (exec_dir, pyver)
+
+if os.path.exists("%s/suricata/update" % (site_path)):
+    sys.path.insert(0, site_path)
 sys.path.insert(
     0, os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))))