From 15922dcd8cd26470ff20fa31a7c69b8676add295 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Tue, 18 Sep 2018 23:01:08 -0600 Subject: [PATCH] setup-app-layer.py: attempt to cd into correct directory - 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/setup-app-layer.py b/scripts/setup-app-layer.py index eb1e601a72..f20b4d9884 100755 --- a/scripts/setup-app-layer.py +++ b/scripts/setup-app-layer.py @@ -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))