New (yet inofficial) -as mkisofs options -hfs-bless and -hfs-bless-by

This commit is contained in:
Thomas Schmitt 2012-05-25 19:01:39 +00:00
parent eda78234a6
commit 059d891b39
4 changed files with 108 additions and 10 deletions

View File

@ -612,7 +612,7 @@ int Xorriso_genisofs_count_args(struct XorrisO *xorriso, int argc, char **argv,
"" ""
}; };
static char arg2_options[][41]= { static char arg2_options[][41]= {
"--scdbackup_tag", "--sort-weight", "-hfs-bless-by", "--scdbackup_tag", "--sort-weight",
"" ""
}; };
static char arg3_options[][41]= { static char arg3_options[][41]= {
@ -733,7 +733,10 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag)
" -hide-hfsplus-list FILE File with list of HFS+ files to hide", " -hide-hfsplus-list FILE File with list of HFS+ files to hide",
" -hfsplus Generate HFS+ filesystem", " -hfsplus Generate HFS+ filesystem",
" -hfsplus-file-creator-type CREATOR TYPE iso_rr_path", " -hfsplus-file-creator-type CREATOR TYPE iso_rr_path",
" Attach creator and type to a File.", " Attach creator and type to a File",
" -hfs-bless FOLDER_NAME Name of Folder to be blessed",
" -hfs-bless-by BLESS_TYPE ISO_RR_PATH",
" Bless ISO_RR_PATH by BLESS_TYPE {p,i,s,9,x}",
#endif #endif
@ -1080,7 +1083,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
int do_print_size= 0, fd, idx, iso_level= 1, emul_boot= 2; int do_print_size= 0, fd, idx, iso_level= 1, emul_boot= 2;
int option_b= 0, was_failure= 0, fret, lower_r= 0, zero= 0; int option_b= 0, was_failure= 0, fret, lower_r= 0, zero= 0;
int dir_mode= -1, file_mode= -1, count, partition_number, allow_dir_id_ext= 1; int dir_mode= -1, file_mode= -1, count, partition_number, allow_dir_id_ext= 1;
int root_seen= 0, do_md5_mem, option_d= 0; int root_seen= 0, do_md5_mem, option_d= 0, arg_count;
mode_t mode_and, mode_or; mode_t mode_and, mode_or;
int with_boot_image= 0, with_cat_path= 0, with_emul_toc= 0; int with_boot_image= 0, with_cat_path= 0, with_emul_toc= 0;
int old_root_md5= 1, old_root_dev= 0, old_root_ino= 1; int old_root_md5= 1, old_root_dev= 0, old_root_ino= 1;
@ -1506,17 +1509,23 @@ illegal_c:;
} else if(strcmp(argpt, "-joliet-long")==0) { } else if(strcmp(argpt, "-joliet-long")==0) {
Xorriso_relax_compliance(xorriso, Xorriso_relax_compliance(xorriso,
"joliet_long_paths:joliet_long_names", 0); "joliet_long_paths:joliet_long_names", 0);
} else if(strcmp(argpt, "-hfsplus") == 0) { } else if(strcmp(argpt, "-hfs-bless") == 0 ||
xorriso->do_hfsplus= 1; strcmp(argpt, "-hfs-bless-by") == 0 ||
} else if(strcmp(argpt, "-hfsplus-file-creator-type") == 0) { strcmp(argpt, "-hfsplus-file-creator-type") == 0) {
if(i + 3 >= argc) arg_count= 1;
if(strcmp(argpt, "-hfs-bless-by") == 0)
arg_count= 2;
else if(strcmp(argpt, "-hfsplus-file-creator-type") == 0)
arg_count= 3;
if(i + arg_count >= argc)
goto not_enough_args; goto not_enough_args;
/* Memorize command until all pathspecs are processed */ /* Memorize command until all pathspecs are processed */
delay_opt_list[delay_opt_count++]= i; delay_opt_list[delay_opt_count++]= i;
if(argv[i] != argpt) if(argv[i] != argpt)
delay_opt_list[delay_opt_count - 1]|= 1<<31; delay_opt_list[delay_opt_count - 1]|= 1<<31;
i+= 3; i+= arg_count;
} else if(strcmp(argpt, "-hfsplus") == 0) {
xorriso->do_hfsplus= 1;
} else if(strcmp(argpt, "-graft-points")==0) { } else if(strcmp(argpt, "-graft-points")==0) {
xorriso->allow_graft_points= 1; xorriso->allow_graft_points= 1;
} else if(strcmp(argpt, "-path-list")==0 || } else if(strcmp(argpt, "-path-list")==0 ||
@ -2210,6 +2219,16 @@ problem_handler_2:;
if(ret <= 0) if(ret <= 0)
goto problem_handler_boot; goto problem_handler_boot;
} else if(strcmp(argpt, "-hfs-bless") == 0) {
ret= Xorriso_hfsplus_bless(xorriso, argv[i + 1], NULL, "ppc_bootdir", 0);
if(ret <= 0)
goto problem_handler_boot;
} else if(strcmp(argpt, "-hfs-bless-by") == 0) {
ret= Xorriso_hfsplus_bless(xorriso, argv[i + 2], NULL, argv[i + 1], 0);
if(ret <= 0)
goto problem_handler_boot;
} else if(strcmp(argpt, "-hfsplus-file-creator-type") == 0) { } else if(strcmp(argpt, "-hfsplus-file-creator-type") == 0) {
ret= Xorriso_hfsplus_file_creator_type(xorriso, argv[i + 3], NULL, ret= Xorriso_hfsplus_file_creator_type(xorriso, argv[i + 3], NULL,
argv[i + 1], argv[i + 2], 0); argv[i + 1], argv[i + 2], 0);

View File

@ -3518,3 +3518,79 @@ failure:
return(0); return(0);
} }
/*
@param node
If node is NULL and path is empty, then the blessing will be
revoked from any node which bears it.
@param flag
Bitfield for control purposes.
bit0= Revoke blessing if node != NULL bears it.
bit1= Revoke any blessing of the node, regardless of parameter
blessing. If node is NULL, then revoke all blessings in opts.
*/
int Xorriso_hfsplus_bless(struct XorrisO *xorriso, char *path,
void *in_node, char *blessing, int flag)
{
int ret;
IsoNode *node;
IsoImage *volume= NULL;
enum IsoHfsplusBlessings bless_code = ISO_HFSPLUS_BLESS_MAX; /* = invalid */
if(in_node == NULL && path[0]) {
ret= Xorriso_node_from_path(xorriso, NULL, path, &node, 0);
if(ret <= 0)
return(ret);
} else
node= (IsoNode *) in_node;
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret <= 0)
return(ret);
if(strcmp(blessing, "ppc_bootdir") == 0 ||
strcmp(blessing, "p") == 0 || strcmp(blessing, "P") == 0)
bless_code= ISO_HFSPLUS_BLESS_PPC_BOOTDIR;
else if(strcmp(blessing, "intel_bootfile") == 0 ||
strcmp(blessing, "i") == 0 || strcmp(blessing, "I") == 0)
bless_code= ISO_HFSPLUS_BLESS_INTEL_BOOTFILE;
else if(strcmp(blessing, "show_folder") == 0 ||
strcmp(blessing, "s") == 0 || strcmp(blessing, "S") == 0)
bless_code= ISO_HFSPLUS_BLESS_SHOWFOLDER;
else if(strcmp(blessing, "os9_folder") == 0 ||
strcmp(blessing, "9") == 0)
bless_code= ISO_HFSPLUS_BLESS_OS9_FOLDER;
else if(strcmp(blessing, "osx_folder") == 0 ||
strcmp(blessing, "x") == 0 || strcmp(blessing, "X") == 0)
bless_code= ISO_HFSPLUS_BLESS_OSX_FOLDER;
else {
sprintf(xorriso->info_text, "Unknown blessing type ");
Text_shellsafe(blessing, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
ret= iso_image_hfsplus_bless(volume, bless_code, node, flag & 3);
Xorriso_process_msg_queues(xorriso, 0);
if(ret == 0 && path[0]) {
if((flag & 3)) {
sprintf(xorriso->info_text,
"Attempt to revoke blessing of unblessed file");
} else {
sprintf(xorriso->info_text,
"Multiple blessing to same file or inappropriate file type");
}
if(path[0]) {
strcat(xorriso->info_text, ": ");
Text_shellsafe(path, xorriso->info_text, 1);
}
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
} else if (ret < 0) {
Xorriso_report_iso_error(xorriso, "", ret,
"Error when trying to bless a file",
0, "FAILURE", 1);
return(0);
}
Xorriso_set_change_pending(xorriso, 0);
return(1);
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2012.05.25.084641" #define Xorriso_timestamP "2012.05.25.190220"

View File

@ -602,5 +602,8 @@ int Xorriso_hfsplus_file_creator_type(struct XorrisO *xorriso, char *path,
void *in_node, void *in_node,
char *creator, char *hfs_type, int flag); char *creator, char *hfs_type, int flag);
int Xorriso_hfsplus_bless(struct XorrisO *xorriso, char *path,
void *in_node, char *blessing, int flag);
#endif /* Xorrisoburn_includeD */ #endif /* Xorrisoburn_includeD */