Implemented reassure for -rollback, -rollback_end, -end, -commit, -commit_eject
This commit is contained in:
parent
aa15bfa557
commit
eec3eaa5e9
@ -2,7 +2,7 @@
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH XORRISO 1 "February 3, 2008"
|
||||
.TH XORRISO 1 "February 5, 2008"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
@ -950,8 +950,8 @@ For images which will never get to a CD it is safe to use -padding 0 .
|
||||
Set the threshold for events to abort the program.
|
||||
Events are classified by severity :
|
||||
.br
|
||||
"NEVER", "ABORT", "FATAL", "SORRY", "WARNING",
|
||||
"HINT", "NOTE", "UPDATE", "DEBUG", "ALL"
|
||||
"NEVER", "ABORT", "FATAL", "FAILURE" , "SORRY",
|
||||
"WARNING", "HINT", "NOTE", "UPDATE", "DEBUG", "ALL"
|
||||
.br
|
||||
Severities "NEVER" and "ALL" do not occur but mark the extreme
|
||||
ends of this potentially expandable range.
|
||||
@ -1002,8 +1002,16 @@ If "on" then use readline for dialog. Else use plain stdin.
|
||||
See also above, paragraph Dialog, Readline, Result pager.
|
||||
.TP
|
||||
\fB\-reassure\fR "on"|"tree"|"off"
|
||||
If "on" then ask the user for "y" or "n"
|
||||
before deleting or overwriting any file in the ISO image.
|
||||
If "on" then ask the user for "y" or "n":
|
||||
.br
|
||||
before deleting or overwriting any file in the ISO image,
|
||||
.br
|
||||
before rolling back pending image changes,
|
||||
.br
|
||||
before committing image changes to media,
|
||||
.br
|
||||
before ending the program.
|
||||
.br
|
||||
With setting "tree" the reassuring prompt will appear for an eventual
|
||||
directory only once and not for each file in its whole subtree.
|
||||
Setting "off" silently kills any kind of image file object.
|
||||
|
@ -5954,6 +5954,35 @@ ex:;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/** @return -1= abort , 0= no , 1= yes
|
||||
*/
|
||||
int Xorriso_reassure(struct XorrisO *xorriso, char *cmd, char *which_will,
|
||||
int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
sprintf(xorriso->info_text, "Really perform %s which will %s ? (y/n)\n",
|
||||
cmd, which_will);
|
||||
Xorriso_info(xorriso, 4);
|
||||
do {
|
||||
ret= Xorriso_request_confirmation(xorriso, 2|4|16);
|
||||
} while(ret==3);
|
||||
if(ret==6 || ret==4) {
|
||||
sprintf(xorriso->info_text, "%s confirmed", cmd);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
return(1);
|
||||
}
|
||||
if(ret==2) {
|
||||
sprintf(xorriso->info_text, "%s aborted", cmd);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
return(-1);
|
||||
}
|
||||
sprintf(xorriso->info_text, "%s revoked", cmd);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------- Options API ------------------------ */
|
||||
|
||||
@ -6502,6 +6531,8 @@ int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag)
|
||||
/* Option -commit */
|
||||
/* @param flag bit0= leave indrive and outdrive aquired as they were,
|
||||
i.e. do not aquire outdrive as new in-out-drive
|
||||
bit1= do not perform eventual -reassure
|
||||
@return <=0 error , 1 success, 2 revoked by -reassure , 3 no change pending
|
||||
*/
|
||||
int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
@ -6509,9 +6540,15 @@ int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
|
||||
char newdev[SfileadrL];
|
||||
|
||||
if(!xorriso->volset_change_pending) {
|
||||
sprintf(xorriso->info_text,"-commit: No image modifications pending");
|
||||
sprintf(xorriso->info_text, "-commit: No image modifications pending");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
return(2);
|
||||
return(3);
|
||||
}
|
||||
if(!(flag&2)) {
|
||||
ret= Xorriso_reassure(xorriso, "-commit",
|
||||
"write the pending image changes to media", 0);
|
||||
if(ret<=0)
|
||||
return(2);
|
||||
}
|
||||
ret= Xorriso_write_session(xorriso, 0);
|
||||
if(ret<=0)
|
||||
@ -6525,13 +6562,15 @@ int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
|
||||
}
|
||||
|
||||
|
||||
/* Option -commit_eject */
|
||||
/* Option -commit_eject */
|
||||
/* @return <=0 error , 1 success, 2 revoked by -reassure
|
||||
*/
|
||||
int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag)
|
||||
{
|
||||
int ret, eret;
|
||||
|
||||
ret= Xorriso_option_commit(xorriso, 1);
|
||||
if(ret<=0)
|
||||
if(ret<=0 || ret==2)
|
||||
return(ret);
|
||||
if(strcmp(which, "none")==0 || strcmp(which, "")==0)
|
||||
eret= 1;
|
||||
@ -6772,10 +6811,29 @@ int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag)
|
||||
|
||||
|
||||
/* Options -end , and -rollback_end */
|
||||
/* @param flag bit0= discard pending changes */
|
||||
/* @param flag bit0= discard pending changes
|
||||
@return <=0 error , 1 success, 2 revoked by -reassure
|
||||
*/
|
||||
int Xorriso_option_end(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret;
|
||||
char *cmd, *which_will;
|
||||
|
||||
if(flag&1)
|
||||
cmd= "-rollback_end";
|
||||
else
|
||||
cmd= "-end";
|
||||
if(xorriso->volset_change_pending) {
|
||||
if(flag&1)
|
||||
which_will= "end the program discarding image changes";
|
||||
else
|
||||
which_will= "commit image changes and then end the program";
|
||||
} else {
|
||||
which_will= "end the program";
|
||||
}
|
||||
ret= Xorriso_reassure(xorriso, cmd, which_will, 0);
|
||||
if(ret<=0)
|
||||
return(2);
|
||||
|
||||
if(xorriso->volset_change_pending) {
|
||||
if(flag&1) {
|
||||
@ -8116,10 +8174,20 @@ ex:;
|
||||
|
||||
|
||||
/* Option -rollback */
|
||||
/* @return <=0 error , 1 success, 2 revoked by -reassure
|
||||
*/
|
||||
int Xorriso_option_rollback(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret;
|
||||
char indev[SfileadrL];
|
||||
char indev[SfileadrL], *which_will;
|
||||
|
||||
if(xorriso->volset_change_pending)
|
||||
which_will= "revoke the pending image changes";
|
||||
else
|
||||
which_will= "reload the image";
|
||||
ret= Xorriso_reassure(xorriso, "-rollback", which_will, 0);
|
||||
if(ret<=0)
|
||||
return(2);
|
||||
|
||||
if(Sfile_str(indev, xorriso->indev, 0)<=0)
|
||||
return(-1);
|
||||
|
@ -202,10 +202,14 @@ int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag);
|
||||
/* Option -commit */
|
||||
/* @param flag bit0= leave indrive and outdrive aquired as they were,
|
||||
i.e. do not aquire outdrive as new in-out-drive
|
||||
bit1= do not perform eventual -reassure
|
||||
@return <=0 error , 1 success, 2 revoked by -reassure
|
||||
*/
|
||||
int Xorriso_option_commit(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* Option -commit_eject */
|
||||
/* @return <=0 error , 1 success, 2 revoked by -reassure
|
||||
*/
|
||||
int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag);
|
||||
|
||||
/* Option -cpr alias -cpri */
|
||||
@ -236,7 +240,9 @@ int Xorriso_option_dummy(struct XorrisO *xorriso, char *mode, int flag);
|
||||
int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag);
|
||||
|
||||
/* Options -end , and -rollback_end */
|
||||
/* @param flag bit0= discard pending changes */
|
||||
/* @param flag bit0= discard pending changes
|
||||
@return <=0 error , 1 success, 2 revoked by -reassure
|
||||
*/
|
||||
int Xorriso_option_end(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* Option -iso_rr_pattern "on"|"ls"|"off" */
|
||||
@ -359,6 +365,8 @@ int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv,
|
||||
int *idx, int flag);
|
||||
|
||||
/* Option -rollback */
|
||||
/* @return <=0 error , 1 success, 2 revoked by -reassure
|
||||
*/
|
||||
int Xorriso_option_rollback(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* Option -speed */
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2008.02.05.162621"
|
||||
#define Xorriso_timestamP "2008.02.05.175733"
|
||||
|
Loading…
Reference in New Issue
Block a user