Skip to content
Snippets Groups Projects
Unverified Commit f9e68be4 authored by Linus Lüssing's avatar Linus Lüssing Committed by Matthias Schiffer
Browse files

gluon-mesh-batman-adv: respondd: determine compat version from release version


We cannot add the same file (here: /lib/gluon/mesh-batman-adv/compat) to
two, installed packages. Therefore, instead of determining the compat
version number from this file, infer it from the batman-adv release
version number instead.

Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
parent 011187e9
No related branches found
No related tags found
No related merge requests found
...@@ -232,25 +232,24 @@ static struct json_object * get_mesh(void) { ...@@ -232,25 +232,24 @@ static struct json_object * get_mesh(void) {
return ret; return ret;
} }
static struct json_object * get_batman_adv_compat(void) { static struct json_object * get_batman_adv_compat(const char *version) {
FILE *f = fopen("/lib/gluon/mesh-batman-adv/compat", "r"); int compat = 15;
if (!f)
return NULL;
struct json_object *ret = NULL;
int compat; if (!version)
if (fscanf(f, "%i", &compat) == 1) return NULL;
ret = json_object_new_int(compat);
fclose(f); if (strcmp(version, "2013.4.0") == 0)
compat = 14;
return ret; return json_object_new_int(compat);
} }
static struct json_object * respondd_provider_nodeinfo(void) { static struct json_object * respondd_provider_nodeinfo(void) {
struct json_object *ret = json_object_new_object(); struct json_object *ret = json_object_new_object();
char *version = gluonutil_read_line("/sys/module/batman_adv/version");
struct json_object *compat = get_batman_adv_compat(version);
struct json_object *network = json_object_new_object(); struct json_object *network = json_object_new_object();
json_object_object_add(network, "addresses", get_addresses()); json_object_object_add(network, "addresses", get_addresses());
json_object_object_add(network, "mesh", get_mesh()); json_object_object_add(network, "mesh", get_mesh());
...@@ -258,8 +257,8 @@ static struct json_object * respondd_provider_nodeinfo(void) { ...@@ -258,8 +257,8 @@ static struct json_object * respondd_provider_nodeinfo(void) {
struct json_object *software = json_object_new_object(); struct json_object *software = json_object_new_object();
struct json_object *software_batman_adv = json_object_new_object(); struct json_object *software_batman_adv = json_object_new_object();
json_object_object_add(software_batman_adv, "version", gluonutil_wrap_and_free_string(gluonutil_read_line("/sys/module/batman_adv/version"))); json_object_object_add(software_batman_adv, "version", gluonutil_wrap_and_free_string(version));
json_object_object_add(software_batman_adv, "compat", get_batman_adv_compat()); json_object_object_add(software_batman_adv, "compat", compat);
json_object_object_add(software, "batman-adv", software_batman_adv); json_object_object_add(software, "batman-adv", software_batman_adv);
json_object_object_add(ret, "software", software); json_object_object_add(ret, "software", software);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment