2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
|
|
|
|
2016-02-05 10:06:25 +00:00
|
|
|
Copyright 2007-2016 Thomas Schmitt, <scdbackup@gmx.net>
|
2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
Provided under GPL version 2 or later.
|
|
|
|
|
2015-02-06 11:56:31 +00:00
|
|
|
This file contains the implementation of commands -a* to -c* as mentioned
|
2010-05-15 18:48:10 +00:00
|
|
|
in man page or info file derived from xorriso.texi.
|
|
|
|
*/
|
|
|
|
|
2010-05-16 09:32:14 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
/* for -charset */
|
|
|
|
#include <iconv.h>
|
|
|
|
#include <langinfo.h>
|
|
|
|
#include <locale.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "xorriso.h"
|
|
|
|
#include "xorriso_private.h"
|
|
|
|
#include "xorrisoburn.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -abort_on */
|
2011-07-31 09:44:41 +00:00
|
|
|
int Xorriso_option_abort_on(struct XorrisO *xorriso, char *in_severity,
|
|
|
|
int flag)
|
2010-05-15 18:48:10 +00:00
|
|
|
{
|
|
|
|
int ret, sev;
|
2011-07-31 09:44:41 +00:00
|
|
|
char severity[20], *official;
|
2010-05-15 18:48:10 +00:00
|
|
|
|
2011-07-31 09:44:41 +00:00
|
|
|
Xorriso__to_upper(in_severity, severity, (int) sizeof(severity), 0);
|
2010-05-15 18:48:10 +00:00
|
|
|
ret= Xorriso__text_to_sev(severity, &sev, 0);
|
|
|
|
if(ret<=0) {
|
2011-05-05 10:51:27 +00:00
|
|
|
sprintf(xorriso->info_text, "-abort_on: Not a known severity name : ");
|
2011-07-31 09:44:41 +00:00
|
|
|
Text_shellsafe(in_severity, xorriso->info_text, 1);
|
2010-05-15 18:48:10 +00:00
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(ret);
|
|
|
|
}
|
2011-07-31 09:44:41 +00:00
|
|
|
ret= Xorriso__sev_to_text(sev, &official, 0);
|
|
|
|
if(ret <= 0)
|
|
|
|
official= severity;
|
|
|
|
if(Sfile_str(xorriso->abort_on_text, official, 0) <= 0)
|
2010-05-15 18:48:10 +00:00
|
|
|
return(-1);
|
|
|
|
xorriso->abort_on_severity= sev;
|
2011-01-04 19:30:49 +00:00
|
|
|
xorriso->abort_on_is_default= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
Xorriso_set_abort_severity(xorriso, 0);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-26 11:40:36 +00:00
|
|
|
/* Option -abstract_file */
|
|
|
|
int Xorriso_option_abstract_file(struct XorrisO *xorriso, char *name, int flag)
|
|
|
|
{
|
|
|
|
if(Xorriso_check_name_len(xorriso, name,
|
|
|
|
(int) sizeof(xorriso->abstract_file),
|
|
|
|
"-abstract_file", 0) <= 0)
|
|
|
|
return(0);
|
|
|
|
strcpy(xorriso->abstract_file, name);
|
|
|
|
Xorriso_set_change_pending(xorriso, 1);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
/* Option -acl "on"|"off" */
|
|
|
|
int Xorriso_option_acl(struct XorrisO *xorriso, char *mode, int flag)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if(strcmp(mode, "off")==0)
|
|
|
|
xorriso->do_aaip&= ~3;
|
|
|
|
else if(strcmp(mode, "on")==0)
|
|
|
|
xorriso->do_aaip|= (1 | 2);
|
|
|
|
else {
|
|
|
|
sprintf(xorriso->info_text, "-acl: unknown mode '%s'", mode);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
ret= Xorriso_set_ignore_aclea(xorriso, 0);
|
|
|
|
if(ret <= 0)
|
|
|
|
return(ret);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-09 13:28:06 +00:00
|
|
|
/* @param flag bit3= unescape \\
|
|
|
|
*/
|
|
|
|
static void unescape_pathspec_part(char *rpt, int flag)
|
|
|
|
{
|
|
|
|
char *wpt;
|
|
|
|
|
|
|
|
wpt= rpt;
|
|
|
|
for(; *rpt != 0; rpt++) {
|
|
|
|
if(*rpt == '\\') {
|
|
|
|
if(*(rpt + 1) == '=')
|
|
|
|
continue;
|
|
|
|
if((flag & 8) && *(rpt + 1) == '\\')
|
|
|
|
rpt++;
|
|
|
|
}
|
|
|
|
*(wpt++)= *rpt;
|
|
|
|
}
|
|
|
|
*wpt= 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
/* Option -add */
|
|
|
|
/* @param flag bit0=do not report the added item
|
|
|
|
bit1=do not reset pacifier, no final pacifier message
|
2011-02-04 19:19:24 +00:00
|
|
|
bit2= prepend ISO working directory in any case
|
2010-05-15 18:48:10 +00:00
|
|
|
*/
|
|
|
|
int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
|
|
|
|
int *idx, int flag)
|
|
|
|
{
|
2015-12-09 13:28:06 +00:00
|
|
|
int i, end_idx, ret, was_failure= 0, fret, optc= 0, split, as_mkisofs= 0;
|
2011-05-05 10:51:27 +00:00
|
|
|
char *target= NULL, *source= NULL, *ept, *eff_path= NULL;
|
2015-12-09 13:28:06 +00:00
|
|
|
char **optv= NULL;
|
2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
ret= Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx,
|
|
|
|
&optc, &optv, ((!!xorriso->allow_graft_points)<<2)|2);
|
|
|
|
if(ret<=0)
|
|
|
|
goto ex;
|
|
|
|
|
2011-05-22 18:14:56 +00:00
|
|
|
Xorriso_alloc_meM(target, char, SfileadrL);
|
|
|
|
Xorriso_alloc_meM(source, char, SfileadrL);
|
|
|
|
Xorriso_alloc_meM(eff_path, char, SfileadrL);
|
|
|
|
|
2015-12-09 13:28:06 +00:00
|
|
|
if(xorriso->allow_graft_points & 2)
|
|
|
|
as_mkisofs= 8;
|
2010-05-15 18:48:10 +00:00
|
|
|
if(!(flag&2))
|
|
|
|
Xorriso_pacifier_reset(xorriso, 0);
|
|
|
|
for(i= 0; i<optc; i++) {
|
|
|
|
if(Sfile_str(target,optv[i],0)<=0)
|
|
|
|
{ret= -1; goto ex;}
|
|
|
|
strcpy(source, optv[i]);
|
|
|
|
split= 0;
|
|
|
|
if(xorriso->allow_graft_points) {
|
2015-12-09 16:23:12 +00:00
|
|
|
ret= Fileliste__target_source_limit(target, '=', &ept,
|
|
|
|
!(xorriso->allow_graft_points & 2));
|
2010-05-15 18:48:10 +00:00
|
|
|
if(ret>0) {
|
|
|
|
*ept= 0;
|
|
|
|
strcpy(source, ept+1);
|
|
|
|
split= 1;
|
|
|
|
}
|
|
|
|
/* unescape \= */;
|
2015-12-09 13:28:06 +00:00
|
|
|
if(split) {
|
|
|
|
unescape_pathspec_part(target, as_mkisofs);
|
|
|
|
if(as_mkisofs)
|
|
|
|
unescape_pathspec_part(source, as_mkisofs);
|
|
|
|
} else {
|
|
|
|
unescape_pathspec_part(source, as_mkisofs);
|
2010-05-15 18:48:10 +00:00
|
|
|
}
|
|
|
|
}
|
2011-02-04 19:19:24 +00:00
|
|
|
if(split==0)
|
2010-05-15 18:48:10 +00:00
|
|
|
strcpy(target, source);
|
2011-02-04 19:19:24 +00:00
|
|
|
if(flag & 4) {
|
2010-05-15 18:48:10 +00:00
|
|
|
ret= Sfile_prepend_path(xorriso->wdi, target, 0);
|
2011-02-04 19:19:24 +00:00
|
|
|
if(ret<=0) {
|
|
|
|
sprintf(xorriso->info_text, "Effective path gets much too long (%d)",
|
|
|
|
(int) (strlen(xorriso->wdi)+strlen(target)+1));
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
2010-05-15 18:48:10 +00:00
|
|
|
goto problem_handler;
|
2011-02-04 19:19:24 +00:00
|
|
|
}
|
2010-05-15 18:48:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, target, eff_path, 2);
|
|
|
|
if(ret<=0)
|
|
|
|
goto problem_handler;
|
|
|
|
strcpy(target, eff_path);
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, source,eff_path,2|4);
|
|
|
|
if(ret<=0)
|
|
|
|
goto problem_handler;
|
|
|
|
strcpy(source, eff_path);
|
|
|
|
|
|
|
|
ret= Xorriso_graft_in(xorriso, NULL, source, target, (off_t)0, (off_t)0, 0);
|
|
|
|
if(ret<=0 || xorriso->request_to_abort)
|
|
|
|
goto problem_handler;
|
|
|
|
sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n",
|
|
|
|
(ret>1 ? "directory" : "file"), (target[0] ? target : "/"), source);
|
|
|
|
if(!(flag&1))
|
|
|
|
Xorriso_info(xorriso, 0);
|
|
|
|
|
|
|
|
continue; /* regular bottom of loop */
|
|
|
|
problem_handler:;
|
|
|
|
was_failure= 1;
|
|
|
|
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
|
|
|
|
if(fret>=0)
|
|
|
|
continue;
|
|
|
|
goto ex;
|
|
|
|
}
|
|
|
|
if(!(flag&2))
|
|
|
|
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
|
|
|
|
xorriso->pacifier_total, "", 1);
|
|
|
|
ret= 1;
|
|
|
|
ex:;
|
|
|
|
(*idx)= end_idx;
|
2011-05-05 10:51:27 +00:00
|
|
|
Xorriso_free_meM(target);
|
|
|
|
Xorriso_free_meM(source);
|
|
|
|
Xorriso_free_meM(eff_path);
|
2010-05-15 18:48:10 +00:00
|
|
|
Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx, &optc, &optv,
|
|
|
|
256);
|
|
|
|
if(ret<=0)
|
|
|
|
return(ret);
|
|
|
|
return(!was_failure);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -add_plainly "none"|"unknown" */
|
|
|
|
int Xorriso_option_add_plainly(struct XorrisO *xorriso, char *mode,int flag)
|
|
|
|
{
|
|
|
|
if(strcmp(mode, "none")==0)
|
|
|
|
xorriso->add_plainly= 0;
|
|
|
|
if(strcmp(mode, "unknown")==0)
|
|
|
|
xorriso->add_plainly= 1;
|
|
|
|
else if(strcmp(mode, "dashed")==0)
|
|
|
|
xorriso->add_plainly= 2;
|
|
|
|
else if(strcmp(mode, "any")==0)
|
|
|
|
xorriso->add_plainly= 3;
|
|
|
|
else {
|
|
|
|
sprintf(xorriso->info_text, "-add_plainly: unknown mode '%s'", mode);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -alter_date , -alter_date_r */
|
|
|
|
/* @param flag bit0=recursive (-alter_date_r)
|
|
|
|
*/
|
|
|
|
int Xorriso_option_alter_date(struct XorrisO *xorriso,
|
|
|
|
char *time_type, char *timestring,
|
|
|
|
int argc, char **argv, int *idx, int flag)
|
|
|
|
{
|
|
|
|
int i, ret, was_failure= 0, t_type= 0, end_idx, fret;
|
|
|
|
time_t t;
|
|
|
|
int optc= 0;
|
|
|
|
char **optv= NULL;
|
|
|
|
struct FindjoB *job= NULL;
|
|
|
|
struct stat dir_stbuf;
|
|
|
|
|
|
|
|
ret= Xorriso_opt_args(xorriso, "-alter_date", argc, argv, *idx, &end_idx,
|
|
|
|
&optc, &optv, 0);
|
|
|
|
if(ret<=0)
|
|
|
|
goto ex;
|
|
|
|
ret= Xorriso_convert_datestring(xorriso, "-alter_date", time_type, timestring,
|
|
|
|
&t_type, &t, 0);
|
|
|
|
if(ret<=0)
|
|
|
|
goto ex;
|
|
|
|
for(i= 0; i<optc; i++) {
|
|
|
|
if(flag&1) {
|
|
|
|
ret= Findjob_new(&job, optv[i], 0);
|
|
|
|
if(ret<=0) {
|
|
|
|
Xorriso_no_findjob(xorriso, "-alter_date", 0);
|
|
|
|
{ret= -1; goto ex;}
|
|
|
|
}
|
|
|
|
Findjob_set_action_ad(job, t_type, t, 0);
|
|
|
|
ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0,
|
|
|
|
NULL, optv[i], &dir_stbuf, 0, 0);
|
|
|
|
Findjob_destroy(&job, 0);
|
|
|
|
} else
|
|
|
|
ret= Xorriso_set_time(xorriso, optv[i], t, t_type);
|
|
|
|
if(ret>0 && !xorriso->request_to_abort)
|
|
|
|
continue; /* regular bottom of loop */
|
|
|
|
was_failure= 1;
|
|
|
|
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
|
|
|
|
if(fret>=0)
|
|
|
|
continue;
|
|
|
|
goto ex;
|
|
|
|
}
|
|
|
|
ret= 1;
|
|
|
|
ex:;
|
|
|
|
(*idx)= end_idx;
|
|
|
|
Xorriso_opt_args(xorriso, "-alter_date", argc, argv, *idx, &end_idx, &optc,
|
|
|
|
&optv, 256);
|
|
|
|
Findjob_destroy(&job, 0);
|
|
|
|
if(ret<=0)
|
|
|
|
return(ret);
|
|
|
|
return(!was_failure);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-18 21:22:23 +00:00
|
|
|
/* Option -append_partition */
|
|
|
|
int Xorriso_option_append_partition(struct XorrisO *xorriso, char *partno_text,
|
|
|
|
char *type_text, char *image_path, int flag)
|
|
|
|
{
|
|
|
|
int partno = 0, type_code= -1, i;
|
|
|
|
unsigned int unum;
|
|
|
|
char *tpt;
|
2010-11-05 14:46:34 +00:00
|
|
|
static char *part_type_names[] = {"FAT12", "FAT16", "Linux", "", NULL};
|
|
|
|
static int part_type_codes[] = { 0x01, 0x06, 0x83, 0x00};
|
2010-10-18 21:22:23 +00:00
|
|
|
|
|
|
|
sscanf(partno_text, "%d", &partno);
|
2010-11-05 14:46:34 +00:00
|
|
|
if(partno < 1 || partno > Xorriso_max_appended_partitionS) {
|
2010-10-18 21:22:23 +00:00
|
|
|
sprintf(xorriso->info_text,
|
2010-11-05 14:46:34 +00:00
|
|
|
"-append_partition: Partition number '%s' is out of range (1...%d)",
|
|
|
|
partno_text, Xorriso_max_appended_partitionS);
|
2010-10-18 21:22:23 +00:00
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
for(i= 0; part_type_names[i] != NULL; i++)
|
|
|
|
if(strcmp(part_type_names[i], type_text) == 0)
|
|
|
|
break;
|
|
|
|
if(part_type_names[i] != NULL)
|
|
|
|
type_code= part_type_codes[i];
|
|
|
|
if(type_code < 0) {
|
|
|
|
tpt= type_text;
|
|
|
|
if(strncmp(tpt, "0x", 2) == 0)
|
|
|
|
tpt+= 2;
|
|
|
|
else
|
|
|
|
goto bad_type;
|
|
|
|
unum= 0xffffffff;
|
|
|
|
sscanf(tpt, "%X", &unum);
|
|
|
|
if(unum > 0xff) {
|
|
|
|
bad_type:;
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"-append_partition: Partition type '%s' is out of range (0x00...0xff)",
|
|
|
|
type_text);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
type_code= unum;
|
|
|
|
}
|
|
|
|
|
2010-11-05 14:46:34 +00:00
|
|
|
if(xorriso->appended_partitions[partno - 1] != NULL)
|
|
|
|
free(xorriso->appended_partitions[partno - 1]);
|
|
|
|
xorriso->appended_partitions[partno - 1]= strdup(image_path);
|
|
|
|
if(xorriso->appended_partitions[partno - 1] == NULL) {
|
|
|
|
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
2010-10-18 21:22:23 +00:00
|
|
|
return(-1);
|
2010-11-05 14:46:34 +00:00
|
|
|
}
|
2010-10-18 21:22:23 +00:00
|
|
|
xorriso->appended_part_types[partno - 1]= type_code;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
/* Option -application_id */
|
|
|
|
int Xorriso_option_application_id(struct XorrisO *xorriso, char *name,
|
|
|
|
int flag)
|
|
|
|
{
|
2010-07-30 15:52:09 +00:00
|
|
|
if(Xorriso_check_name_len(xorriso, name,
|
|
|
|
(int) sizeof(xorriso->application_id),
|
|
|
|
"-application_id", 0) <= 0)
|
|
|
|
return(0);
|
|
|
|
if(strcmp(name, "@xorriso@") == 0)
|
|
|
|
Xorriso_preparer_string(xorriso, xorriso->application_id, 0);
|
|
|
|
else
|
|
|
|
strcpy(xorriso->application_id,name);
|
2010-05-15 18:48:10 +00:00
|
|
|
Xorriso_set_change_pending(xorriso, 1);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-04 10:21:14 +00:00
|
|
|
/* Command -application_use */
|
|
|
|
int Xorriso_option_application_use(struct XorrisO *xorriso, char *path,
|
|
|
|
int flag)
|
|
|
|
{
|
|
|
|
if(Sfile_str(xorriso->application_use, path, 0) <= 0) {
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"-application_use: parameter string is much too long (%d)",
|
|
|
|
(int) strlen(path));
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
/* Option -as */
|
|
|
|
/* @param flag bit0=do not report the added item
|
|
|
|
bit1=do not reset pacifier, no final pacifier message
|
|
|
|
*/
|
|
|
|
int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv,
|
|
|
|
int *idx, int flag)
|
|
|
|
{
|
|
|
|
int end_idx, ret, idx_count;
|
|
|
|
|
|
|
|
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
|
|
|
|
idx_count= end_idx-(*idx);
|
|
|
|
if(end_idx<=0 || (*idx)>=argc) {
|
|
|
|
if(idx_count<1)
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"-as : Not enough arguments given. Needed: whom do_what %s",
|
|
|
|
xorriso->list_delimiter);
|
|
|
|
else
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"-as %s : Not enough arguments given. Needed: do_what %s",
|
|
|
|
argv[*idx], xorriso->list_delimiter);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
ret= 0; goto ex;
|
|
|
|
}
|
|
|
|
if(strcmp(argv[*idx], "cdrecord")==0 || strcmp(argv[*idx], "wodim")==0 ||
|
|
|
|
strcmp(argv[*idx], "cdrskin")==0 || strcmp(argv[*idx], "xorrecord")==0) {
|
|
|
|
ret= Xorriso_cdrskin(xorriso, argv[*idx], end_idx-(*idx)-1, argv+(*idx)+1,
|
|
|
|
0);
|
|
|
|
if(ret<=0)
|
|
|
|
goto ex;
|
|
|
|
} else if(strcmp(argv[*idx], "mkisofs")==0 ||
|
|
|
|
strcmp(argv[*idx], "genisoimage")==0 ||
|
|
|
|
strcmp(argv[*idx], "genisofs")==0 ||
|
|
|
|
strcmp(argv[*idx], "xorrisofs")==0) {
|
|
|
|
ret= Xorriso_genisofs(xorriso, argv[*idx], end_idx-(*idx)-1, argv+(*idx)+1,
|
|
|
|
0);
|
|
|
|
if(ret<=0)
|
|
|
|
goto ex;
|
|
|
|
} else {
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"-as : Not a known emulation personality: '%s'", argv[*idx]);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
ret= 0; goto ex;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret= 1;
|
|
|
|
ex:;
|
|
|
|
(*idx)= end_idx;
|
|
|
|
return(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -assert_volid */
|
|
|
|
int Xorriso_option_assert_volid(struct XorrisO *xorriso, char *pattern,
|
|
|
|
char *severity, int flag)
|
|
|
|
{
|
|
|
|
int ret, sev;
|
2011-10-05 17:32:26 +00:00
|
|
|
char *sev_text= "", off_severity[20];
|
2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
if(strlen(pattern)>=sizeof(xorriso->assert_volid)) {
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"Name too long with option -application_id (%d > %d)",
|
|
|
|
(int) strlen(pattern), (int) sizeof(xorriso->assert_volid)-1);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
if(pattern[0]) {
|
|
|
|
ret= Sregex_match(pattern, "", 1);
|
|
|
|
if(ret <= 0) {
|
|
|
|
sprintf(xorriso->info_text, "-assert_volid: Cannot use given pattern.");
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(severity[0] != 0 || pattern[0] != 0) {
|
|
|
|
if(severity[0] == 0)
|
|
|
|
sev_text= xorriso->abort_on_text;
|
|
|
|
else
|
|
|
|
sev_text= severity;
|
|
|
|
if(strcmp(sev_text, "NEVER") == 0)
|
|
|
|
sev_text= "ABORT";
|
2011-10-05 17:32:26 +00:00
|
|
|
Xorriso__to_upper(sev_text, off_severity, (int) sizeof(off_severity), 0);
|
|
|
|
sev_text= off_severity;
|
2010-05-15 18:48:10 +00:00
|
|
|
ret= Xorriso__text_to_sev(sev_text, &sev, 0);
|
|
|
|
if(ret<=0) {
|
|
|
|
sprintf(xorriso->info_text, "-assert_volid: Not a known severity name : ");
|
|
|
|
Text_shellsafe(severity, xorriso->info_text, 1);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(Sfile_str(xorriso->assert_volid, pattern,0) <= 0)
|
|
|
|
return(-1);
|
|
|
|
strcpy(xorriso->assert_volid_sev, sev_text);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -auto_charset "on"|"off" */
|
|
|
|
int Xorriso_option_auto_charset(struct XorrisO *xorriso, char *mode, int flag)
|
|
|
|
{
|
|
|
|
if(strcmp(mode, "off")==0)
|
|
|
|
xorriso->do_aaip&= ~(256 | 512);
|
|
|
|
else if(strcmp(mode, "on")==0)
|
|
|
|
xorriso->do_aaip|= (256 | 512);
|
|
|
|
else {
|
|
|
|
sprintf(xorriso->info_text, "-auto_charset: unknown mode '%s'", mode);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -backslash_codes */
|
|
|
|
int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode,
|
|
|
|
int flag)
|
|
|
|
{
|
|
|
|
char *npt, *cpt;
|
|
|
|
int l, was;
|
|
|
|
|
|
|
|
was= xorriso->bsl_interpretation;
|
|
|
|
xorriso->bsl_interpretation= 0;
|
|
|
|
npt= cpt= mode;
|
|
|
|
for(; npt!=NULL; cpt= npt+1) {
|
|
|
|
npt= strchr(cpt,':');
|
|
|
|
if(npt==NULL)
|
|
|
|
l= strlen(cpt);
|
|
|
|
else
|
|
|
|
l= npt-cpt;
|
|
|
|
if(l == 0)
|
|
|
|
continue;
|
|
|
|
if(l == 3 && strncmp(cpt, "off", l)==0) {
|
|
|
|
xorriso->bsl_interpretation= 0;
|
|
|
|
} else if(l == 16 && strncmp(cpt, "in_double_quotes", l)==0) {
|
|
|
|
xorriso->bsl_interpretation= (xorriso->bsl_interpretation & ~3) | 1;
|
|
|
|
} else if(l == 9 && strncmp(cpt, "in_quotes", l)==0) {
|
|
|
|
xorriso->bsl_interpretation= (xorriso->bsl_interpretation & ~3) | 2;
|
|
|
|
} else if(l == 17 && strncmp(cpt, "with_quoted_input", l)==0) {
|
|
|
|
xorriso->bsl_interpretation= (xorriso->bsl_interpretation & ~3) | 3;
|
|
|
|
} else if(l == 22 && strncmp(cpt, "with_program_arguments", l)==0) {
|
|
|
|
xorriso->bsl_interpretation= xorriso->bsl_interpretation | 16;
|
|
|
|
} else if(l == 13 && strncmp(cpt, "encode_output", l)==0) {
|
|
|
|
xorriso->bsl_interpretation= xorriso->bsl_interpretation | 32 | 64;
|
|
|
|
} else if(l == 14 && strncmp(cpt, "encode_results", l)==0) {
|
|
|
|
xorriso->bsl_interpretation= xorriso->bsl_interpretation | 32;
|
|
|
|
} else if(l == 12 && strncmp(cpt, "encode_infos", l)==0) {
|
|
|
|
xorriso->bsl_interpretation= xorriso->bsl_interpretation | 64;
|
|
|
|
} else if(l == 2 && strncmp(cpt, "on", l)==0) {
|
|
|
|
xorriso->bsl_interpretation= 3 | 16 | 32 | 64;
|
|
|
|
} else {
|
|
|
|
if(l<SfileadrL)
|
|
|
|
sprintf(xorriso->info_text, "-backslash_codes: unknown mode '%s'", cpt);
|
|
|
|
else
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"-backslash_codes: oversized mode parameter (%d)", l);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
xorriso->bsl_interpretation= was;
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -ban_stdio_write */
|
|
|
|
int Xorriso_option_ban_stdio_write(struct XorrisO *xorriso, int flag)
|
|
|
|
{
|
|
|
|
xorriso->ban_stdio_write= 1;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-26 11:40:36 +00:00
|
|
|
/* Option -biblio_file */
|
|
|
|
int Xorriso_option_biblio_file(struct XorrisO *xorriso, char *name, int flag)
|
|
|
|
{
|
|
|
|
if(Xorriso_check_name_len(xorriso, name, (int) sizeof(xorriso->biblio_file),
|
|
|
|
"-biblio_file", 0) <= 0)
|
|
|
|
return(0);
|
|
|
|
strcpy(xorriso->biblio_file, name);
|
|
|
|
Xorriso_set_change_pending(xorriso, 1);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
/* Option -blank and -format */
|
|
|
|
/* @param flag bit0= format rather than blank
|
|
|
|
@return <=0 error , 1 success, 2 revoked by -reassure
|
|
|
|
*/
|
2012-10-24 09:59:13 +00:00
|
|
|
int Xorriso_option_blank(struct XorrisO *xorriso, char *in_mode, int flag)
|
2010-05-15 18:48:10 +00:00
|
|
|
{
|
2012-10-24 09:59:13 +00:00
|
|
|
char *cmd= "-blank", *mode;
|
|
|
|
int aq_ret, ret, mode_flag= 0, as_needed= 0, idx, do_force= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
off_t size= 0;
|
|
|
|
|
|
|
|
if(flag&1)
|
|
|
|
cmd= "-format";
|
|
|
|
if(xorriso->out_drive_handle == NULL) {
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"%s: No output drive set by -dev -or -outdev", cmd);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
if(xorriso->in_drive_handle == xorriso->out_drive_handle) {
|
2012-03-03 13:39:50 +00:00
|
|
|
if(Xorriso_change_is_pending(xorriso, 0)) {
|
2010-05-15 18:48:10 +00:00
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"%s: Image changes pending. -commit or -rollback first.", cmd);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret= Xorriso_reassure(xorriso, cmd,
|
|
|
|
"possibly make unreadable data on outdev", 0);
|
|
|
|
if(ret<=0)
|
|
|
|
return(2);
|
|
|
|
|
2012-10-24 09:59:13 +00:00
|
|
|
if(strncmp(in_mode, "force:", 6) == 0) {
|
|
|
|
do_force= 1;
|
|
|
|
mode= in_mode + 6;
|
|
|
|
} else
|
|
|
|
mode= in_mode;
|
2010-05-15 18:48:10 +00:00
|
|
|
if(strcmp(mode, "as_needed")==0 || mode[0]==0)
|
|
|
|
as_needed= 1;
|
|
|
|
else if(strcmp(mode, "all")==0 || strcmp(mode, "full")==0)
|
|
|
|
mode_flag= 0;
|
|
|
|
else if((strcmp(mode, "deformat")==0 ||
|
|
|
|
strcmp(mode, "deformat_sequential")==0) && !(flag&1))
|
|
|
|
mode_flag= 2;
|
|
|
|
else if((strcmp(mode, "deformat_quickest")==0 ||
|
|
|
|
strcmp(mode, "deformat_sequential_quickest")==0) && !(flag&1))
|
|
|
|
mode_flag= 3;
|
|
|
|
else if(strcmp(mode, "fast")==0)
|
|
|
|
mode_flag= 1;
|
|
|
|
else if(strncmp(mode, "by_index_", 9)==0 && (flag&1)) {
|
|
|
|
mode_flag= 128;
|
|
|
|
idx= -1;
|
|
|
|
if(strlen(mode)>9)
|
|
|
|
sscanf(mode+9, "%d", &idx);
|
|
|
|
if(idx<0 || idx>255) {
|
|
|
|
unusable_index:;
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"-format: mode '%s' provides unusable index number", mode);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
mode_flag|= (idx<<8);
|
|
|
|
} else if(strncmp(mode, "fast_by_index_", 14)==0 && (flag&1)) {
|
|
|
|
mode_flag= 1 | 128;
|
|
|
|
idx= -1;
|
|
|
|
if(strlen(mode)>14)
|
|
|
|
sscanf(mode+14, "%d", &idx);
|
|
|
|
if(idx<0 || idx>255)
|
|
|
|
goto unusable_index;
|
|
|
|
mode_flag|= (idx<<8);
|
|
|
|
} else if(strncmp(mode, "by_size_", 8) == 0 && (flag & 1)) {
|
|
|
|
size= (off_t) Scanf_io_size(mode + 8, 0);
|
|
|
|
if(size <= 0) {
|
|
|
|
unusable_size:;
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"-format: mode '%s' provides unusable size value", mode);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
mode_flag= 2;
|
|
|
|
} else if(strncmp(mode, "fast_by_size_", 13) == 0 && (flag & 1)) {
|
|
|
|
size= (off_t) Scanf_io_size(mode + 13, 0);
|
|
|
|
if(size <= 0)
|
|
|
|
goto unusable_size;
|
|
|
|
mode_flag= 3;
|
2013-06-27 12:56:20 +00:00
|
|
|
} else if(strcmp(mode, "without_spare") == 0 && (flag & 1)) {
|
|
|
|
mode_flag= 32;
|
2010-05-15 18:48:10 +00:00
|
|
|
} else {
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"%s: Unknown %s mode '%s'",
|
|
|
|
cmd, ((flag&1) ? "-format" : "-blank"), mode);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
return(0);
|
|
|
|
}
|
2012-10-24 09:59:13 +00:00
|
|
|
if(do_force) {
|
|
|
|
ret= Xorriso_pretend_full_disc(xorriso, 0);
|
|
|
|
if(ret <= 0)
|
|
|
|
return(ret);
|
|
|
|
}
|
2010-05-15 18:48:10 +00:00
|
|
|
if(as_needed)
|
|
|
|
ret= Xorriso_blank_as_needed(xorriso, (flag&1)<<2);
|
|
|
|
else if(flag&1)
|
2013-06-27 12:56:20 +00:00
|
|
|
ret= Xorriso_format_media(xorriso, size, mode_flag & 0xffa7);
|
2010-05-15 18:48:10 +00:00
|
|
|
else
|
|
|
|
ret= Xorriso_blank_media(xorriso, mode_flag&3);
|
|
|
|
if(ret==0)
|
|
|
|
return(ret);
|
2015-09-20 12:51:53 +00:00
|
|
|
if(ret <= 0) { /* in case of success, above functions will have re-acquired */
|
2010-05-15 18:48:10 +00:00
|
|
|
aq_ret= Xorriso_reaquire_outdev(xorriso, 0); /* actually give up drive */
|
|
|
|
if(ret<aq_ret)
|
|
|
|
return(ret);
|
|
|
|
if(aq_ret<=0)
|
|
|
|
return(aq_ret);
|
|
|
|
}
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -boot_image */
|
|
|
|
int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
|
|
|
char *treatment, int flag)
|
|
|
|
{
|
2014-01-14 09:11:02 +00:00
|
|
|
int was_ok= 1, ret, isolinux_grub= 0, count, bin_count, parm_len;
|
2014-01-16 11:34:11 +00:00
|
|
|
int palohdrversion;
|
2010-05-15 18:48:10 +00:00
|
|
|
unsigned int u;
|
2014-01-14 09:11:02 +00:00
|
|
|
char *formpt, *treatpt, *eff_path= NULL, *eqpt, parm[20];
|
2012-05-28 13:32:27 +00:00
|
|
|
uint8_t sn[8];
|
2010-05-15 18:48:10 +00:00
|
|
|
double num;
|
|
|
|
|
2011-05-05 10:51:27 +00:00
|
|
|
Xorriso_alloc_meM(eff_path, char, SfileadrL);
|
2010-05-15 18:48:10 +00:00
|
|
|
formpt= form;
|
|
|
|
if(formpt[0]=='-')
|
|
|
|
formpt++;
|
|
|
|
treatpt= treatment;
|
|
|
|
if(treatpt[0]=='-')
|
|
|
|
treatpt++;
|
|
|
|
|
|
|
|
if(strcmp(formpt, "isolinux")==0 || strcmp(formpt, "grub") == 0)
|
|
|
|
isolinux_grub= 1;
|
|
|
|
if(strcmp(treatpt, "keep")==0) {
|
|
|
|
if(xorriso->boot_count > 0) {
|
|
|
|
cannot_keep_or_patch:;
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"Loaded boot image has already been replaced. Cannot keep or patch it.");
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
2011-05-05 10:51:27 +00:00
|
|
|
{ret= 0; goto ex;}
|
2010-05-15 18:48:10 +00:00
|
|
|
}
|
|
|
|
if(isolinux_grub)
|
|
|
|
goto treatment_patch;
|
|
|
|
xorriso->keep_boot_image= 1;
|
2012-06-20 19:06:26 +00:00
|
|
|
xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
xorriso->boot_image_bin_path[0]= 0;
|
|
|
|
xorriso->patch_system_area= 0;
|
|
|
|
|
|
|
|
} else if(strcmp(treatpt, "patch")==0) {
|
|
|
|
treatment_patch:;
|
|
|
|
if(xorriso->boot_count > 0)
|
|
|
|
goto cannot_keep_or_patch;
|
|
|
|
xorriso->keep_boot_image= 0;
|
2012-06-20 19:06:26 +00:00
|
|
|
xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 1;
|
2010-05-15 18:48:10 +00:00
|
|
|
xorriso->boot_image_bin_path[0]= 0;
|
|
|
|
if(strcmp(formpt, "grub") == 0) {
|
|
|
|
xorriso->patch_isolinux_image|= 2;
|
|
|
|
xorriso->patch_system_area= 1;
|
|
|
|
} else if(strcmp(formpt, "isolinux") == 0)
|
|
|
|
xorriso->patch_system_area= 2;
|
|
|
|
else
|
|
|
|
xorriso->patch_system_area= 0;
|
|
|
|
|
2015-09-06 19:43:08 +00:00
|
|
|
} else if(strcmp(treatpt, "replay")==0) {
|
|
|
|
ret= Xorriso_report_system_area(xorriso, "cmd", 2);
|
|
|
|
if(ret <= 0)
|
|
|
|
goto ex;
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
} else if(strcmp(treatpt, "discard")==0) {
|
|
|
|
xorriso->keep_boot_image= 0;
|
2014-09-30 18:18:58 +00:00
|
|
|
xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~0x3ff) | 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
xorriso->boot_image_bin_path[0]= 0;
|
|
|
|
xorriso->patch_system_area= 0;
|
2010-10-13 17:07:05 +00:00
|
|
|
if((xorriso->system_area_options & 0xfc ) == 0)
|
|
|
|
xorriso->system_area_options= 0; /* Reset eventual type 0 flags */
|
2010-05-15 18:48:10 +00:00
|
|
|
if(xorriso->boot_count > 0) {
|
|
|
|
ret= Xorriso_attach_boot_image(xorriso, 2); /* dispose boot images */
|
|
|
|
if(ret <= 0)
|
2011-05-05 10:51:27 +00:00
|
|
|
goto ex;
|
2010-05-15 18:48:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} else if(strcmp(treatpt, "next") == 0) {
|
|
|
|
ret= Xorriso_attach_boot_image(xorriso, 0);
|
|
|
|
if(ret <= 0)
|
2011-05-05 10:51:27 +00:00
|
|
|
goto ex;
|
2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
} else if(strcmp(treatpt, "show_status")==0) {
|
|
|
|
sprintf(xorriso->result_line, "------------------------------------\n");
|
|
|
|
Xorriso_result(xorriso, 0);
|
|
|
|
sprintf(xorriso->result_line, "Status of loaded boot image :\n");
|
|
|
|
Xorriso_result(xorriso, 0);
|
|
|
|
sprintf(xorriso->result_line, "------------------------------------\n");
|
|
|
|
Xorriso_result(xorriso, 0);
|
|
|
|
Xorriso_show_boot_info(xorriso, 0);
|
|
|
|
sprintf(xorriso->result_line, "------------------------------------\n");
|
|
|
|
Xorriso_result(xorriso, 0);
|
|
|
|
sprintf(xorriso->result_line, "Boot image settings for next commit:\n");
|
|
|
|
Xorriso_result(xorriso, 0);
|
|
|
|
sprintf(xorriso->result_line, "------------------------------------\n");
|
|
|
|
Xorriso_result(xorriso, 0);
|
|
|
|
Xorriso_status(xorriso, "-boot_image", NULL, 0);
|
|
|
|
sprintf(xorriso->result_line, "------------------------------------\n");
|
|
|
|
Xorriso_result(xorriso, 0);
|
|
|
|
|
|
|
|
} else if(strcmp(treatpt, "cat_path=") == 0) {
|
|
|
|
xorriso->boot_image_cat_path[0] = 0;
|
|
|
|
} else if(strncmp(treatpt, "cat_path=", 9) == 0) {
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
|
|
|
|
xorriso->boot_image_cat_path, 2);
|
|
|
|
if(ret <= 0)
|
2011-05-05 10:51:27 +00:00
|
|
|
goto ex;
|
2010-05-15 18:48:10 +00:00
|
|
|
|
2010-06-19 15:21:36 +00:00
|
|
|
} else if(strncmp(treatpt, "cat_hidden=", 11) == 0) {
|
2010-06-20 07:22:24 +00:00
|
|
|
ret= Xorriso__hide_mode(treatpt + 11, 0);
|
|
|
|
if(ret >= 0)
|
|
|
|
xorriso->boot_image_cat_hidden= ret;
|
2010-06-19 15:21:36 +00:00
|
|
|
else
|
|
|
|
was_ok= 0;
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
} else if(strncmp(treatpt, "dir=", 4) == 0) {
|
|
|
|
if(strcmp(formpt, "isolinux")==0) {
|
|
|
|
/* ISOLINUX */
|
|
|
|
/* The three locations mentioned in http://syslinux.zytor.com/iso.php */
|
|
|
|
if(strcmp(treatpt + 4, "/") == 0)
|
|
|
|
strcpy(xorriso->boot_image_bin_path, "/");
|
|
|
|
else if(strcmp(treatpt + 4, "isolinux") == 0
|
|
|
|
|| strcmp(treatpt + 4, "/isolinux") == 0)
|
|
|
|
strcpy(xorriso->boot_image_bin_path, "/isolinux/");
|
|
|
|
else if(strcmp(treatpt + 4, "boot/isolinux") == 0
|
|
|
|
|| strcmp(treatpt + 4, "/boot/isolinux") == 0
|
|
|
|
|| strcmp(treatpt + 4, "boot") == 0
|
|
|
|
|| strcmp(treatpt + 4, "/boot") == 0)
|
|
|
|
strcpy(xorriso->boot_image_bin_path, "/boot/isolinux/");
|
|
|
|
else {
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"Unrecognized keyword with -boot_image %s %s",
|
|
|
|
form, treatment);
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
"Allowed with dir= are / , /isolinux . /boot/isolinux");
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
|
2011-05-05 10:51:27 +00:00
|
|
|
{ret= 0; goto ex;}
|
2010-05-15 18:48:10 +00:00
|
|
|
}
|
|
|
|
strcpy(xorriso->boot_image_cat_path, xorriso->boot_image_bin_path);
|
|
|
|
strcat(xorriso->boot_image_bin_path, "isolinux.bin");
|
|
|
|
strcat(xorriso->boot_image_cat_path, "boot.cat");
|
|
|
|
xorriso->boot_image_load_size= 4 * 512;
|
|
|
|
xorriso->keep_boot_image= 0;
|
2012-06-20 19:06:26 +00:00
|
|
|
xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 1;
|
2010-05-15 18:48:10 +00:00
|
|
|
strcpy(xorriso->boot_image_bin_form, formpt);
|
2011-05-05 10:51:27 +00:00
|
|
|
{ret= 1; goto ex;}
|
2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
} else if(strcmp(formpt, "grub") == 0) {
|
|
|
|
|
|
|
|
/* >>> GRUB */
|
|
|
|
was_ok= 0;
|
|
|
|
|
|
|
|
strcpy(xorriso->boot_image_bin_form, formpt);
|
|
|
|
|
|
|
|
} else
|
|
|
|
was_ok= 0;
|
|
|
|
|
|
|
|
} else if(strcmp(treatpt, "bin_path=") == 0) {
|
|
|
|
xorriso->boot_image_bin_path[0] = 0;
|
|
|
|
xorriso->boot_efi_default= 0;
|
|
|
|
} else if(strncmp(treatpt, "bin_path=", 9) == 0) {
|
2016-01-20 10:41:34 +00:00
|
|
|
if(strncmp(treatpt + 9, "--interval:appended_partition_", 30) == 0) {
|
|
|
|
strcpy(xorriso->boot_image_bin_path, treatpt + 9);
|
|
|
|
} else {
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
|
|
|
|
xorriso->boot_image_bin_path, 2);
|
|
|
|
if(ret <= 0)
|
|
|
|
goto ex;
|
|
|
|
}
|
2010-05-15 18:48:10 +00:00
|
|
|
xorriso->keep_boot_image= 0;
|
|
|
|
if(isolinux_grub) {
|
2012-06-20 19:06:26 +00:00
|
|
|
xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 1;
|
2010-05-15 18:48:10 +00:00
|
|
|
if(xorriso->boot_image_bin_path[0])
|
|
|
|
xorriso->boot_image_load_size= 4 * 512;
|
|
|
|
strcpy(xorriso->boot_image_bin_form, formpt);
|
|
|
|
} else
|
|
|
|
strcpy(xorriso->boot_image_bin_form, "any");
|
|
|
|
xorriso->boot_efi_default= 0;
|
|
|
|
|
|
|
|
} else if(strcmp(treatpt, "efi_path=") == 0) {
|
|
|
|
xorriso->boot_image_bin_path[0] = 0;
|
|
|
|
xorriso->boot_efi_default= 0;
|
|
|
|
} else if(strncmp(treatpt, "efi_path=", 9) == 0) {
|
2016-01-20 10:41:34 +00:00
|
|
|
if(strncmp(treatpt + 9, "--interval:appended_partition_", 30) == 0) {
|
|
|
|
strcpy(xorriso->boot_image_bin_path, treatpt + 9);
|
|
|
|
} else {
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
|
2010-05-15 18:48:10 +00:00
|
|
|
xorriso->boot_image_bin_path, 2);
|
2016-01-20 10:41:34 +00:00
|
|
|
if(ret <= 0)
|
|
|
|
goto ex;
|
|
|
|
}
|
2010-05-15 18:48:10 +00:00
|
|
|
xorriso->keep_boot_image= 0;
|
|
|
|
xorriso->boot_efi_default= 1;
|
|
|
|
|
2010-10-12 10:32:22 +00:00
|
|
|
} else if(strncmp(treatpt, "mips_path=", 10) == 0) {
|
2010-10-13 17:07:05 +00:00
|
|
|
sprintf(eff_path, "-boot_image %s mips_path=", formpt);
|
|
|
|
ret= Xorriso_coordinate_system_area(xorriso, 1, 0, eff_path, 0);
|
|
|
|
if(ret <= 0)
|
2011-05-05 10:51:27 +00:00
|
|
|
goto ex;
|
2010-10-12 18:31:54 +00:00
|
|
|
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 10,
|
|
|
|
eff_path, 2);
|
|
|
|
if(ret <= 0)
|
2011-05-05 10:51:27 +00:00
|
|
|
goto ex;
|
2010-10-12 18:31:54 +00:00
|
|
|
ret= Xorriso_add_mips_boot_file(xorriso, eff_path, 0);
|
|
|
|
if(ret <= 0)
|
2011-05-05 10:51:27 +00:00
|
|
|
goto ex;
|
2010-10-12 10:32:22 +00:00
|
|
|
|
2010-10-15 11:21:30 +00:00
|
|
|
} else if(strncmp(treatpt, "mipsel_path=", 12) == 0) {
|
|
|
|
sprintf(eff_path, "-boot_image %s mipsel_path=", formpt);
|
|
|
|
ret= Xorriso_coordinate_system_area(xorriso, 2, 0, eff_path, 0);
|
|
|
|
if(ret <= 0)
|
2011-05-05 10:51:27 +00:00
|
|
|
goto ex;
|
2010-10-15 11:21:30 +00:00
|
|
|
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 12,
|
|
|
|
eff_path, 2);
|
|
|
|
if(ret <= 0)
|
2011-05-05 10:51:27 +00:00
|
|
|
goto ex;
|
2010-10-15 11:21:30 +00:00
|
|
|
ret= Xorriso_add_mips_boot_file(xorriso, eff_path, 2);
|
|
|
|
if(ret <= 0)
|
2011-05-05 10:51:27 +00:00
|
|
|
goto ex;
|
2010-10-15 11:21:30 +00:00
|
|
|
|
|
|
|