|
|
|
@ -9659,11 +9659,15 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|
|
|
|
" Insert disk file object at the given iso_rr_path.",
|
|
|
|
|
" -map_single disk_path iso_rr_path",
|
|
|
|
|
" Like -map but with directory do not insert its sub tree.",
|
|
|
|
|
" -map_l disk_prefix iso_rr_prefix disk_path [***]",
|
|
|
|
|
" Performs -map with each disk_path.",
|
|
|
|
|
" -update disk_path iso_rr_path",
|
|
|
|
|
" Compare both file objects and do what is necessary to make",
|
|
|
|
|
" iso_rr_path a matching copy of disk_path.",
|
|
|
|
|
" -update_r disk_path iso_rr_path",
|
|
|
|
|
" Like -update but affecting all files below directories.",
|
|
|
|
|
" -update_l disk_prefix iso_rr_prefix disk_path [***]",
|
|
|
|
|
" Performs -update_r with each disk_path.",
|
|
|
|
|
" -cut_out disk_path byte_offset byte_count iso_rr_path",
|
|
|
|
|
" Map a byte interval of a regular disk file into a regular",
|
|
|
|
|
" file in the ISO image.",
|
|
|
|
@ -9815,6 +9819,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|
|
|
|
" content of filesystem object and ISO object.",
|
|
|
|
|
" -compare_r disk_path iso_rr_path ",
|
|
|
|
|
" Like -compare but affecting all files below directories.",
|
|
|
|
|
" -compare_l disk_prefix iso_rr_prefix disk_path [***]",
|
|
|
|
|
" Performs -compare_r with each disk_path.",
|
|
|
|
|
"",
|
|
|
|
|
"Restore options which copy file objects from ISO image to disk filesystem:",
|
|
|
|
|
" -osirrox \"on\"|\"device_files\"|\"off\":\"concat_split_on\"|\"concat_split_off\"",
|
|
|
|
@ -9824,6 +9830,10 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|
|
|
|
" -extract iso_rr_path disk_path",
|
|
|
|
|
" Copy tree under iso_rr_path onto disk address disk_path.",
|
|
|
|
|
" This avoids the pitfalls of cp -r addressing rules.",
|
|
|
|
|
" -extract_l iso_rr_prefix disk_prefix iso_rr_path [***]",
|
|
|
|
|
" Perform -extract_r with each iso_rr_path.",
|
|
|
|
|
" -extract_single iso_rr_path disk_path",
|
|
|
|
|
" Like -extract but with directory do not restore sub tree.",
|
|
|
|
|
" -cpx iso_rr_path [***] disk_path",
|
|
|
|
|
" Copy leaf file objects from ISO image to disk filesystem.",
|
|
|
|
|
" -cpax iso_rr_path [***] disk_path",
|
|
|
|
@ -10319,6 +10329,120 @@ int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Options -map_l , -compare_l , -update_l , -extract_l */
|
|
|
|
|
/* @param flag bit8-11= mode 0= -map_l
|
|
|
|
|
1= -compare_l
|
|
|
|
|
2= -update_l
|
|
|
|
|
3= -extract_l
|
|
|
|
|
*/
|
|
|
|
|
int Xorriso_option_map_l(struct XorrisO *xorriso, int argc, char **argv,
|
|
|
|
|
int *idx, int flag)
|
|
|
|
|
{
|
|
|
|
|
int ret, end_idx, optc= 0, was_failure= 1, i, fret, mode;
|
|
|
|
|
int ns_flag= 2|4, nt_flag= 2;
|
|
|
|
|
char source_prefix[SfileadrL], target_prefix[SfileadrL], *cmd, **optv= NULL;
|
|
|
|
|
char eff_source[SfileadrL], eff_target[SfileadrL], *source_pt, *s_wd, *t_wd;
|
|
|
|
|
char sfe[5*SfileadrL];
|
|
|
|
|
|
|
|
|
|
cmd= "-map_l";
|
|
|
|
|
s_wd= xorriso->wdx;
|
|
|
|
|
t_wd= xorriso->wdi;
|
|
|
|
|
Xorriso_pacifier_reset(xorriso, 0);
|
|
|
|
|
mode= (flag>>8) & 15;
|
|
|
|
|
|
|
|
|
|
if(mode==1)
|
|
|
|
|
cmd= "-compare_l";
|
|
|
|
|
else if(mode==2)
|
|
|
|
|
cmd= "-update_l";
|
|
|
|
|
else if(mode==3) {
|
|
|
|
|
cmd= "-extract_l";
|
|
|
|
|
ns_flag= 2;
|
|
|
|
|
s_wd= xorriso->wdi;
|
|
|
|
|
nt_flag= 2|4;
|
|
|
|
|
t_wd= xorriso->wdx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1|2);
|
|
|
|
|
if(end_idx - (*idx) < 3) {
|
|
|
|
|
sprintf(xorriso->info_text, "%s: Not enough arguments given (%d < 3)", cmd,
|
|
|
|
|
end_idx - (*idx));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1);
|
|
|
|
|
ret= 0; goto ex;
|
|
|
|
|
}
|
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, s_wd, argv[*idx],
|
|
|
|
|
source_prefix, ns_flag);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
goto ex;
|
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, t_wd, argv[(*idx)+1],
|
|
|
|
|
target_prefix, nt_flag);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
goto ex;
|
|
|
|
|
ret= Xorriso_opt_args(xorriso, cmd, argc, argv, (*idx)+2, &end_idx,
|
|
|
|
|
&optc, &optv, 2);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
goto ex;
|
|
|
|
|
|
|
|
|
|
for(i= 0; i<optc; i++) {
|
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, s_wd, optv[i],
|
|
|
|
|
eff_source, ns_flag);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
goto ex;
|
|
|
|
|
strcpy(eff_target, target_prefix);
|
|
|
|
|
source_pt= eff_source;
|
|
|
|
|
if(source_prefix[0]) {
|
|
|
|
|
if(strncmp(source_prefix, eff_source, strlen(source_prefix))!=0) {
|
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
|
"%s: disk_path does not begin with disk_prefix", cmd);
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1);
|
|
|
|
|
ret= 0; goto ex;
|
|
|
|
|
}
|
|
|
|
|
source_pt+= strlen(source_prefix);
|
|
|
|
|
}
|
|
|
|
|
strcat(eff_target, source_pt);
|
|
|
|
|
|
|
|
|
|
#ifdef NIX
|
|
|
|
|
if(1)
|
|
|
|
|
fprintf(stderr, "xorriso_debug: %s %s %s\n", cmd, eff_source, eff_target);
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if(mode==0)
|
|
|
|
|
ret= Xorriso_option_map(xorriso, eff_source, eff_target, 2);
|
|
|
|
|
else if(mode==1)
|
|
|
|
|
ret= Xorriso_option_compare(xorriso, eff_source, eff_target, 2|8);
|
|
|
|
|
else if(mode==2)
|
|
|
|
|
ret= Xorriso_option_update(xorriso, eff_source, eff_target, 2|8);
|
|
|
|
|
else if(mode==2)
|
|
|
|
|
ret= Xorriso_option_extract(xorriso, eff_source, eff_target, 2);
|
|
|
|
|
|
|
|
|
|
if(ret>0 && !xorriso->request_to_abort)
|
|
|
|
|
continue; /* regular bottom of loop */
|
|
|
|
|
was_failure= 1;
|
|
|
|
|
fret= Xorriso_eval_problem_status(xorriso, ret, 2);
|
|
|
|
|
if(fret>=0)
|
|
|
|
|
continue;
|
|
|
|
|
goto ex;
|
|
|
|
|
}
|
|
|
|
|
if(mode==0)
|
|
|
|
|
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
|
|
|
|
|
xorriso->pacifier_total, "", 1);
|
|
|
|
|
else if(mode==1 || mode==2)
|
|
|
|
|
Xorriso_pacifier_callback(xorriso, "content bytes read",
|
|
|
|
|
xorriso->pacifier_count, 0, "", 1);
|
|
|
|
|
else if(mode==3)
|
|
|
|
|
Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count,
|
|
|
|
|
xorriso->pacifier_total, "", 1);
|
|
|
|
|
ret= 1;
|
|
|
|
|
ex:;
|
|
|
|
|
(*idx)= end_idx;
|
|
|
|
|
Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &optc, &optv,
|
|
|
|
|
256);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
return(ret);
|
|
|
|
|
return(!was_failure);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -mark */
|
|
|
|
|
int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag)
|
|
|
|
|
{
|
|
|
|
@ -11737,11 +11861,11 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
|
|
|
|
|
static char argn_commands[][40]= {
|
|
|
|
|
"add","as","chgrp","chgrpi","chgrp_r","chgrp_ri","chmod","chmodi",
|
|
|
|
|
"chmod_r","chmod_ri","chown","chowni","chown_r","chown_ri",
|
|
|
|
|
"cpr","cpri","cp_rax","cp_rx","cpax","cpx",
|
|
|
|
|
"du","dui","dus","dusi","dux","dusx","find","findi","findx",
|
|
|
|
|
"compare_l","cpr","cpri","cp_rax","cp_rx","cpax","cpx",
|
|
|
|
|
"du","dui","dus","dusi","dux","dusx","extract_l","find","findi","findx",
|
|
|
|
|
"ls","lsi","lsl","lsli","lsd","lsdi","lsdl","lsdli",
|
|
|
|
|
"lsx","lslx","lsdx","lsdlx","mv","mvi","mkdir","mkdiri",
|
|
|
|
|
"not_paths","rm","rmi","rm_r","rm_ri","rmdir","rmdiri",
|
|
|
|
|
"lsx","lslx","lsdx","lsdlx","map_l","mv","mvi","mkdir","mkdiri",
|
|
|
|
|
"not_paths","rm","rmi","rm_r","rm_ri","rmdir","rmdiri","update_l",
|
|
|
|
|
""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -11923,6 +12047,9 @@ next_command:;
|
|
|
|
|
(*idx)+= 2;
|
|
|
|
|
ret= Xorriso_option_compare(xorriso, arg1, arg2, 1);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"compare_l")==0) {
|
|
|
|
|
ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 1<<8);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"compare_r")==0) {
|
|
|
|
|
(*idx)+= 2;
|
|
|
|
|
ret= Xorriso_option_compare(xorriso, arg1, arg2, 1|8);
|
|
|
|
@ -11999,6 +12126,9 @@ next_command:;
|
|
|
|
|
(*idx)+= 2;
|
|
|
|
|
ret= Xorriso_option_extract(xorriso, arg1, arg2, 0);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"extract_l")==0) {
|
|
|
|
|
ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 3<<8);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"extract_single")==0) {
|
|
|
|
|
(*idx)+= 2;
|
|
|
|
|
ret= Xorriso_option_extract(xorriso, arg1, arg2, 32);
|
|
|
|
@ -12074,6 +12204,9 @@ next_command:;
|
|
|
|
|
(*idx)+= 2;
|
|
|
|
|
ret= Xorriso_option_map(xorriso, arg1, arg2, 0);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"map_l")==0) {
|
|
|
|
|
ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 0);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"map_single")==0) {
|
|
|
|
|
(*idx)+= 2;
|
|
|
|
|
ret= Xorriso_option_map(xorriso, arg1, arg2, 32);
|
|
|
|
@ -12279,6 +12412,9 @@ next_command:;
|
|
|
|
|
(*idx)+= 2;
|
|
|
|
|
ret= Xorriso_option_update(xorriso, arg1, arg2, 1);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"update_l")==0) {
|
|
|
|
|
ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 2<<8);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"update_r")==0) {
|
|
|
|
|
(*idx)+= 2;
|
|
|
|
|
ret= Xorriso_option_update(xorriso, arg1, arg2, 1|8);
|
|
|
|
|