auc: update to version 0.0.6

* handle newly introduced 'initialize' server status
 * cosmetics

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2017-11-24 17:13:03 +01:00
parent 4625398eac
commit 78c699daa6
2 changed files with 18 additions and 9 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=auc PKG_NAME:=auc
PKG_VERSION:=0.0.5 PKG_VERSION:=0.0.6
PKG_RELEASE=1 PKG_RELEASE=1
PKG_LICENSE:=GPL-3.0 PKG_LICENSE:=GPL-3.0

View file

@ -13,7 +13,7 @@
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
#define AUC_VERSION "0.0.3" #define AUC_VERSION "0.0.6"
#include <fcntl.h> #include <fcntl.h>
#include <dlfcn.h> #include <dlfcn.h>
@ -49,7 +49,7 @@ static off_t out_len;
static off_t out_offset; static off_t out_offset;
static bool cur_resume; static bool cur_resume;
static int output_fd = -1; static int output_fd = -1;
static int retry, imagebuilder, building; static int retry, imagebuilder, building, ibready;
static char *board_name = NULL; static char *board_name = NULL;
static char *target = NULL, *subtarget = NULL; static char *target = NULL, *subtarget = NULL;
static char *distribution = NULL, *version = NULL, *revision = NULL; static char *distribution = NULL, *version = NULL, *revision = NULL;
@ -447,6 +447,12 @@ static void header_done_cb(struct uclient *cl)
building=1; building=1;
} }
retry=1; retry=1;
} else if (!strncmp(ibstatus, "initialize", 11)) {
if (!ibready) {
fprintf(stderr, "server is setting up ImageBuilder...\n");
ibready=1;
}
retry=1;
} else { } else {
fprintf(stderr, "unrecognized remote imagebuilder status '%s'\n", ibstatus); fprintf(stderr, "unrecognized remote imagebuilder status '%s'\n", ibstatus);
} }
@ -676,7 +682,7 @@ static char *md5sum(const char *file) {
static int ask_user(void) static int ask_user(void)
{ {
fprintf(stderr, "Are you sure to proceed? [N/y]\n"); fprintf(stderr, "Are you sure to proceed? [N/y] ");
if (getchar() != 'y') if (getchar() != 'y')
return -1; return -1;
return 0; return 0;
@ -769,11 +775,14 @@ int main(int args, char *argv[]) {
if (debug) if (debug)
fprintf(stderr, "requesting:\n%s\n", blobmsg_format_json_indent(checkbuf.head, true, 0)); fprintf(stderr, "requesting:\n%s\n", blobmsg_format_json_indent(checkbuf.head, true, 0));
if (server_request(url, &checkbuf, &reqbuf)) { retry=0;
fprintf(stderr, "failed to connect to server\n"); do {
rc=-1; if (server_request(url, &checkbuf, &reqbuf)) {
goto freeboard; fprintf(stderr, "failed to connect to server\n");
}; rc=-1;
goto freeboard;
};
} while(retry);
if (debug) if (debug)
fprintf(stderr, "reply:\n%s\n", blobmsg_format_json_indent(reqbuf.head, true, 0)); fprintf(stderr, "reply:\n%s\n", blobmsg_format_json_indent(reqbuf.head, true, 0));