auc: be a bit more verbose

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2017-11-13 01:25:02 +01:00
parent 3afbfa90e5
commit 68ae65f3bc
2 changed files with 17 additions and 3 deletions

View File

@ -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

View File

@ -13,6 +13,7 @@
*/
#define _GNU_SOURCE
#define AUC_VERSION "0.0.3"
#include <fcntl.h>
#include <dlfcn.h>
@ -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) {