diff --git a/CMakeLists.txt b/CMakeLists.txt index 45d62b4..1d5066c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ ADD_DEFINITIONS(-Os -std=gnu99 -g3 -Wmissing-declarations -Wno-unused-parameter) SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -SET(SOURCES main.c config.c proto.c ubus.c task.c cmd.c apply.c upload.c rebootlog.c event.c collide.c version.c) +SET(SOURCES main.c config.c proto.c ubus.c task.c cmd.c apply.c upload.c rebootlog.c event.c collide.c) FIND_LIBRARY(ubus NAMES ubus) FIND_LIBRARY(blobmsg_json NAMES blobmsg_json) diff --git a/proto.c b/proto.c index 8ca0f1a..c08f08a 100644 --- a/proto.c +++ b/proto.c @@ -189,7 +189,6 @@ connect_send(void) blobmsg_add_string(&proto, "serial", client.serial); blobmsg_add_string(&proto, "firmware", client.firmware); - version_init(&proto); if (client.recovery) blobmsg_add_u64(&proto, "uuid", 0); else diff --git a/ucentral.h b/ucentral.h index 0e4bfab..6d8d64a 100644 --- a/ucentral.h +++ b/ucentral.h @@ -141,8 +141,6 @@ void password_notify(char *pwd); void venue_broadcast_handle(struct blob_attr *rpc); void venue_broadcast_send(struct blob_attr *payload); -void version_init(struct blob_buf *b); - static inline void safe_free(char **mem) { if (!*mem) diff --git a/version.c b/version.c deleted file mode 100644 index 4aad51d..0000000 --- a/version.c +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause */ - -#include "ucentral.h" - -#define VERSION "/etc/ucentral/version.json" - -static struct blob_buf version; -enum { - MAJOR, - MINOR, - PATCH, - __VERSION_MAX, -}; - -static const struct blobmsg_policy version_policy[__VERSION_MAX] = { - [MAJOR] = { .name = "major", .type = BLOBMSG_TYPE_INT32 }, - [MINOR] = { .name = "minor", .type = BLOBMSG_TYPE_INT32 }, - [PATCH] = { .name = "patch", .type = BLOBMSG_TYPE_INT32 }, -}; - - -void -version_init(struct blob_buf *b) -{ - struct blob_attr *tb[__VERSION_MAX] = {}; - struct stat s = {}; - - if (stat(VERSION, &s)) - return; - - blob_buf_init(&version, 0); - if (blobmsg_add_json_from_file(&version, VERSION)) { - void *c = blobmsg_open_table(b, "version"); - - blobmsg_parse(version_policy, __VERSION_MAX, tb, blob_data(version.head), - blob_len(version.head)); - - if (tb[MAJOR]) - blobmsg_add_u32(b, "major", blobmsg_get_u32(tb[MAJOR])); - if (tb[MINOR]) - blobmsg_add_u32(b, "minor", blobmsg_get_u32(tb[MINOR])); - if (tb[PATCH]) - blobmsg_add_u32(b, "patch", blobmsg_get_u32(tb[PATCH])); - blobmsg_close_table(b, c); - } - blob_buf_free(&version); -}