]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
setup-app-layer.py: attempt to cd into correct directory
authorJason Ish <ish@unx.ca>
Wed, 19 Sep 2018 05:01:08 +0000 (23:01 -0600)
committerVictor Julien <victor@inliniac.net>
Wed, 19 Sep 2018 19:00:51 +0000 (21:00 +0200)
- If in src, cd to ..
- Error out early if the current directory does not look like a
  Suricata source directory.

scripts/setup-app-layer.py

index eb1e601a722f4a02041eff3583a69ad56ab720b5..f20b4d98840daa2c6fe0d88553179ea22b5e63b6 100755 (executable)
@@ -341,6 +341,13 @@ def main():
         parser = args.parser
         logger = args.logger
 
+    # Make sure we are in the correct directory.
+    if os.path.exists("./suricata.c"):
+        os.chdir("..")
+    elif not os.path.exists("./src/suricata.c"):
+        raise SetupError(
+            "this does not appear to be a Suricata source directory.")
+
     if parser:
         if proto_exists(proto):
             raise SetupError("protocol already exists: %s" % (proto))