From 68ae65f3bcf89161b2a983c3fa1f8979df6c0f76 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 13 Nov 2017 01:25:02 +0100 Subject: [PATCH] auc: be a bit more verbose Signed-off-by: Daniel Golle --- utils/auc/Makefile | 2 +- utils/auc/src/auc.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/utils/auc/Makefile b/utils/auc/Makefile index dcbf92c96d..4142ac208c 100644 --- a/utils/auc/Makefile +++ b/utils/auc/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=auc -PKG_VERSION:=0.0.2 +PKG_VERSION:=0.0.3 PKG_RELEASE=1 PKG_LICENSE:=GPL-3.0 diff --git a/utils/auc/src/auc.c b/utils/auc/src/auc.c index 7c344e894a..b8d97742df 100644 --- a/utils/auc/src/auc.c +++ b/utils/auc/src/auc.c @@ -13,6 +13,7 @@ */ #define _GNU_SOURCE +#define AUC_VERSION "0.0.3" #include #include @@ -38,7 +39,7 @@ #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; @@ -683,6 +684,10 @@ int main(int args, char *argv[]) { 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"); @@ -697,6 +702,11 @@ int main(int args, char *argv[]) { 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); @@ -704,7 +714,11 @@ int main(int args, char *argv[]) { 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) { -- 2.30.2