Browse Source

auc: be a bit more verbose

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
lilik-openwrt-22.03
Daniel Golle 7 years ago
parent
commit
68ae65f3bc
2 changed files with 17 additions and 3 deletions
  1. +1
    -1
      utils/auc/Makefile
  2. +16
    -2
      utils/auc/src/auc.c

+ 1
- 1
utils/auc/Makefile 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


+ 16
- 2
utils/auc/src/auc.c 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) {


Loading…
Cancel
Save