The information required for output via the ubus is currently read from the file '/etc/openwrt_release'. The same information can also be found under '/usr/lib/os-release'. This file contains further information and is also the most common used file in other Linux distributions.
Let´s use '/usr/lib/os-release'. Signed-off-by: Florian Eckert <f...@dev.tdt.de> --- v2: - fixed spelling info: This is a preparatory commit to make the 'SOURCE_DATE_EPOCH' information also available via ubus [1]. The 'SOURCE_DATE_EPOCH' value is used for reproducible builds. After the merge of this and the referenced [1] commit, this information can also be made readable via the ubus. To do this, the reading of '/usr/lib/os-release' must be extended. [1] https://patchwork.ozlabs.org/project/openwrt/patch/20240618132343.3740920-1...@dev.tdt.de/ system.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/system.c b/system.c index 21ec3cd..dcc37e0 100644 --- a/system.c +++ b/system.c @@ -251,7 +251,7 @@ static int system_board(struct ubus_context *ctx, struct ubus_object *obj, if (rootfs_type) blobmsg_add_string(&b, "rootfs_type", rootfs_type); - if ((f = fopen("/etc/openwrt_release", "r")) != NULL) + if ((f = fopen("/usr/lib/os-release", "r")) != NULL) { c = blobmsg_open_table(&b, "release"); @@ -267,17 +267,17 @@ static int system_board(struct ubus_context *ctx, struct ubus_object *obj, *(val++) = 0; - if (!strcasecmp(key, "DISTRIB_ID")) + if (!strcasecmp(key, "NAME")) key = "distribution"; - else if (!strcasecmp(key, "DISTRIB_RELEASE")) + else if (!strcasecmp(key, "VERSION")) key = "version"; - else if (!strcasecmp(key, "DISTRIB_REVISION")) + else if (!strcasecmp(key, "BUILD_ID")) key = "revision"; - else if (!strcasecmp(key, "DISTRIB_CODENAME")) + else if (!strcasecmp(key, "VERSION_CODENAME")) key = "codename"; - else if (!strcasecmp(key, "DISTRIB_TARGET")) + else if (!strcasecmp(key, "OPENWRT_BOARD")) key = "target"; - else if (!strcasecmp(key, "DISTRIB_DESCRIPTION")) + else if (!strcasecmp(key, "PRETTY_NAME")) key = "description"; else continue; -- 2.39.2 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel