Discarding, keeping or patching boot images from existing ISO images
This commit is contained in:
@ -2707,6 +2707,8 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->speed= 0;
|
||||
m->fs= 4*512; /* 4 MiB */
|
||||
m->padding= 300*1024;
|
||||
m->keep_boot_image= 0;
|
||||
m->patch_isolinux_image= 0;
|
||||
m->allow_graft_points= 0;
|
||||
m->dialog= 0;
|
||||
m->search_mode= 0;
|
||||
@ -3756,7 +3758,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
*/
|
||||
{
|
||||
int is_default,no_defaults,i;
|
||||
char *line, sfe[5*SfileadrL], mode[80];
|
||||
char *line, sfe[5*SfileadrL], mode[80], *form, *treatment;
|
||||
static char channel_prefixes[4][4]= {".","R","I","M"};
|
||||
|
||||
no_defaults= flag&1;
|
||||
@ -3824,6 +3826,19 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
}
|
||||
|
||||
is_default= (xorriso->keep_boot_image==0 && xorriso->patch_isolinux_image==0);
|
||||
form= "any";
|
||||
treatment= "discard";
|
||||
if(xorriso->patch_isolinux_image) {
|
||||
form= "isolinux";
|
||||
treatment= "patch";
|
||||
} else if(xorriso->keep_boot_image) {
|
||||
treatment= "keep";
|
||||
}
|
||||
sprintf(line,"-boot_image %s %s\n", form, treatment);
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
sprintf(line,"-cd %s\n",
|
||||
(xorriso->wdi[0] ? Text_shellsafe(xorriso->wdi,sfe,0) : "'/'"));
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
@ -6101,6 +6116,52 @@ int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag)
|
||||
}
|
||||
|
||||
|
||||
/* Option -boot_image */
|
||||
int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
char *treatment, int flag)
|
||||
{
|
||||
int was_ok= 1;
|
||||
char *formpt, *treatpt;
|
||||
|
||||
formpt= form;
|
||||
if(formpt[0]=='-')
|
||||
formpt++;
|
||||
treatpt= treatment;
|
||||
if(treatpt[0]=='-')
|
||||
treatpt++;
|
||||
if(strcmp(formpt, "any")==0) {
|
||||
if(strcmp(treatpt, "keep")==0) {
|
||||
xorriso->keep_boot_image= 1;
|
||||
xorriso->patch_isolinux_image= 0;
|
||||
} else if(strcmp(treatpt, "discard")==0) {
|
||||
xorriso->keep_boot_image= 0;
|
||||
xorriso->patch_isolinux_image= 0;
|
||||
} else
|
||||
was_ok= 0;
|
||||
} else if(strcmp(formpt, "isolinux")==0) {
|
||||
if(strcmp(treatpt, "patch")==0) {
|
||||
xorriso->keep_boot_image= 1;
|
||||
xorriso->patch_isolinux_image= 1;
|
||||
} else if(strcmp(treatpt, "keep")==0) {
|
||||
xorriso->keep_boot_image= 1;
|
||||
xorriso->patch_isolinux_image= 0;
|
||||
} else if(strcmp(treatpt, "discard")==0) {
|
||||
xorriso->keep_boot_image= 0;
|
||||
xorriso->patch_isolinux_image= 0;
|
||||
} else
|
||||
was_ok= 0;
|
||||
} else
|
||||
was_ok= 0;
|
||||
if(!was_ok) {
|
||||
sprintf(xorriso->info_text, "Unrecognized options with -boot_image: %s %s",
|
||||
form, treatment);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* Option -cd alias -cdi */
|
||||
int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
|
||||
{
|
||||
@ -8408,6 +8469,10 @@ next_command:;
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_blank(xorriso, arg1, 0);
|
||||
|
||||
} else if(strcmp(cmd,"boot_image")==0) {
|
||||
(*idx)+= 2;
|
||||
ret= Xorriso_option_boot_image(xorriso, arg1, arg2, 0);
|
||||
|
||||
} else if(strcmp(cmd,"cd")==0 || strcmp(cmd,"cdi")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_cdi(xorriso, arg1, 0);
|
||||
|
Reference in New Issue
Block a user