From: Jonathan McDowell Date: Tue, 26 Jun 2018 13:20:11 +0000 (+0100) Subject: Set default paths to Lua includes and Snort config (#51) X-Git-Tag: 3.0.0-246~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06dbdd4e20a7ab68b43e3d6638c415b5f85a6e00;p=thirdparty%2Fsnort3.git Set default paths to Lua includes and Snort config (#51) For most installs LUA_PATH and SNORT_LUA_PATH are known at build time; they are the directories that we have configured the appropriate files to be installed in. Set these as defaults in the installed snort.lua config file. The environment variables will take precedence if set. --- diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt index ea75ed52f..1a9fabd57 100644 --- a/lua/CMakeLists.txt +++ b/lua/CMakeLists.txt @@ -1,10 +1,12 @@ set (LUA_SCRIPTS file_magic.lua - snort.lua snort_defaults.lua ) -install (FILES ${LUA_SCRIPTS} +configure_file(snort.lua.in + snort.lua) + +install (FILES ${LUA_SCRIPTS} ${CMAKE_CURRENT_BINARY_DIR}/snort.lua DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/snort" ) diff --git a/lua/snort.lua b/lua/snort.lua.in similarity index 97% rename from lua/snort.lua rename to lua/snort.lua.in index 2c4af5368..36f2c358d 100644 --- a/lua/snort.lua +++ b/lua/snort.lua.in @@ -28,6 +28,11 @@ -- export LUA_PATH=$DIR/include/snort/lua/?.lua\;\; -- export SNORT_LUA_PATH=$DIR/etc/snort +lua_path = os.getenv('LUA_PATH') +if ( not lua_path ) then + package.path = '${CMAKE_INSTALL_FULL_INCLUDEDIR}/${INSTALL_SUFFIX}/lua/?.lua;?;' +end + -- this depends on LUA_PATH -- used to load this conf into Snort require('snort_config') @@ -37,7 +42,7 @@ require('snort_config') conf_dir = os.getenv('SNORT_LUA_PATH') if ( not conf_dir ) then - conf_dir = '.' + conf_dir = '${CMAKE_INSTALL_FULL_SYSCONFDIR}/snort' end ---------------------------------------------------------------------------