diff --git a/utils/auc/Makefile b/utils/auc/Makefile index 731b34be8..dcbf92c96 100644 --- a/utils/auc/Makefile +++ b/utils/auc/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=auc -PKG_VERSION:=0.0.1 +PKG_VERSION:=0.0.2 PKG_RELEASE=1 PKG_LICENSE:=GPL-3.0 @@ -15,7 +15,7 @@ include $(INCLUDE_DIR)/cmake.mk define Package/auc SECTION:=base CATEGORY:=Base system - TITLE:=attended sysupgrade (CLI version) + TITLE:=Attended sysUpgrade CLI (EXPERIMENTAL) DEPENDS:=+attendedsysupgrade-common +libblobmsg-json +libubox +libubus \ +libuci +libuclient +rpcd-mod-rpcsys endef diff --git a/utils/auc/src/auc.c b/utils/auc/src/auc.c index e7a3c8a7d..7c344e894 100644 --- a/utils/auc/src/auc.c +++ b/utils/auc/src/auc.c @@ -683,17 +683,15 @@ int main(int args, char *argv[]) { blobmsg_buf_init(&imgbuf); blobmsg_buf_init(&upgbuf); - if (!ubus_lookup_id(ctx, "system", &id)) { - ubus_invoke(ctx, id, "board", NULL, board_cb, &checkbuf, 3000); - } else { + 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"); rc=-1; goto freebufs; } - if (!ubus_lookup_id(ctx, "rpc-sys", &id)) { - ubus_invoke(ctx, id, "packagelist", NULL, pkglist_cb, &checkbuf, 3000); - } else { + if (ubus_lookup_id(ctx, "rpc-sys", &id) || + ubus_invoke(ctx, id, "packagelist", NULL, pkglist_cb, &checkbuf, 3000)) { fprintf(stderr, "cannot request packagelist from rpcd\n"); rc=-1; goto freeboard; @@ -741,10 +739,7 @@ int main(int args, char *argv[]) { } if (retry || queuepos) { - if (imgbuf.buf) - free(imgbuf.buf); - - memset(&imgbuf, '\0', sizeof(imgbuf)); + blob_buf_free(&imgbuf); blobmsg_buf_init(&imgbuf); sleep(3); } @@ -828,19 +823,11 @@ freeboard: free(version); free(revision); - freebufs: - if (checkbuf.buf) - free(checkbuf.buf); - - if (reqbuf.buf) - free(reqbuf.buf); - - if (imgbuf.buf) - free(imgbuf.buf); - - if (upgbuf.buf) - free(upgbuf.buf); + blob_buf_free(&checkbuf); + blob_buf_free(&reqbuf); + blob_buf_free(&imgbuf); + blob_buf_free(&upgbuf); freessl: if (ssl_ctx)