*/
#define _GNU_SOURCE
+#define AUC_VERSION "0.0.3"
#include <fcntl.h>
#include <dlfcn.h>
#define APIOBJ_CHECK "api/upgrade-check"
#define APIOBJ_REQUEST "api/upgrade-request"
-static const char *user_agent = "auc";
+static char user_agent[80];
static char *serverurl;
static struct ustream_ssl_ctx *ssl_ctx;
static const struct ustream_ssl_ops *ssl_ops;
blobmsg_buf_init(&imgbuf);
blobmsg_buf_init(&upgbuf);
+ snprintf(user_agent, sizeof(user_agent), "%s (%s)", argv[0], AUC_VERSION);
+
+ fprintf(stderr, "%s\n", user_agent);
+
if (ubus_lookup_id(ctx, "system", &id) ||
ubus_invoke(ctx, id, "board", NULL, board_cb, &checkbuf, 3000)) {
fprintf(stderr, "cannot request board info from procd\n");
goto freeboard;
}
+ fprintf(stderr, "running %s %s %s on %s/%s (%s)\n", distribution, version,
+ revision, target, subtarget, board_name);
+
+ fprintf(stderr, "checking %s for sysupgrade\n", serverurl);
+
blobmsg_add_string(&reqbuf, "distro", distribution);
blobmsg_add_string(&reqbuf, "target", target);
blobmsg_add_string(&reqbuf, "subtarget", subtarget);
snprintf(url, sizeof(url), "%s/%s", serverurl, APIOBJ_CHECK);
uptodate=0;
- server_request(url, &checkbuf, &reqbuf);
+ if (server_request(url, &checkbuf, &reqbuf)) {
+ fprintf(stderr, "failed to connect to server\n");
+ rc=-1;
+ goto freeboard;
+ };
blobmsg_parse(check_policy, __CHECK_MAX, tbc, blob_data(reqbuf.head), blob_len(reqbuf.head));
if (!tbc[CHECK_VERSION]) {
if (!uptodate) {