auc: send revision in update check
authorDaniel Golle <daniel@makrotopia.org>
Thu, 7 Mar 2019 23:32:03 +0000 (00:32 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 7 Mar 2019 23:32:48 +0000 (00:32 +0100)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
utils/auc/Makefile
utils/auc/src/auc.c

index ea97127aa19f9721fd62f366925b4610e783213c..0b44d0e5d72579010c1b077404d3221c30665a47 100644 (file)
@@ -5,7 +5,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=auc
-PKG_VERSION:=0.1.3
+PKG_VERSION:=0.1.4
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0
 
index 9a09c920af10baad0cbb154e50964b3fef7a2988..9bdd5298fa9e3047f27dddd563cf3afb633257ab 100644 (file)
@@ -13,7 +13,7 @@
  */
 
 #define _GNU_SOURCE
-#define AUC_VERSION "0.1.3"
+#define AUC_VERSION "0.1.4"
 
 #include <fcntl.h>
 #include <dlfcn.h>
@@ -62,7 +62,7 @@ static int output_fd = -1;
 static int retry, imagebuilder, building, ibready;
 static char *board_name = NULL;
 static char *target = NULL;
-static char *distribution = NULL, *version = NULL;
+static char *distribution = NULL, *version = NULL, *revision = NULL;
 static int uptodate;
 static char *filename = NULL;
 static int rc;
@@ -93,6 +93,7 @@ static const struct blobmsg_policy board_policy[__BOARD_MAX] = {
 enum {
        RELEASE_DISTRIBUTION,
        RELEASE_VERSION,
+       RELEASE_REVISION,
        RELEASE_TARGET,
        __RELEASE_MAX,
 };
@@ -100,6 +101,7 @@ enum {
 static const struct blobmsg_policy release_policy[__RELEASE_MAX] = {
        [RELEASE_DISTRIBUTION] = { .name = "distribution", .type = BLOBMSG_TYPE_STRING },
        [RELEASE_VERSION] = { .name = "version", .type = BLOBMSG_TYPE_STRING },
+       [RELEASE_REVISION] = { .name = "revision", .type = BLOBMSG_TYPE_STRING },
        [RELEASE_TARGET] = { .name = "target", .type = BLOBMSG_TYPE_STRING },
 };
 
@@ -308,20 +310,24 @@ static void board_cb(struct ubus_request *req, int type, struct blob_attr *msg)
        blobmsg_parse(release_policy, __RELEASE_MAX, rel,
                        blobmsg_data(tb[BOARD_RELEASE]), blobmsg_data_len(tb[BOARD_RELEASE]));
 
-       if (!rel[RELEASE_TARGET]) {
-               fprintf(stderr, "No target received\n");
+       if (!rel[RELEASE_TARGET] ||
+           !rel[RELEASE_DISTRIBUTION] ||
+           !rel[RELEASE_VERSION] ||
+           !rel[RELEASE_REVISION]) {
+               fprintf(stderr, "No release information received\n");
                rc=-1;
                return;
        }
 
        target = strdup(blobmsg_get_string(rel[RELEASE_TARGET]));
-
        distribution = strdup(blobmsg_get_string(rel[RELEASE_DISTRIBUTION]));
        version = strdup(blobmsg_get_string(rel[RELEASE_VERSION]));
+       revision = strdup(blobmsg_get_string(rel[RELEASE_REVISION]));
 
        blobmsg_add_string(buf, "distro", distribution);
        blobmsg_add_string(buf, "target", target);
        blobmsg_add_string(buf, "version", version);
+       blobmsg_add_string(buf, "revision", revision);
 }
 
 /*