- if (src_image == WIMLIB_ALL_IMAGES) {
- if (src_wim->hdr.image_count > 1) {
-
- /* multi-image export. */
-
- if ((export_flags & WIMLIB_EXPORT_FLAG_BOOT) &&
- (src_wim->hdr.boot_idx == 0))
- {
- /* Specifying the boot flag on a multi-image
- * source WIM makes the boot index default to
- * the bootable image in the source WIM. It is
- * an error if there is no such bootable image.
- * */
- ERROR("Cannot specify `boot' flag when "
- "exporting multiple images from a WIM "
- "with no bootable images");
- return WIMLIB_ERR_INVALID_PARAM;
- }
- if (dest_name || dest_description) {
- ERROR("Image name or image description was "
- "specified, but we are exporting "
- "multiple images");
- return WIMLIB_ERR_INVALID_PARAM;
- }
- for (int i = 1; i <= src_wim->hdr.image_count; i++) {
- int new_flags = export_flags;
-
- if (i != src_wim->hdr.boot_idx)
- new_flags &= ~WIMLIB_EXPORT_FLAG_BOOT;
-
- ret = wimlib_export_image(src_wim, i, dest_wim,
- NULL, NULL,
- new_flags,
- additional_swms,
- num_additional_swms,
- progress_func);
- if (ret)
- return ret;
- }
- return 0;
- } else if (src_wim->hdr.image_count == 1) {
- src_image = 1;
- } else {
- return 0;
- }
- }