Made -boot_image isolinux activation obey -overwrite setting

This commit is contained in:
2008-09-28 11:33:47 +00:00
parent 2026814a80
commit 1625db8bbd
6 changed files with 108 additions and 20 deletions

View File

@ -81,6 +81,8 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node,
off_t img_offset, off_t disk_offset,
off_t bytes, int flag);
int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume,
char *path, IsoNode **node, int flag);
#define LIBISO_ISDIR(node) (iso_node_get_type(node) == LIBISO_DIR)
#define LIBISO_ISREG(node) (iso_node_get_type(node) == LIBISO_FILE)
@ -437,6 +439,8 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
struct isoburn_read_opts *ropts= NULL;
char adr_data[SfileadrL], *libburn_adr, *boot_fate, *sev;
static int no_rr_or_joliet= 0;
if((flag&3)==0) {
sprintf(xorriso->info_text,
"XORRISOBURN program error : Xorriso_aquire_drive bit0+bit1 not set");
@ -593,6 +597,13 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
}
/* <<< */
if(no_rr_or_joliet) {
isoburn_ropt_set_extensions(ropts,
isoburn_ropt_noiso1999 | isoburn_ropt_norock | isoburn_ropt_nojoliet);
}
ret= isoburn_read_image(drive, ropts, &volset);
/* <<< Resetting to normal thresholds */
@ -852,6 +863,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
struct burn_track **tracks;
enum burn_disc_status s;
IsoImage *image= NULL;
IsoNode *node;
ElToritoBootImage *bootimg;
enum eltorito_boot_media_type emul_type= ELTORITO_NO_EMUL;
@ -938,6 +950,37 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
cpt++;
strcpy(cpt, "boot.cat");
}
ret= Xorriso_node_from_path(xorriso, image, xorriso->boot_image_bin_path,
&node, 1);
if(ret <= 0) {
sprintf(xorriso->info_text,
"Cannot find in ISO image: -boot_image ... bin_path=%s",
Text_shellsafe(xorriso->boot_image_bin_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
ret= Xorriso_node_from_path(xorriso, image, xorriso->boot_image_cat_path,
&node, 1);
if(ret > 0) {
if(!xorriso->do_overwrite) {
sprintf(xorriso->info_text,
"May not overwite existing -boot_image ... cat_path=%s",
Text_shellsafe(xorriso->boot_image_cat_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
ret= Xorriso_rmi(xorriso, NULL, (off_t) 0, xorriso->boot_image_cat_path,
8 | (xorriso->do_overwrite == 1));
if(ret != 1) {
sprintf(xorriso->info_text,
"Could not remove existing -boot_image cat_path=%s",
Text_shellsafe(xorriso->boot_image_cat_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
}
ret= iso_image_set_boot_image(image, xorriso->boot_image_bin_path,
emul_type, xorriso->boot_image_cat_path,
&bootimg);