blobmsg_parse(board_policy, __BOARD_MAX, tb, blob_data(msg), blob_len(msg));
- if (!tb[BOARD_BOARD_NAME]) {
- fprintf(stderr, "No board name received\n");
- rc=-ENODATA;
- return;
- }
- board_name = strdup(blobmsg_get_string(tb[BOARD_BOARD_NAME]));
if (!tb[BOARD_RELEASE]) {
fprintf(stderr, "No release received\n");
version = strdup(blobmsg_get_string(rel[RELEASE_VERSION]));
revision = strdup(blobmsg_get_string(rel[RELEASE_REVISION]));
+ if (!strcmp(target, "x86/64") || !strcmp(target, "x86/generic")) {
+ /*
+ * ugly work-around ahead:
+ * ignore board name on generic x86 targets, as image name is always 'generic'
+ */
+ board_name = strdup("generic");
+ } else {
+ if (!tb[BOARD_BOARD_NAME]) {
+ fprintf(stderr, "No board name received\n");
+ rc=-ENODATA;
+ return;
+ }
+ board_name = strdup(blobmsg_get_string(tb[BOARD_BOARD_NAME]));
+ }
+
blobmsg_add_string(buf, "distro", distribution);
blobmsg_add_string(buf, "target", target);
blobmsg_add_string(buf, "version", version);
out_bytes = 0;
out_len = 0;
+#ifdef AUC_DEBUG
+ if (debug)
+ fprintf(stderr, "Requesting URL: %s\n", url);
+#endif
+
if (outbuf) {
jsb = malloc(sizeof(struct jsonblobber));
jsb->outbuf = outbuf;
break;
}
} else {
- if (!abr || (strcmp(br->version, abr->version) > 0))
- abr = br;
+ /* if we are on a snapshot branch, stay there */
+ if (strcasestr(version, "snapshot")) {
+ if (strcasestr(br->version, "snapshot")) {
+ abr = br;
+ break;
+ }
+ } else {
+ if (!abr || (verrevcmp(br->version, abr->version) > 0))
+ abr = br;
+ }
}
}
char url[256];
char *sanetized_board_name, *image_name, *image_sha256, *tmp;
struct blob_attr *tbr[__REPLY_MAX];
- struct blob_attr *tb[__TARGET_MAX];
+ struct blob_attr *tb[__TARGET_MAX] = {}; /* make sure tb is NULL initialized even if blobmsg_parse isn't called */
struct stat imgstat;
int check_only = 0;
int retry_delay = 0;