Commit 2f143d9e authored by Antenore Gatta's avatar Antenore Gatta

Adding buildhost

parent a71054dc
......@@ -61,6 +61,9 @@ if(NOT BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
cmake_host_system_information (RESULT REMMINA_BUILD_HOST QUERY HOSTNAME)
message(STATUS "Remmina is being built on ${REMMINA_BUILD_HOST}")
if(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
CHECK_SYMBOL_EXISTS(__x86_64__ "" IS_X86_64)
......
......@@ -26,5 +26,6 @@
#define REMMINA_RUNTIME_THEMEDIR "${REMMINA_RUNTIME_THEMEDIR}"
#define REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR "${REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR}"
#define REMMINA_RUNTIME_TERM_CS_DIR "${REMMINA_TERM_CS_DIR}"
#define REMMINA_BUILD_HOST "${REMMINA_BUILD_HOST}"
#endif
......@@ -775,6 +775,57 @@ JsonNode *remmina_stats_get_secret_plugin()
return r;
}
/**
* Add a json member BUILDHOST that will be used to determine how Remmina has been
* installed (locally compiled, PPA, copr, … , ).
*
* When the BUILDHOST is the same as the local hostname, we can safely store "local_build" as
* we don't need and want to store the user hostname.
*
* When the two differ, we store the build hostname, that will be parsed and compared
* with the other known build hosts. The goal is only to catch if the running Remmina
* has beeen built on known system. Later we will tune this to be much less intrusive.
*
* @return a Json Node structure containg the string "local_build" or the build hostname
*
*/
JsonNode *remmina_stats_get_build_host()
{
TRACE_CALL(__func__);
JsonBuilder *b;
JsonNode *r;
char host[HOST_NAME_MAX + 1];
gchar *build_host;
if (gethostname(host, sizeof(host)) < 0) {
g_debug("Hostname is: %s", host);
strcpy (host, "NOHOST");
}
g_debug("Hostname is: %s", host);
g_debug("REMMINA_BUILD_HOST is: %s", REMMINA_BUILD_HOST);
if (g_strcmp0 (REMMINA_BUILD_HOST, host) == 0) {
build_host = "local_build";
} else {
build_host = REMMINA_BUILD_HOST;
}
g_debug("build_host: %s", build_host);
b = json_builder_new();
json_builder_begin_object(b);
json_builder_set_member_name(b, "build_host");
json_builder_add_string_value(b, build_host);
json_builder_end_object(b);
r = json_builder_get_root(b);
g_object_unref(b);
return r;
}
/**
* Get all statistics in json format to send periodically to the PHP server.
......@@ -839,6 +890,10 @@ JsonNode *remmina_stats_get_all()
json_builder_set_member_name(b, "ACTIVESECRETPLUGIN");
json_builder_add_value(b, n);
n = remmina_stats_get_build_host();
json_builder_set_member_name(b, "BUILDHOST");
json_builder_add_value(b, n);
json_builder_end_object(b);
n = json_builder_get_root(b);
g_object_unref(b);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment