New -as mkisofs option -file-mode

This commit is contained in:
Thomas Schmitt 2010-06-25 10:22:28 +00:00
parent ad1c2fa1b8
commit 5e8c60713a
2 changed files with 22 additions and 3 deletions

View File

@ -590,6 +590,7 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag)
" -C PARAMS, -cdrecord-params PARAMS", " -C PARAMS, -cdrecord-params PARAMS",
" Magic paramters from cdrecord", " Magic paramters from cdrecord",
" -dir-mode mode Make the mode of all directories this mode.", " -dir-mode mode Make the mode of all directories this mode.",
" -file-mode mode Make the mode of all plain files this mode.",
" -path-list FILE File with list of pathnames to process", " -path-list FILE File with list of pathnames to process",
" --quoted_path_list FILE File with list of quoted pathnames to process", " --quoted_path_list FILE File with list of quoted pathnames to process",
" -print-size Print estimated filesystem size and exit", " -print-size Print estimated filesystem size and exit",
@ -735,7 +736,8 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
{ {
int ret, i, j, was_path= 0, was_other_option= 0, mem_graft_points, mem; int ret, i, j, was_path= 0, was_other_option= 0, mem_graft_points, mem;
int do_print_size= 0, fd, idx, iso_level= 0, no_emul_boot= 0; int do_print_size= 0, fd, idx, iso_level= 0, no_emul_boot= 0;
int option_b= 0, was_failure= 0, fret, lower_r= 0, zero= 0, dir_mode= -1; int option_b= 0, was_failure= 0, fret, lower_r= 0, zero= 0;
int dir_mode= -1, file_mode= -1;
mode_t mode_and, mode_or; mode_t mode_and, mode_or;
int with_boot_image= 0, with_cat_path= 0; int with_boot_image= 0, with_cat_path= 0;
int *weight_list= NULL, weight_count= 0; int *weight_list= NULL, weight_count= 0;
@ -1182,7 +1184,15 @@ not_enough_args:;
if(ret<=0) if(ret<=0)
goto problem_handler_2; goto problem_handler_2;
dir_mode= mode_or; dir_mode= mode_or;
} else if(strcmp(argv[i], "-file-mode") == 0) {
if(i+1>=argc)
goto not_enough_args;
i++;
ret= Xorriso_convert_modstring(xorriso, "-as mkisofs -file-mode",
argv[i], &mode_and, &mode_or, 0);
if(ret<=0)
goto problem_handler_2;
file_mode= mode_or;
} else if(argv[i][0]=='-' && argv[i][1]!=0) { } else if(argv[i][0]=='-' && argv[i][1]!=0) {
sprintf(xorriso->info_text, "-as %s: Unknown option %s", sprintf(xorriso->info_text, "-as %s: Unknown option %s",
whom, Text_shellsafe(argv[i], sfe, 0)); whom, Text_shellsafe(argv[i], sfe, 0));
@ -1252,6 +1262,15 @@ problem_handler_2:;
if(ret<=0) if(ret<=0)
goto ex; goto ex;
} }
if(file_mode >= 0) {
static char *file_mode_args[6]= {"/", "-type", "f", "-exec", "chmod", ""};
zero= 0;
sprintf(sfe, "0%o", (unsigned int) file_mode);
file_mode_args[5]= sfe;
ret= Xorriso_option_find(xorriso, 6, file_mode_args, &zero, 2);
if(ret<=0)
goto ex;
}
for(j= 0; j < weight_count; j++) { for(j= 0; j < weight_count; j++) {
i= weight_list[j]; i= weight_list[j];

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.06.25.095836" #define Xorriso_timestamP "2010.06.25.102140"