From cee91f485940763e6b8ac783e9b3558681318fa9 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 15 May 2008 15:00:39 +0000 Subject: [PATCH] New options -map and -map_single --- libisoburn/trunk/xorriso/xorriso.1 | 107 ++++++++++--------- libisoburn/trunk/xorriso/xorriso.c | 60 ++++++++++- libisoburn/trunk/xorriso/xorriso.h | 7 ++ libisoburn/trunk/xorriso/xorriso_eng.html | 3 +- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 11 +- 6 files changed, 130 insertions(+), 60 deletions(-) diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index 386ebe8a..96080d03 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -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 "May, 13, 2008" +.TH XORRISO 1 "May, 15, 2008" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -166,10 +166,10 @@ capabilities. suitable for xorriso. .br Blank is the state of newly purchased optical media. -With used CD-RW and DVD-RW it can be achieved by action -blank "fast". +With used CD-RW and DVD-RW it can be achieved by action -blank "as_needed". Overwriteable media are considered blank unless they contain an ISO image -suitable for xorriso. Action -blank "fast" can be used to invalidate the image -on overwriteable media. +suitable for xorriso. Action -blank "as_needed" can be used to invalidate the +image on overwriteable media, or to apply eventual mandatory formatting. .br \fBAppendable\fR media accept further sessions. Either they are MMC multi-session media in appendable state, or they are overwriteable media @@ -599,22 +599,12 @@ Like -add but read the parameter words from file disk_path or standard input if disk_path is "-". The list must contain exactly one pathspec resp. disk_path pattern per line. .TP -\fB\-cpr\fR disk_path [***] iso_rr_path -Insert the given files or directory trees from filesystem -into the ISO image. -.br -The rules for generating the ISO addresses are similar as with -shell command cp -r. Nevertheless, directories of the iso_rr_path -are created if necessary. Especially a not yet existing iso_rr_path -will be handled as directory if multiple disk_paths are present. -The leafnames of the multiple disk_paths will be grafted under that -directory as would be done with an existing directory. -.br -If a single disk_path is present then a non-existing iso_rr_path will -get the same type as the disk_path. -.br -If a disk_path does not begin with '/' then -cdx is prepended. -If the iso_rr_path does not begin with '/' then -cd is prepended. +\fB\-map\fR disk_path iso_rr_path +Insert file object disk_path into the ISO image as iso_rr_path. If disk_path +is a directory then its whole sub tree is inserted into the ISO image. +.TP +\fB\-map_single\fR disk_path iso_rr_path +Like -map, but if disk_path is a directory then its sub tree is not inserted. .TP \fB\-update\fR disk_path iso_rr_path Compare file object disk_path with file object iso_rr_path. If they do not @@ -623,6 +613,10 @@ a matching copy of disk_path. This comparison will imply lengthy content reading before a decision is made. On the other hand it strives for the smallest possible amount of add-on data which is needed to achieve the matching copy. +.br +If disk_path is a directory and iso_rr_path does not exist yet, then the +whole subtree will be inserted. Else only directory attributes will be +updated. .TP \fB\-update_r\fR disk_path iso_rr_path Like -update but working recursively. I.e. all file objects below both @@ -692,6 +686,23 @@ to the directory if it already contains all parts of the old disk file. If not all parts are present, then only those present parts will be updated. .TP +\fB\-cpr\fR disk_path [***] iso_rr_path +Insert the given files or directory trees from filesystem +into the ISO image. +.br +The rules for generating the ISO addresses are similar as with +shell command cp -r. Nevertheless, directories of the iso_rr_path +are created if necessary. Especially a not yet existing iso_rr_path +will be handled as directory if multiple disk_paths are present. +The leafnames of the multiple disk_paths will be grafted under that +directory as would be done with an existing directory. +.br +If a single disk_path is present then a non-existing iso_rr_path will +get the same type as the disk_path. +.br +If a disk_path does not begin with '/' then -cdx is prepended. +If the iso_rr_path does not begin with '/' then -cd is prepended. +.TP \fB\-rm\fR iso_rr_path [***] Delete the given files from the ISO image. .br @@ -1427,7 +1438,7 @@ who is able to see all drives. .br Drives which are occupied by other processes get not shown. .TP -\fB\-print-size\fR +\fB\-print_size\fR Print the foreseeable consumption of 2048 byte blocks by next -commit. This can last a while as a -commit gets prepared and only in last moment is revoked by this option. @@ -1820,19 +1831,15 @@ Re-add some wanted stuff. Because no -dialog "on" is given, the program will then end by committing the session to media. .br +\fB$\fR cd /home/me +.br \fB$\fR xorriso -outdev /dev/sr2 \\ .br - -blank fast \\ + -blank as_needed \\ .br - -pathspecs on \\ + -map /home/me/sounds /sounds \\ .br - -add \\ -.br - /sounds=/home/me/sounds \\ -.br - /pictures \\ -.br - -- \\ + -map /home/me/pictures /pictures \\ .br -rm_r \\ .br @@ -1844,12 +1851,12 @@ session to media. .br -- \\ .br - -add \\ + -cd / \\ .br - /pictures/confidential/work* + -add pictures/confidential/work* .br Note that '/pictures/*private*' is a pattern for iso_rr_paths -while /pictures/confidential/work* gets expanded by the shell +while pictures/confidential/work* gets expanded by the shell with addresses from the hard disk. .SS .B A dialog session doing about the same @@ -1864,7 +1871,7 @@ made ready for being overwritten and the loaded ISO image is made empty. In order to be able to eject the media, the session needs to be committed explicitely. .br -.B $ xorriso -pathspecs on -dialog on -page 20 80 +.B $ xorriso -dialog on -page 20 80 -disk_pattern on .br enter option and arguments : .br @@ -1872,11 +1879,11 @@ enter option and arguments : .br enter option and arguments : .br -.B \-blank fast +.B \-blank as_needed .br enter option and arguments : .br -.B \-add /sounds=/home/me/sounds /pictures +.B \-map /home/me/sounds /sounds -map /home/me/pictures /pictures .br enter option and arguments : .br @@ -1884,7 +1891,11 @@ enter option and arguments : .br enter option and arguments : .br -.B \-add /pictures/confidential/office /pictures/confidential/factory +.B \-cdx /home/me/pictures -cd /pictures +.br +enter option and arguments : +.br +.B \-add confidential/office confidential/factory .br enter option and arguments : .br @@ -1916,15 +1927,9 @@ Add new directory trees /sounds and /movies. Burn to the same media and eject. .br -chmod go-rwx /pictures/restricted -- \\ .br - -pathsspecs on \\ + -map /home/me/prepared_for_dvd/sounds_dummy /sounds \\ .br - -add \\ -.br - /sounds=/home/me/prepared_for_dvd/sounds_dummy \\ -.br - /movies=/home/me/prepared_for_dvd/movies \\ -.br - -- \\ + -map /home/me/prepared_for_dvd/movies /movies \\ .br -commit -eject all .SS @@ -1939,7 +1944,7 @@ first and only session to the output drive. .br ... .br - -outdev /dev/sr0 -blank fast \\ + -outdev /dev/sr0 -blank as_needed \\ .br -commit -eject all .SS @@ -2044,8 +2049,7 @@ With CD media, Linux mount accepts session numbers directly by its option \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. -Always have a blank media ready to perform a full backup in case the update -attempt fails. An overview of sessions is given by option -toc. +An overview of sessions is given by option -toc. .br Sessions on multi-session media are separated by several MB of unused blocks. So with small sessions the payload capacity can become substantially lower @@ -2057,14 +2061,17 @@ automatically. Have at least two media which you use alternatingly. So only older backups get endangered by the new write operation, while the newest backup is stored safely on a different media. +Always have a blank media ready to perform a full backup in case the update +attempt fails due to insufficient remaining capacity. .br If you have enough re-useable media for a round-robin scheme then better do full backups with blank media each time. Blanking can be achieved by either a separate run: .br -\fB$\fR xorriso -outdev /dev/sr0 -blank fast -eject all +\fB$\fR xorriso -outdev /dev/sr0 -blank as_needed -eject all .br -or in the update run by using option -blank "fast" before option -update_r. +or in the update run by using option -blank "as_needed" before +option -update_r. .br .SH FILES .SS diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index 054df035..ce6f4fbd 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -9098,18 +9098,23 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " -path_list disk_path", " Like -add but read the pathspecs from file disk_path.", "", +" -map disk_path iso_rr_path", +" Insert disk file object at the given iso_rr_path.", +" -map_single disk_path iso_rr_path", +" Like -map but with directory do not insert its sub tree.", " -update disk_path iso_rr_path", " Compare both file objects and do what is necessary to make", -" iso_rr_path a matching copy of disk_path.", +" iso_rr_path a matching copy of disk_path.", " -update_r disk_path iso_rr_path", " Like -update but affecting all files below directories.", -" -cpr disk_path [***] iso_rr_path", -" Insert the given files or directory trees from filesystem", -" into the ISO image.", " -cut_out disk_path byte_offset byte_count iso_rr_path", " Map a byte interval of a regular disk file into a regular", " file in the ISO image.", "", +" -cpr disk_path [***] iso_rr_path", +" Insert the given files or directory trees from filesystem", +" into the ISO image, according to the rules of cp -r.", +"", " -rm iso_rr_path [***]", " Delete the given files from the ISO image.", " -rm_r iso_rr_path [***]", @@ -9688,6 +9693,45 @@ ex:; } +/* Option -map , -map_single */ +/* @param flag bit0=do not report the added item + bit1=do not reset pacifier, no final pacifier message + bit5=eventually do not insert directory tree +*/ +int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path, + char *iso_path, int flag) +{ + int ret; + char eff_origin[SfileadrL], eff_dest[SfileadrL]; + + if(!(flag&2)) + Xorriso_pacifier_reset(xorriso, 0); + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin, + 2|4); + if(ret<=0) + return(ret); + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, iso_path, eff_dest, + 2); + if(ret<=0) + return(ret); + ret= Xorriso_graft_in(xorriso, NULL, eff_origin, eff_dest, + (off_t) 0, (off_t) 0, 2|(flag&32)); + if(!(flag&2)) + Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, + xorriso->pacifier_total, "", 1); + if(ret<=0) + return(ret); + + if(!(flag&1)) { + sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n", + (ret>1 ? "directory" : "file"), eff_dest, eff_origin); + Xorriso_info(xorriso,0); + } + return(1); +} + + /* Option -mark */ int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag) { @@ -11239,6 +11283,14 @@ next_command:; } else if(strcmp(cmd,"lsx")==0 || strcmp(cmd,"lslx")==0) { ret= Xorriso_option_lsx(xorriso, argc, argv, idx, (cmd[2]=='l')); + } else if(strcmp(cmd,"map")==0) { + (*idx)+= 2; + ret= Xorriso_option_map(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"map_single")==0) { + (*idx)+= 2; + ret= Xorriso_option_map(xorriso, arg1, arg2, 32); + } else if(strcmp(cmd,"mark")==0) { (*idx)++; ret= Xorriso_option_mark(xorriso, arg1, 0); diff --git a/libisoburn/trunk/xorriso/xorriso.h b/libisoburn/trunk/xorriso/xorriso.h index 056c1f14..cc9d6b1a 100644 --- a/libisoburn/trunk/xorriso/xorriso.h +++ b/libisoburn/trunk/xorriso/xorriso.h @@ -339,6 +339,13 @@ int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv, int Xorriso_option_lsx(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag); +/* Option -map */ +/* @param flag bit0=do not report the added item + bit1=do not reset pacifier, no final pacifier message +*/ +int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path, + char *iso_path, int flag); + /* Option -mark */ int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag); diff --git a/libisoburn/trunk/xorriso/xorriso_eng.html b/libisoburn/trunk/xorriso/xorriso_eng.html index 43ae947b..3cfad486 100644 --- a/libisoburn/trunk/xorriso/xorriso_eng.html +++ b/libisoburn/trunk/xorriso/xorriso_eng.html @@ -356,6 +356,7 @@ Bug fixes towards xorriso-0.1.2.pl00:
Enhancements towards stable version 0.1.4.pl00:
xorriso-0.1.5.tar.gz -(970 KB). +(980 KB).
A dynamically linked development version of xorriso can be obtained from repositories of diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index b2144d1a..63701720 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.05.15.092028" +#define Xorriso_timestamP "2008.05.15.150041" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index 76ab1198..301e7a0e 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -1934,6 +1934,7 @@ int Xorriso_copy_properties(struct XorrisO *xorriso, bit2= -follow, -not_*: this is not a command parameter bit3= use offset and cut_size for cut_out_node bit4= return 3 on rejection by exclusion or user + bit5= if directory then do not add sub tree @return <=0 = error , 1 = added simple node , 2 = added directory , 3 = rejected */ @@ -2117,10 +2118,12 @@ attach_source:; } else if(is_dir) { Xorriso_transfer_properties(xorriso, &stbuf, (IsoNode *) dir, 0); - ret= Xorriso_add_tree(xorriso, dir, img_path, disk_path, NULL, flag&2); - if(ret<=0) - return(ret); - + if(!(flag&32)) { + ret= Xorriso_add_tree(xorriso, dir, img_path, disk_path, NULL, + flag&2); + if(ret<=0) + return(ret); + } } else { if(resolve_link) { ret= Xorriso_resolve_link(xorriso, disk_path, resolved_disk_path, 0);