Skip to content

Commit

Permalink
src/update_handler: enhance img_to_ubi*_handler() to cope with "*.cai…
Browse files Browse the repository at this point in the history
…bx" images

Note: for this to work successfully the utilized casync has to be augmented by
(the currently unmerged) pull request [1].

[1] systemd/casync#227

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
  • Loading branch information
OnkelUlla committed Oct 24, 2019
1 parent dc6b9f0 commit 7251840
Showing 1 changed file with 39 additions and 14 deletions.
53 changes: 39 additions & 14 deletions src/update_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,23 @@ static gboolean img_to_ubivol_handler(RaucImage *image, RaucSlot *dest_slot, con
goto out;
}

/* copy */
res = copy_raw_image(image, outstream, &ierror);
if (!res) {
g_propagate_error(error, ierror);
goto out;
/* Handle casync index file */
if (g_str_has_suffix(image->filename, ".caibx")) {
g_message("Extracting %s to %s", image->filename, dest_slot->device);

res = casync_extract_image(image, NULL, out_fd, &ierror);
if (!res) {
g_propagate_error(error, ierror);
goto out;
}

} else {
/* copy */
res = copy_raw_image(image, outstream, &ierror);
if (!res) {
g_propagate_error(error, ierror);
goto out;
}
}

/* run slot post install hook if enabled */
Expand Down Expand Up @@ -835,11 +847,23 @@ static gboolean img_to_ubifs_handler(RaucImage *image, RaucSlot *dest_slot, cons
goto out;
}

/* copy */
res = copy_raw_image(image, outstream, &ierror);
if (!res) {
g_propagate_error(error, ierror);
goto out;
/* Handle casync index file */
if (g_str_has_suffix(image->filename, ".caibx")) {
g_message("Extracting %s to %s", image->filename, dest_slot->device);

res = casync_extract_image(image, NULL, out_fd, &ierror);
if (!res) {
g_propagate_error(error, ierror);
goto out;
}

} else {
/* copy */
res = copy_raw_image(image, outstream, &ierror);
if (!res) {
g_propagate_error(error, ierror);
goto out;
}
}

/* run slot post install hook if enabled */
Expand Down Expand Up @@ -1476,11 +1500,12 @@ RaucUpdatePair updatepairs[] = {
{"*.ext4.caibx", "ext4", img_to_fs_handler},
{"*.ext4.caibx", "raw", img_to_raw_handler},
{"*.vfat.caibx", "raw", img_to_raw_handler},
//{"*.ubifs.caibx", "ubivol", img_to_ubivol_handler}, /* unsupported */
//{"*.ubifs.caibx", "ubifs", img_to_ubifs_handler}, /* unsupported */
{"*.ubifs.caibx", "ubivol", img_to_ubivol_handler},
{"*.ubifs.caibx", "ubifs", img_to_ubifs_handler},
//{"*.img.caibx", "nand", img_to_nand_handler}, /* unsupported */
//{"*.img.caibx", "ubivol", img_to_ubivol_handler}, /* unsupported */
//{"*.squashfs.caibx", "ubivol", img_to_ubivol_handler}, /* unsupported */
{"*.img.caibx", "ubivol", img_to_ubivol_handler},
{"*.img.caibx", "ubifs", img_to_ubifs_handler},
{"*.squashfs.caibx", "ubivol", img_to_ubivol_handler},
{"*.img.caibx", "*", img_to_raw_handler}, /* fallback */
{"*.caidx", "ext4", archive_to_ext4_handler},
{"*.caidx", "ubifs", archive_to_ubifs_handler},
Expand Down

0 comments on commit 7251840

Please sign in to comment.