Skip to content

Commit

Permalink
Add a make install command on Linux (fixes #13).
Browse files Browse the repository at this point in the history
  • Loading branch information
JusticeRage committed Mar 10, 2017
1 parent 0cfe2b0 commit bc65168
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
26 changes: 25 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,28 @@ target_link_libraries(
${Boost_LIBRARIES}
)


# make install command for linux machines:
if ("${CMAKE_SYSTEM}" MATCHES "Linux")

# Copy binaries
install(TARGETS manalyze manacommons manape
RUNTIME DESTINATION /usr/local/bin
LIBRARY DESTINATION /usr/local/lib
ARCHIVE DESTINATION /usr/local/lib/static)

# Copy the yara_rules folder to /etc/manalyze.
install(DIRECTORY bin/yara_rules
DESTINATION /etc/manalyze)

# Copy the plugins to /etc/manalyze.
install(DIRECTORY bin/
DESTINATION /etc/manalyze
FILES_MATCHING PATTERN "libplugin_*.so")

# Copy the configuration file template.
install(FILES bin/manalyze.conf
DESTINATION /etc/manalyze)

# Run ldconfig.
execute_process(COMMAND ldconfig)
endif()
9 changes: 9 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,15 @@ int main(int argc, char** argv)
// Load the dynamic plugins.
bfs::path working_dir(argv[0]);
working_dir = working_dir.parent_path();

// Linux: look for the configuration file in /etc/manalyze if
// nothing is found in the current folder.
#ifdef BOOST_POSIX_API
if (!bfs::exists(working_dir / "manalyze.conf")) {
working_dir = "/etc/manalyze";
}
#endif

plugin::PluginManager::get_instance().load_all(working_dir.string());

// Load the configuration
Expand Down

0 comments on commit bc65168

Please sign in to comment.