Browse Source

auc: update to version 0.1.8

This fixes support for x86, auc now selects the right combined image
depending on the system being booted in EFI mode or not.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
lilik-openwrt-22.03
Daniel Golle 3 years ago
parent
commit
1204cb82f9
2 changed files with 41 additions and 3 deletions
  1. +1
    -1
      utils/auc/Makefile
  2. +40
    -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.1.7
PKG_VERSION:=0.1.8
PKG_RELEASE:=$(AUTORELEASE)
PKG_LICENSE:=GPL-3.0


+ 40
- 2
utils/auc/src/auc.c View File

@ -1356,7 +1356,24 @@ static int req_add_selected_packages(struct blob_buf *req)
return 0;
}
static int select_image(struct blob_attr *images, char **image_name, char **image_sha256)
#if defined(__amd64__) || defined(__i386__)
static int system_is_efi(void)
{
const char efidname[] = "/sys/firmware/efi/efivars";
int fd = open(efidname, O_DIRECTORY | O_PATH);
if (fd != -1) {
close(fd);
return 1;
} else {
return 0;
}
}
#else
static inline int system_is_efi(void) { return 0; }
#endif
static int get_image_by_type(struct blob_attr *images, const char *typestr, char **image_name, char **image_sha256)
{
struct blob_attr *tb[__IMAGES_MAX];
struct blob_attr *cur;
@ -1370,7 +1387,7 @@ static int select_image(struct blob_attr *images, char **image_name, char **imag
!tb[IMAGES_SHA256])
continue;
if (!strcmp(blobmsg_get_string(tb[IMAGES_TYPE]), "sysupgrade")) {
if (!strcmp(blobmsg_get_string(tb[IMAGES_TYPE]), typestr)) {
*image_name = strdup(blobmsg_get_string(tb[IMAGES_NAME]));
*image_sha256 = strdup(blobmsg_get_string(tb[IMAGES_SHA256]));
ret = 0;
@ -1381,6 +1398,27 @@ static int select_image(struct blob_attr *images, char **image_name, char **imag
return ret;
}
static int select_image(struct blob_attr *images, char **image_name, char **image_sha256)
{
const char *combined_type;
int ret;
if (system_is_efi())
combined_type = "combined-efi";
else
combined_type = "combined";
DPRINTF("images: %s\n", blobmsg_format_json_indent(images, true, 0));
ret = get_image_by_type(images, "sysupgrade", image_name, image_sha256);
if (!ret)
return 0;
ret = get_image_by_type(images, combined_type, image_name, image_sha256);
return ret;
}
static bool validate_sha256(char *filename, char *sha256str)
{
char *cmd = calloc(strlen(SHA256SUM) + 1 + strlen(filename) + 1, sizeof(char));


Loading…
Cancel
Save