New option -assert_volid
This commit is contained in:
parent
071a0c995e
commit
1a0195b25f
@ -2,7 +2,7 @@
|
|||||||
.\" First parameter, NAME, should be all caps
|
.\" First parameter, NAME, should be all caps
|
||||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||||
.\" other parameters are allowed: see man(7), man(1)
|
.\" other parameters are allowed: see man(7), man(1)
|
||||||
.TH XORRISO 1 "Dec 10, 2008"
|
.TH XORRISO 1 "Dec 13, 2008"
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.\" Some roff macros, for reference:
|
.\" Some roff macros, for reference:
|
||||||
@ -561,6 +561,14 @@ until the next -dev or -indev. After the image has been loaded once, the
|
|||||||
setting is valid for -rollback until next -dev or -indev, where it
|
setting is valid for -rollback until next -dev or -indev, where it
|
||||||
will be reset to "auto".
|
will be reset to "auto".
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-assert_volid\fR pattern severity
|
||||||
|
Refuse to load ISO images with volume ids which do not match the given
|
||||||
|
search pattern. When refusing an image, give up the input drive and issue
|
||||||
|
an event of the given severity. An empty search pattern accepts any image.
|
||||||
|
.br
|
||||||
|
This option does not hamper the creation of an empty image from blank
|
||||||
|
input media and does not discard an already loaded image.
|
||||||
|
.TP
|
||||||
\fB\-in_charset\fR character_set_name
|
\fB\-in_charset\fR character_set_name
|
||||||
Set the character set from which to convert file names when loading an
|
Set the character set from which to convert file names when loading an
|
||||||
image. This has eventually to be done before specifying -dev , -indev or
|
image. This has eventually to be done before specifying -dev , -indev or
|
||||||
@ -2834,16 +2842,17 @@ Seconds since Jan 1 1970:
|
|||||||
.B =1194531416
|
.B =1194531416
|
||||||
.SS
|
.SS
|
||||||
.B Incremental backup of a few directory trees
|
.B Incremental backup of a few directory trees
|
||||||
This does the following to directories /open_source_project and /personal_mail
|
This changes the directory trees /open_source_project and /personal_mail
|
||||||
in the ISO image:
|
in the ISO image so that they become exact copies of their disk counterparts.
|
||||||
create them if not existing yet,
|
ISO file objects get created, deleted or get their attributes adjusted
|
||||||
compare them with their disk counterparts,
|
accordingly.
|
||||||
add disk file objects which are missing yet,
|
Files with names matching *.o or *.swp get excluded explicitely.
|
||||||
overwrite those which are different on disk,
|
|
||||||
and delete those which have vanished on disk.
|
|
||||||
But do not add or overwrite files matching *.o, *.swp.
|
|
||||||
.br
|
.br
|
||||||
\fB$\fR xorriso -dev /dev/sr0 \\
|
Only media with the expected volume id or blank media are accepted.
|
||||||
|
.br
|
||||||
|
\fB$\fR xorriso -assert_volid 'PROJECTS_MAIL_*' FATAL \\
|
||||||
|
.br
|
||||||
|
-dev /dev/sr0 \\
|
||||||
.br
|
.br
|
||||||
-volid PROJECTS_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" \\
|
-volid PROJECTS_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" \\
|
||||||
.br
|
.br
|
||||||
|
@ -1745,6 +1745,31 @@ int Sregex_resolve_var(char *form, char *vars[][2], int num_vars,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param flag bit0= only test expression whether compilable
|
||||||
|
*/
|
||||||
|
int Sregex_match(char *pattern, char *text, int flag)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
char re_text[2*SfileadrL];
|
||||||
|
regex_t re;
|
||||||
|
regmatch_t match[1];
|
||||||
|
|
||||||
|
Xorriso__bourne_to_reg(pattern, re_text, 0);
|
||||||
|
ret= regcomp(&re, re_text, 0);
|
||||||
|
if(ret != 0)
|
||||||
|
return(-1);
|
||||||
|
if(flag & 1) {
|
||||||
|
regfree(&re);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
ret= regexec(&re, text, 1, match, 0);
|
||||||
|
regfree(&re);
|
||||||
|
if(ret != 0)
|
||||||
|
return(0);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* Xorriso_sregex_externaL */
|
#endif /* Xorriso_sregex_externaL */
|
||||||
|
|
||||||
|
|
||||||
@ -3805,8 +3830,10 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
|||||||
m->do_global_uid= 0;
|
m->do_global_uid= 0;
|
||||||
m->global_uid= 0;
|
m->global_uid= 0;
|
||||||
strcpy(m->volid, "ISOIMAGE");
|
strcpy(m->volid, "ISOIMAGE");
|
||||||
m->loaded_volid[0]= 0;
|
|
||||||
m->volid_default= 1;
|
m->volid_default= 1;
|
||||||
|
m->loaded_volid[0]= 0;
|
||||||
|
m->assert_volid[0]= 0;
|
||||||
|
m->assert_volid_sev[0]= 0;
|
||||||
m->publisher[0]= 0;
|
m->publisher[0]= 0;
|
||||||
m->application_id[0]= 0;
|
m->application_id[0]= 0;
|
||||||
m->session_logfile[0]= 0;
|
m->session_logfile[0]= 0;
|
||||||
@ -6043,6 +6070,15 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
|||||||
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_default= (xorriso->assert_volid[0] == 0);
|
||||||
|
sprintf(line, "-assert_volid ");
|
||||||
|
Text_shellsafe(xorriso->assert_volid, line, 1);
|
||||||
|
strcat(line, " ");
|
||||||
|
Text_shellsafe(xorriso->assert_volid_sev, line, 1);
|
||||||
|
strcat(line, "\n");
|
||||||
|
if(!(is_default && no_defaults))
|
||||||
|
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||||
|
|
||||||
do_single= 0;
|
do_single= 0;
|
||||||
if(filter != NULL)
|
if(filter != NULL)
|
||||||
if(strncmp(filter, "-indev", 6) == 0 ||
|
if(strncmp(filter, "-indev", 6) == 0 ||
|
||||||
@ -10802,11 +10838,6 @@ int Xorriso_option_application_id(struct XorrisO *xorriso, char *name,
|
|||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NIX
|
|
||||||
Xorriso_set_application_id(xorriso, name, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(Sfile_str(xorriso->application_id,name,0)<=0)
|
if(Sfile_str(xorriso->application_id,name,0)<=0)
|
||||||
return(-1);
|
return(-1);
|
||||||
return(1);
|
return(1);
|
||||||
@ -10864,6 +10895,51 @@ ex:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Option -assert_volid */
|
||||||
|
int Xorriso_option_assert_volid(struct XorrisO *xorriso, char *pattern,
|
||||||
|
char *severity, int flag)
|
||||||
|
{
|
||||||
|
int ret, sev;
|
||||||
|
char *sev_text= "";
|
||||||
|
|
||||||
|
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) {
|
||||||
|
if(strcmp(xorriso->abort_on_text, "NEVER") == 0)
|
||||||
|
sev_text= "ABORT";
|
||||||
|
else
|
||||||
|
sev_text= xorriso->abort_on_text;
|
||||||
|
} else
|
||||||
|
sev_text= severity;
|
||||||
|
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 -backslash_codes */
|
/* Option -backslash_codes */
|
||||||
int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode,
|
int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode,
|
||||||
int flag)
|
int flag)
|
||||||
@ -12876,6 +12952,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
" -rom_toc_scan \"on\"|\"off\"[:\"emul_on\"|\"emul_off\"]",
|
" -rom_toc_scan \"on\"|\"off\"[:\"emul_on\"|\"emul_off\"]",
|
||||||
" Enable scanning for ISO sessions on read-only drives/media",
|
" Enable scanning for ISO sessions on read-only drives/media",
|
||||||
" resp. on overwriteable media with emulated TOC.",
|
" resp. on overwriteable media with emulated TOC.",
|
||||||
|
" -assert_volid pattern severity",
|
||||||
|
" Accept input image only if its volume id matches pattern.",
|
||||||
" -charset name Set the character set name to be used for file name",
|
" -charset name Set the character set name to be used for file name",
|
||||||
" conversion from and to media.",
|
" conversion from and to media.",
|
||||||
" -in_charset name",
|
" -in_charset name",
|
||||||
@ -15373,7 +15451,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
|
|||||||
""
|
""
|
||||||
};
|
};
|
||||||
static char arg2_commands[][40]= {
|
static char arg2_commands[][40]= {
|
||||||
"boot_image","compare","compare_r",
|
"assert_volid","boot_image","compare","compare_r",
|
||||||
"errfile_log","error_behavior","extract","extract_single",
|
"errfile_log","error_behavior","extract","extract_single",
|
||||||
"load","logfile",
|
"load","logfile",
|
||||||
"map","map_single","page","return_with","update","update_r",
|
"map","map_single","page","return_with","update","update_r",
|
||||||
@ -15537,6 +15615,10 @@ next_command:;
|
|||||||
} else if(strcmp(cmd,"as")==0) {
|
} else if(strcmp(cmd,"as")==0) {
|
||||||
ret= Xorriso_option_as(xorriso, argc, argv, idx, 0);
|
ret= Xorriso_option_as(xorriso, argc, argv, idx, 0);
|
||||||
|
|
||||||
|
} else if(strcmp(cmd,"assert_volid")==0) {
|
||||||
|
(*idx)+= 2;
|
||||||
|
ret= Xorriso_option_assert_volid(xorriso, arg1, arg2, 0);
|
||||||
|
|
||||||
} else if(strcmp(cmd,"backslash_codes")==0) {
|
} else if(strcmp(cmd,"backslash_codes")==0) {
|
||||||
(*idx)++;
|
(*idx)++;
|
||||||
ret= Xorriso_option_backslash_codes(xorriso, arg1, 0);
|
ret= Xorriso_option_backslash_codes(xorriso, arg1, 0);
|
||||||
|
@ -293,6 +293,10 @@ int Xorriso_option_application_id(struct XorrisO *xorriso, char *name,
|
|||||||
int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv,
|
int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv,
|
||||||
int *idx, int flag);
|
int *idx, int flag);
|
||||||
|
|
||||||
|
/* Option -assert_volid */
|
||||||
|
int Xorriso_option_assert_volid(struct XorrisO *xorriso, char *pattern,
|
||||||
|
char *severity, int flag);
|
||||||
|
|
||||||
/* Option -backslash_codes */
|
/* Option -backslash_codes */
|
||||||
int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode,
|
int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode,
|
||||||
int flag);
|
int flag);
|
||||||
|
@ -120,6 +120,8 @@ struct XorrisO { /* the global context of xorriso */
|
|||||||
char volid[33];
|
char volid[33];
|
||||||
int volid_default;
|
int volid_default;
|
||||||
char loaded_volid[33];
|
char loaded_volid[33];
|
||||||
|
char assert_volid[SfileadrL];
|
||||||
|
char assert_volid_sev[80];
|
||||||
|
|
||||||
char publisher[129];
|
char publisher[129];
|
||||||
char application_id[129];
|
char application_id[129];
|
||||||
@ -820,5 +822,9 @@ int Sectorbitmap_copy(struct SectorbitmaP *from, struct SectorbitmaP *to,
|
|||||||
/* bit0= append (text!=NULL) */
|
/* bit0= append (text!=NULL) */
|
||||||
int Sregex_string(char **handle, char *text, int flag);
|
int Sregex_string(char **handle, char *text, int flag);
|
||||||
|
|
||||||
|
/* @param flag bit0= only test expression whether compilable
|
||||||
|
*/
|
||||||
|
int Sregex_match(char *pattern, char *text, int flag);
|
||||||
|
|
||||||
#endif /* Xorriso_private_includeD */
|
#endif /* Xorriso_private_includeD */
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2008.12.13.161650"
|
#define Xorriso_timestamP "2008.12.14.093125"
|
||||||
|
@ -469,6 +469,44 @@ int Xorriso_record_boot_info(struct XorrisO *xorriso, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_assert_volid(struct XorrisO *xorriso, int msc1, int flag)
|
||||||
|
{
|
||||||
|
int ret, image_blocks;
|
||||||
|
char volid[33];
|
||||||
|
struct burn_drive_info *dinfo;
|
||||||
|
struct burn_drive *drive;
|
||||||
|
|
||||||
|
if(xorriso->assert_volid[0] == 0)
|
||||||
|
return(1);
|
||||||
|
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||||
|
"on attempt to perform -assert_volid", 0);
|
||||||
|
if(ret<=0)
|
||||||
|
return(0);
|
||||||
|
ret= isoburn_read_iso_head(drive, msc1, &image_blocks, volid, 1);
|
||||||
|
Xorriso_process_msg_queues(xorriso,0);
|
||||||
|
if(ret <= 0) {
|
||||||
|
sprintf(xorriso->info_text,
|
||||||
|
"-assert_volid: Cannot determine Volume Id at LBA %d.", msc1);
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
|
||||||
|
xorriso->assert_volid_sev, 0);
|
||||||
|
}
|
||||||
|
ret= Sregex_match(xorriso->assert_volid, volid, 0);
|
||||||
|
if(ret < 0)
|
||||||
|
return(2);
|
||||||
|
if(ret == 0) {
|
||||||
|
strcpy(xorriso->info_text,
|
||||||
|
"-assert_volid: Volume id does not match pattern: ");
|
||||||
|
Text_shellsafe(xorriso->assert_volid, xorriso->info_text, 1);
|
||||||
|
strcat(xorriso->info_text, " <> ");
|
||||||
|
Text_shellsafe(xorriso->loaded_volid, xorriso->info_text, 1);
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
|
||||||
|
xorriso->assert_volid_sev, 0);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* @param flag bit0= aquire as isoburn input drive
|
/* @param flag bit0= aquire as isoburn input drive
|
||||||
bit1= aquire as libburn output drive (as isoburn drive if bit0)
|
bit1= aquire as libburn output drive (as isoburn drive if bit0)
|
||||||
bit2= regard overwriteable media as blank
|
bit2= regard overwriteable media as blank
|
||||||
@ -647,6 +685,9 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
|||||||
"Loading ISO image tree from LBA %d", load_lba);
|
"Loading ISO image tree from LBA %d", load_lba);
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||||
}
|
}
|
||||||
|
ret= Xorriso_assert_volid(xorriso, load_lba, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <<< */
|
/* <<< */
|
||||||
@ -711,18 +752,6 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
|||||||
if(!(flag&32)) {
|
if(!(flag&32)) {
|
||||||
Xorriso_toc(xorriso, 1 | 8);
|
Xorriso_toc(xorriso, 1 | 8);
|
||||||
if(xorriso->loaded_volid[0]!=0) {
|
if(xorriso->loaded_volid[0]!=0) {
|
||||||
|
|
||||||
#ifdef NIX
|
|
||||||
sprintf(xorriso->result_line,"Volume id : '%s'\n",
|
|
||||||
xorriso->loaded_volid);
|
|
||||||
Xorriso_result(xorriso,0);
|
|
||||||
if(strcmp(xorriso->loaded_volid, xorriso->volid)!=0 &&
|
|
||||||
!xorriso->volid_default) {
|
|
||||||
sprintf(xorriso->result_line, "New volume id: '%s'\n", xorriso->volid);
|
|
||||||
Xorriso_result(xorriso,0);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
sprintf(xorriso->info_text,"Volume id : '%s'\n",
|
sprintf(xorriso->info_text,"Volume id : '%s'\n",
|
||||||
xorriso->loaded_volid);
|
xorriso->loaded_volid);
|
||||||
Xorriso_info(xorriso, 0);
|
Xorriso_info(xorriso, 0);
|
||||||
@ -731,9 +760,6 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
|||||||
sprintf(xorriso->info_text, "New volume id: '%s'\n", xorriso->volid);
|
sprintf(xorriso->info_text, "New volume id: '%s'\n", xorriso->volid);
|
||||||
Xorriso_info(xorriso, 0);
|
Xorriso_info(xorriso, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ! NIX */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret= 1+not_writeable;
|
ret= 1+not_writeable;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user