New -osirrox option auto_chmod_on
This commit is contained in:
parent
bad48be6a9
commit
883551a41e
@ -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 "Jun, 14, 2008"
|
.TH XORRISO 1 "Jun, 20, 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:
|
||||||
@ -1627,7 +1627,7 @@ If disk file objects already exist then the settings of -overwrite and
|
|||||||
of -overwrite "nondir". I.e. directories cannot be deleted.
|
of -overwrite "nondir". I.e. directories cannot be deleted.
|
||||||
.br
|
.br
|
||||||
Access permissions of files in the ISO image do not restrict restoring.
|
Access permissions of files in the ISO image do not restrict restoring.
|
||||||
The permissions on disk have to allow writing, of course.
|
The directory permissions on disk have to allow rwx.
|
||||||
.TP
|
.TP
|
||||||
\fB\-osirrox\fR "on"|"device_files"|"off"[:option:...]
|
\fB\-osirrox\fR "on"|"device_files"|"off"[:option:...]
|
||||||
Setting "off" disables disk filesystem manipulations. This is the default
|
Setting "off" disables disk filesystem manipulations. This is the default
|
||||||
@ -1647,10 +1647,13 @@ restored.
|
|||||||
.br
|
.br
|
||||||
Option "concat_split_on" is default. It enables restoring of split file
|
Option "concat_split_on" is default. It enables restoring of split file
|
||||||
directories as data files if the directory contains a complete collection
|
directories as data files if the directory contains a complete collection
|
||||||
of -cut_out part files.
|
of -cut_out part files. With option "concat_split_off" such directories are
|
||||||
.br
|
|
||||||
With option "concat_split_off" such directories are
|
|
||||||
handled like any other ISO image directory.
|
handled like any other ISO image directory.
|
||||||
|
.br
|
||||||
|
Option "auto_chmod_off" is default. If "auto_chmod_on" is set then access
|
||||||
|
restrictions for disk directories get circumvented if those directories
|
||||||
|
are owned by the effective user who runs xorriso. This happens by temporarily
|
||||||
|
granting rwx permission to the owner. It will not work with ACL restrictions.
|
||||||
.TP
|
.TP
|
||||||
\fB\-extract\fR iso_rr_path disk_path
|
\fB\-extract\fR iso_rr_path disk_path
|
||||||
Restore the file objects at and underneath iso_rr_path to their corresponding
|
Restore the file objects at and underneath iso_rr_path to their corresponding
|
||||||
@ -1927,6 +1930,8 @@ Adjust thresholds for verbosity, exit value and program abort
|
|||||||
Examples of input timestrings
|
Examples of input timestrings
|
||||||
.br
|
.br
|
||||||
Incremental backup of a few directory trees
|
Incremental backup of a few directory trees
|
||||||
|
.br
|
||||||
|
Restore directory trees from a particular ISO session to disk
|
||||||
.SS
|
.SS
|
||||||
.B As superuser learn about available drives
|
.B As superuser learn about available drives
|
||||||
Consider to give rw permissions to those users or groups
|
Consider to give rw permissions to those users or groups
|
||||||
@ -2152,25 +2157,12 @@ on media and if the expected changes are much smaller than the full backup.
|
|||||||
An update run will probably save no time but last longer than a full backup.
|
An update run will probably save no time but last longer than a full backup.
|
||||||
Another good reason may be given if read speed is much higher than write speed.
|
Another good reason may be given if read speed is much higher than write speed.
|
||||||
.br
|
.br
|
||||||
.br
|
|
||||||
With \fBmount\fR option \fB"sbsector="\fR it is possible to access the session
|
With \fBmount\fR option \fB"sbsector="\fR it is possible to access the session
|
||||||
trees which represent the older backup versions. With CD media, Linux mount
|
trees which represent the older backup versions. With CD media, Linux mount
|
||||||
accepts session numbers directly by its option "session=".
|
accepts session numbers directly by its option "session=".
|
||||||
.br
|
.br
|
||||||
Multi-session media and most overwriteable media written by xorriso can tell
|
Multi-session media and most overwriteable media written by xorriso can tell
|
||||||
the sbsector of a session by xorriso option -toc.
|
the sbsector of a session by xorriso option -toc.
|
||||||
Another way to keep track of incremental sessions is to
|
|
||||||
set before writing a suitable path for xorriso option -session_log where
|
|
||||||
the sbsector number gets recorded as the second word in each line.
|
|
||||||
.br
|
|
||||||
Independently of mount there is xorriso option \fB-osirrox on\fR which enables
|
|
||||||
the builtin restore commands -extract, -cpx and others. They operate on the
|
|
||||||
session eventually selected by option \fB-load\fR.
|
|
||||||
.br
|
|
||||||
\fBDo not write more than about 50 sessions\fR to one multi-session media.
|
|
||||||
Theoretical limits are higher but in practice the media deteriorate more early.
|
|
||||||
It might also be that your operating system has a session limit with mount.
|
|
||||||
An overview of sessions is given by option -toc.
|
|
||||||
.br
|
.br
|
||||||
Sessions on multi-session media are separated by several MB of unused blocks.
|
Sessions on multi-session media are separated by several MB of unused blocks.
|
||||||
So with small sessions the payload capacity can become substantially lower
|
So with small sessions the payload capacity can become substantially lower
|
||||||
@ -2184,15 +2176,32 @@ get endangered by the new write operation, while the newest backup is
|
|||||||
stored safely on a different media.
|
stored safely on a different media.
|
||||||
Always have a blank media ready to perform a full backup in case the update
|
Always have a blank media ready to perform a full backup in case the update
|
||||||
attempt fails due to insufficient remaining capacity.
|
attempt fails due to insufficient remaining capacity.
|
||||||
.br
|
.SS
|
||||||
If you have enough re-useable media for a round-robin scheme then better do
|
.B Restore directory trees from a particular ISO session to disk
|
||||||
full backups with blank media each time. Blanking can be achieved by
|
This is an alternative to mounting the media and using normal file operations.
|
||||||
either a separate run:
|
|
||||||
.br
|
.br
|
||||||
\fB$\fR xorriso -outdev /dev/sr0 -blank as_needed -eject all
|
First check which backup sessions are on the media:
|
||||||
.br
|
.br
|
||||||
or in the update run by using option -blank "as_needed" before
|
\fB$\fR xorriso -outdev /dev/sr0 -toc
|
||||||
option -update_r.
|
.br
|
||||||
|
Then load the desired session and copy the file trees to disk.
|
||||||
|
Avoid to eventually create /home/thomas/restored without rwx-permission.
|
||||||
|
.br
|
||||||
|
\fB$\fR xorriso -load volid PROJECTS_MAIL_2008_06_19_205956 \\
|
||||||
|
.br
|
||||||
|
-indev /dev/sr0 \\
|
||||||
|
.br
|
||||||
|
-osirrox on:auto_chmod_on \\
|
||||||
|
.br
|
||||||
|
-chmod u+rwx / \\
|
||||||
|
.br
|
||||||
|
-extract /open_source_projects \\
|
||||||
|
.br
|
||||||
|
/home/thomas/restored/open_source_projects \\
|
||||||
|
.br
|
||||||
|
-extract /personal_mail /home/thomas/restored/personal_mail
|
||||||
|
.br
|
||||||
|
-rollback_end
|
||||||
.br
|
.br
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.SS
|
.SS
|
||||||
|
@ -2835,6 +2835,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
|||||||
m->allow_graft_points= 0;
|
m->allow_graft_points= 0;
|
||||||
m->allow_restore= 0;
|
m->allow_restore= 0;
|
||||||
m->do_concat_split= 1;
|
m->do_concat_split= 1;
|
||||||
|
m->do_auto_chmod= 0;
|
||||||
m->dialog= 0;
|
m->dialog= 0;
|
||||||
m->search_mode= 0;
|
m->search_mode= 0;
|
||||||
m->structured_search= 1;
|
m->structured_search= 1;
|
||||||
@ -3942,11 +3943,14 @@ 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->allow_restore==0 && xorriso->do_concat_split==1);
|
is_default= (xorriso->allow_restore==0 && xorriso->do_concat_split==1 &&
|
||||||
sprintf(line,"-osirrox %s:%s\n",
|
xorriso->do_auto_chmod==0);
|
||||||
|
sprintf(line,"-osirrox %s:%s:%s\n",
|
||||||
xorriso->allow_restore ? xorriso->allow_restore==2 ?
|
xorriso->allow_restore ? xorriso->allow_restore==2 ?
|
||||||
"device_files" : "on" : "off",
|
"device_files" : "on" : "off",
|
||||||
xorriso->do_concat_split ? "concat_split_on" : "concat_split_off");
|
xorriso->do_concat_split ? "concat_split_on" : "concat_split_off",
|
||||||
|
xorriso->do_auto_chmod ? "auto_chmod_on" : "auto_chmod_off"
|
||||||
|
);
|
||||||
|
|
||||||
if(!(is_default && no_defaults))
|
if(!(is_default && no_defaults))
|
||||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||||
@ -7897,6 +7901,54 @@ int Xorriso_make_tmp_path(struct XorrisO *xorriso, char *orig_path,
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_auto_chmod(struct XorrisO *xorriso, char *disk_path, int flag)
|
||||||
|
{
|
||||||
|
int ret, is_link= 0;
|
||||||
|
char *path_pt, sfe[5*SfileadrL], link_target[SfileadrL];
|
||||||
|
mode_t mode, desired= S_IRUSR | S_IWUSR | S_IXUSR;
|
||||||
|
struct stat stbuf;
|
||||||
|
|
||||||
|
if(!xorriso->do_auto_chmod)
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
path_pt= disk_path;
|
||||||
|
ret= lstat(path_pt, &stbuf);
|
||||||
|
if(ret==-1)
|
||||||
|
return(0);
|
||||||
|
if(S_ISLNK(stbuf.st_mode)) {
|
||||||
|
is_link= 1;
|
||||||
|
ret= stat(path_pt, &stbuf);
|
||||||
|
if(ret==-1)
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if(!S_ISDIR(stbuf.st_mode))
|
||||||
|
return(0);
|
||||||
|
if(is_link) {
|
||||||
|
ret= Xorriso_resolve_link(xorriso, path_pt, link_target, 0);
|
||||||
|
if(ret<=0)
|
||||||
|
return(ret);
|
||||||
|
path_pt= link_target;
|
||||||
|
}
|
||||||
|
if(stbuf.st_uid!=geteuid())
|
||||||
|
return(0);
|
||||||
|
if((stbuf.st_mode & desired) == desired)
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
mode= (stbuf.st_mode | desired) & 07777;
|
||||||
|
ret= chmod(path_pt, mode);
|
||||||
|
if(ret==-1) {
|
||||||
|
sprintf(xorriso->info_text,
|
||||||
|
"Cannot change access permissions of disk directory: chmod %o %s",
|
||||||
|
mode & 07777, Text_shellsafe(path_pt, sfe, 0));
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0);
|
||||||
|
}
|
||||||
|
ret= Permstack_push(&(xorriso->perm_stack), path_pt, &stbuf, 0);
|
||||||
|
if(ret<=0)
|
||||||
|
return(ret);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------- Options API ------------------------ */
|
/* ---------------------------- Options API ------------------------ */
|
||||||
|
|
||||||
@ -10884,6 +10936,10 @@ int Xorriso_option_osirrox(struct XorrisO *xorriso, char *mode, int flag)
|
|||||||
xorriso->do_concat_split= 1;
|
xorriso->do_concat_split= 1;
|
||||||
else if(strncmp(cpt, "concat_split_off", l)==0)
|
else if(strncmp(cpt, "concat_split_off", l)==0)
|
||||||
xorriso->do_concat_split= 0;
|
xorriso->do_concat_split= 0;
|
||||||
|
else if(strncmp(cpt, "auto_chmod_on", l)==0)
|
||||||
|
xorriso->do_auto_chmod= 1;
|
||||||
|
else if(strncmp(cpt, "auto_chmod_off", l)==0)
|
||||||
|
xorriso->do_auto_chmod= 0;
|
||||||
else {
|
else {
|
||||||
unknown_mode:;
|
unknown_mode:;
|
||||||
sprintf(xorriso->info_text, "-osirrox: unknown mode '%s'", cpt);
|
sprintf(xorriso->info_text, "-osirrox: unknown mode '%s'", cpt);
|
||||||
@ -10892,7 +10948,7 @@ unknown_mode:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
"%s copying of file objects from ISO image to disk filesystem\n",
|
"Copying of file objects from ISO image to disk filesystem is: %s\n",
|
||||||
xorriso->allow_restore ? "Enabled" : "Disabled");
|
xorriso->allow_restore ? "Enabled" : "Disabled");
|
||||||
Xorriso_info(xorriso, 0);
|
Xorriso_info(xorriso, 0);
|
||||||
return(1);
|
return(1);
|
||||||
|
@ -164,6 +164,9 @@ struct XorrisO { /* the global context of xorriso */
|
|||||||
int do_concat_split; /* 1= restore complete split file directories as
|
int do_concat_split; /* 1= restore complete split file directories as
|
||||||
regular files
|
regular files
|
||||||
*/
|
*/
|
||||||
|
int do_auto_chmod; /* 1= eventually temporarily open access permissions
|
||||||
|
of self-owned directories during restore
|
||||||
|
*/
|
||||||
|
|
||||||
int dialog;
|
int dialog;
|
||||||
|
|
||||||
@ -428,6 +431,9 @@ int Xorriso_make_tmp_path(struct XorrisO *xorriso, char *orig_path,
|
|||||||
int Xorriso_reassure_restore(struct XorrisO *xorriso, char *path, int flag);
|
int Xorriso_reassure_restore(struct XorrisO *xorriso, char *path, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_auto_chmod(struct XorrisO *xorriso, char *disk_path, int flag);
|
||||||
|
|
||||||
|
|
||||||
int Sfile_str(char target[SfileadrL], char *source, int flag);
|
int Sfile_str(char target[SfileadrL], char *source, int flag);
|
||||||
|
|
||||||
double Sfile_microtime(int flag);
|
double Sfile_microtime(int flag);
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2008.06.19.092858"
|
#define Xorriso_timestamP "2008.06.20.091647"
|
||||||
|
@ -3047,9 +3047,7 @@ much_too_long:;
|
|||||||
goto was_problem;
|
goto was_problem;
|
||||||
|
|
||||||
if(stbuf_ret!=-1) { /* (Can only happen with directory) */
|
if(stbuf_ret!=-1) { /* (Can only happen with directory) */
|
||||||
|
Xorriso_auto_chmod(xorriso, disk_path, 0);
|
||||||
/* ??? >>> eventually open access to existing directory ? */;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
hflag= 4 | (flag & (2|64));
|
hflag= 4 | (flag & (2|64));
|
||||||
if(source_is_dir && !do_not_dive)
|
if(source_is_dir && !do_not_dive)
|
||||||
@ -3237,9 +3235,7 @@ int Xorriso_restore(struct XorrisO *xorriso,
|
|||||||
}
|
}
|
||||||
new_dir_made= 1;
|
new_dir_made= 1;
|
||||||
} else if(source_is_dir && !source_is_split) {
|
} else if(source_is_dir && !source_is_split) {
|
||||||
|
Xorriso_auto_chmod(xorriso, disk_path, 0);
|
||||||
/* >>> If owner: eventually try to obtain rwx-permssions, stack path */;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(done) {
|
if(done) {
|
||||||
attach_source:;
|
attach_source:;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user