]>
Commit | Line | Data |
---|---|---|
3536726c MM |
1 | --- cdrtools-2.00.3/mkisofs/Makefile 2002-12-07 21:42:32.000000000 +0100 |
2 | +++ cdrtools-2.00.3/mkisofs/Makefile 2002-12-27 20:24:53.000000000 +0100 | |
14dbe5f1 | 3 | @@ -41,7 +41,7 @@ |
016fe5d8 | 4 | getopt.c getopt1.c \ |
5 | scsi.c \ | |
6 | scsi_cdr.c cd_misc.c \ | |
7 | - modes.c \ | |
8 | + modes.c silo.c \ | |
3536726c | 9 | apple.c volume.c desktop.c mac_label.c \ |
14dbe5f1 | 10 | ifo_read.c dvd_file.c dvd_reader.c |
016fe5d8 | 11 | HFILES= apple.h bootinfo.h config.h defaults.h diskmbr.h exclude.h \ |
3536726c MM |
12 | --- cdrtools-2.00.3/mkisofs/mkisofs.8 2002-12-24 16:39:31.000000000 +0100 |
13 | +++ cdrtools-2.00.3/mkisofs/mkisofs.8 2002-12-27 20:24:53.000000000 +0100 | |
14 | @@ -456,6 +456,13 @@ | |
15 | .IR gid . | |
16 | Specifying this option automatically enables Rock Ridge extensions. | |
17 | .TP | |
18 | +.BI \-F " root_directory | |
19 | +Follow symbolic links which point outside specified | |
20 | +.I root_directory | |
21 | +when generating the filesystem. This allows a symlink farm structure, | |
22 | +where symlinks inside the base directory stay symlinks, but symlinks | |
23 | +outside the base directory become real files on the CD. | |
24 | +.TP | |
25 | .B \-gui | |
26 | Switch the behaviour for a GUI. This currently makes the output more verbose | |
27 | but may have other effects in future. | |
28 | @@ -919,6 +926,25 @@ | |
016fe5d8 | 29 | with SYSI=system_id. |
30 | If specified in both places, the command line version is used. | |
3536726c | 31 | .TP |
016fe5d8 | 32 | +.BI \-s " silo_conf_file |
33 | +Specifies the path and filename of the SILO configuration file to be | |
34 | +used when making a "SILO" bootable CD. The pathname must be relative to the | |
35 | +source path specified to | |
36 | +.B mkisofs | |
37 | +and start with a slash. | |
38 | +The default is | |
39 | +.I /etc/silo.conf | |
40 | +See SILO documentation for the syntax of this file. | |
41 | +.TP | |
42 | +.BI \-S " silo_bootblock | |
43 | +Specifies the path and filename of the SILO first stage boot image to be | |
44 | +used when making a "SILO" bootable CD. The pathname must be relative to the | |
45 | +source path specified to | |
46 | +.B mkisofs. | |
47 | +The default is | |
48 | +.I boot/cd.b | |
49 | +The boot image must come from SILO 0.8.7 and higher. | |
3536726c | 50 | +.TP |
016fe5d8 | 51 | .B \-T |
52 | Generate a file TRANS.TBL in each directory on the CDROM, which can be used | |
3536726c MM |
53 | on non-Rock Ridge capable systems to help establish the correct file names. |
54 | --- cdrtools-2.00.3/mkisofs/mkisofs.c 2002-12-07 20:59:41.000000000 +0100 | |
55 | +++ cdrtools-2.00.3/mkisofs/mkisofs.c 2002-12-27 20:24:53.000000000 +0100 | |
56 | @@ -94,12 +94,14 @@ | |
57 | int use_genboot = 0; | |
58 | int use_RockRidge = 0; | |
59 | int use_Joliet = 0; | |
60 | +int use_silo = 0; | |
61 | int jlen = JMAX; /* maximum Joliet file name length */ | |
016fe5d8 | 62 | int verbose = 1; |
14dbe5f1 | 63 | int debug = 0; |
016fe5d8 | 64 | int gui = 0; |
65 | int all_files = 1; /* New default is to include all files */ | |
14dbe5f1 | 66 | int follow_links = 0; |
3536726c | 67 | +int follow_links_sensible = 0; |
14dbe5f1 | 68 | #ifdef IS_CYGWIN |
3536726c MM |
69 | int cache_inodes = 0;/* Do not cache inodes on Cygwin by default */ |
70 | #else | |
71 | @@ -133,6 +135,10 @@ | |
016fe5d8 | 72 | char *boot_catalog = BOOT_CATALOG_DEFAULT; |
73 | char *boot_image = BOOT_IMAGE_DEFAULT; | |
74 | char *genboot_image = BOOT_IMAGE_DEFAULT; | |
3536726c MM |
75 | +char *silo_boot_image = SILO_BOOT_IMAGE_DEFAULT; |
76 | +char *silo_bootblock = SILO_BOOTBLOCK_DEFAULT; | |
77 | +char *silo_conf_file = SILO_CONF_FILE_DEFAULT; | |
78 | +char follow_links_base[PATH_MAX]; | |
016fe5d8 | 79 | int ucs_level = 3; /* We now have Unicode tables so use level 3 */ |
80 | int volume_set_size = 1; | |
81 | int volume_sequence_number = 1; | |
3536726c | 82 | @@ -403,6 +409,8 @@ |
016fe5d8 | 83 | |
84 | #endif /* APPLE_HYB */ | |
85 | ||
86 | +#define OPTION_SILO_BOOT 2200 | |
87 | + | |
88 | static int save_pname = 0; | |
89 | ||
90 | static const struct ld_option ld_options[] = | |
3536726c | 91 | @@ -435,6 +443,8 @@ |
016fe5d8 | 92 | '\0', NULL, "Start specifying alternative El Torito boot parameters", ONE_DASH}, |
93 | {{"sparc-boot", required_argument, NULL, 'B'}, | |
94 | 'B', "FILES", "Set sparc boot image names", ONE_DASH}, | |
95 | + {{"silo-boot", required_argument, NULL, OPTION_SILO_BOOT}, | |
96 | + '\0', "FILE", "Set SILO second stage boot image name" , ONE_DASH }, | |
97 | {{"generic-boot", required_argument, NULL, 'G'}, | |
98 | 'G', "FILE", "Set generic boot image name", ONE_DASH}, | |
99 | {{"sparc-label", required_argument, NULL, OPTION_SPARCLABEL}, | |
3536726c MM |
100 | @@ -453,6 +463,8 @@ |
101 | '\0', "mode", "Make the mode of all plain files this mode.", ONE_DASH}, | |
102 | {{"follow-links", no_argument, NULL, 'f'}, | |
103 | 'f', NULL, "Follow symbolic links", ONE_DASH}, | |
104 | + {{"follow-outside-links", required_argument, NULL, 'F'}, | |
105 | + 'F', NULL, "Follow symbolic links which point outside the CD base directory", ONE_DASH }, | |
106 | {{"gid", required_argument, NULL, OPTION_GID}, | |
107 | '\0', "gid", "Make the group owner of all files this gid.", | |
108 | ONE_DASH}, | |
109 | @@ -544,6 +556,11 @@ | |
016fe5d8 | 110 | '\0', "FILE", "Sort file content locations according to rules in FILE" , ONE_DASH }, |
111 | #endif /* SORTING */ | |
3536726c | 112 | |
016fe5d8 | 113 | + { {"silo-conf-file", required_argument, NULL, 's'}, |
3536726c | 114 | + 's', "FILE", "Set name of SILO configuration file on the CD", ONE_DASH }, |
016fe5d8 | 115 | + { {"silo-bootblock", required_argument, NULL, 'S'}, |
3536726c MM |
116 | + 'S', "FILE", "Set SILO first stage bootblock image name", ONE_DASH }, |
117 | + | |
016fe5d8 | 118 | {{"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT}, |
119 | '\0', NULL, "Split output into files of approx. 1GB size", ONE_DASH}, | |
3536726c MM |
120 | {{"sysid", required_argument, NULL, OPTION_SYSID}, |
121 | @@ -1150,7 +1167,7 @@ | |
122 | int hfs_ct = 0; | |
123 | char *root_info = 0; | |
124 | #endif /* APPLE_HYB */ | |
125 | - | |
126 | + char old_dir[PATH_MAX]; | |
127 | ||
128 | #ifdef __EMX__ | |
129 | /* This gives wildcard expansion with Non-Posix shells with EMX */ | |
130 | @@ -1352,6 +1369,34 @@ | |
016fe5d8 | 131 | #endif |
132 | } | |
133 | break; | |
3536726c MM |
134 | + case OPTION_SILO_BOOT: |
135 | + use_silo++; | |
136 | + silo_boot_image = optarg; /* pathname of the boot image on cd */ | |
137 | + if (silo_boot_image == NULL) { | |
138 | + fprintf(stderr,"Required boot image pathname missing\n"); | |
139 | + exit(1); | |
140 | + } | |
141 | + break; | |
142 | + case 'S': | |
143 | + use_silo++; | |
144 | + silo_bootblock = optarg; /* pathname of the boot image on cd */ | |
145 | + if (silo_bootblock == NULL) { | |
146 | + fprintf(stderr,"Required bootblock pathname missing\n"); | |
147 | + exit(1); | |
148 | + } | |
149 | + break; | |
150 | + case 's': | |
151 | + use_silo++; | |
152 | + silo_conf_file = optarg; /* pathname of the boot image on cd */ | |
153 | + if (silo_conf_file == NULL) { | |
154 | + fprintf(stderr,"Required SILO config file pathname missing\n"); | |
155 | + exit(1); | |
156 | + } | |
157 | + if (*silo_conf_file != '/') { | |
158 | + fprintf(stderr,"SILO config file pathname must start with /\n"); | |
159 | + exit(1); | |
160 | + } | |
161 | + break; | |
016fe5d8 | 162 | case OPTION_ABSTRACT: |
163 | abstract = optarg; | |
164 | if (strlen(abstract) > 37) { | |
3536726c MM |
165 | @@ -1446,6 +1491,20 @@ |
166 | "Warning: -follow-links does not always work correctly; be careful.\n"); | |
167 | #endif | |
168 | break; | |
169 | + case 'F': | |
170 | + follow_links_sensible++; | |
171 | + if(getcwd (old_dir, PATH_MAX)) { | |
172 | + chdir (optarg); | |
173 | + if(!getcwd (follow_links_base, PATH_MAX)) { | |
174 | + perror("getcwd"); | |
175 | + exit(1); | |
176 | + } | |
177 | + chdir (old_dir); | |
178 | + } else { | |
179 | + perror("getcwd"); | |
180 | + exit(1); | |
181 | + } | |
182 | + break; | |
183 | case 'l': | |
184 | full_iso9660_filenames++; | |
185 | break; | |
186 | @@ -2967,7 +3026,10 @@ | |
016fe5d8 | 187 | outputlist_insert(&sunlabel_desc); |
188 | if (use_genboot) | |
189 | outputlist_insert(&genboot_desc); | |
3536726c MM |
190 | - outputlist_insert(&padblock_desc); |
191 | + if (use_silo) | |
192 | + outputlist_insert(&silo_desc); | |
016fe5d8 | 193 | + else |
14dbe5f1 | 194 | + outputlist_insert(&padblock_desc); |
016fe5d8 | 195 | |
196 | /* PVD for disc. */ | |
197 | outputlist_insert(&voldesc_desc); | |
3536726c MM |
198 | --- cdrtools-2.00.3/mkisofs/mkisofs.h 2002-12-07 20:59:42.000000000 +0100 |
199 | +++ cdrtools-2.00.3/mkisofs/mkisofs.h 2002-12-27 20:24:53.000000000 +0100 | |
200 | @@ -169,6 +169,7 @@ | |
016fe5d8 | 201 | extern struct output_fragment *out_tail; |
202 | ||
3536726c | 203 | extern struct output_fragment padblock_desc; |
016fe5d8 | 204 | +extern struct output_fragment silo_desc; |
205 | extern struct output_fragment voldesc_desc; | |
206 | extern struct output_fragment joliet_desc; | |
3536726c MM |
207 | extern struct output_fragment torito_desc; |
208 | @@ -265,8 +266,15 @@ | |
016fe5d8 | 209 | struct directory_entry *s_entry; |
210 | unsigned int pad; | |
211 | off_t off; | |
212 | +#ifdef __STDC__ | |
3536726c | 213 | + int (*filter)(char *, int, int); |
016fe5d8 | 214 | +#else |
3536726c | 215 | + int (*filter)(); |
016fe5d8 | 216 | +#endif |
217 | }; | |
218 | ||
219 | +extern struct deferred_write * dw_head, * dw_tail; | |
220 | + | |
221 | struct eltorito_boot_entry_info { | |
222 | struct eltorito_boot_entry_info *next; | |
223 | char *boot_image; | |
3536726c MM |
224 | @@ -323,6 +331,8 @@ |
225 | extern int dirmode_to_use; | |
226 | extern int new_dir_mode; | |
227 | extern int follow_links; | |
228 | +extern int follow_links_sensible; | |
229 | +extern char follow_links_base[]; | |
230 | extern int cache_inodes; | |
231 | extern int verbose; | |
232 | extern int debug; | |
233 | @@ -619,6 +629,9 @@ | |
016fe5d8 | 234 | extern char *boot_catalog; |
235 | extern char *boot_image; | |
236 | extern char *genboot_image; | |
237 | +extern char *silo_boot_image; | |
238 | +extern char *silo_bootblock; | |
239 | +extern char *silo_conf_file; | |
240 | extern int ucs_level; | |
241 | extern int volume_set_size; | |
242 | extern int volume_sequence_number; | |
3536726c MM |
243 | --- cdrtools-2.00.3/mkisofs/silo.c 1970-01-01 01:00:00.000000000 +0100 |
244 | +++ cdrtools-2.00.3/mkisofs/silo.c 2002-12-27 20:24:53.000000000 +0100 | |
016fe5d8 | 245 | @@ -0,0 +1,255 @@ |
246 | +/* | |
247 | + * Program silo.c - Handle SILO bootable iso9660 CD-ROMs. | |
3536726c | 248 | + * |
016fe5d8 | 249 | + |
250 | + Copyright (C) 1999 Jakub Jelinek <jakub@redhat.com>. | |
251 | + | |
252 | + This program is free software; you can redistribute it and/or modify | |
253 | + it under the terms of the GNU General Public License as published by | |
254 | + the Free Software Foundation; either version 2, or (at your option) | |
255 | + any later version. | |
256 | + | |
257 | + This program is distributed in the hope that it will be useful, | |
258 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
259 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
260 | + GNU General Public License for more details. | |
261 | + | |
262 | + You should have received a copy of the GNU General Public License | |
263 | + along with this program; if not, write to the Free Software | |
264 | + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
265 | + | |
266 | + | |
267 | +static char rcsid[] ="$Id$"; | |
268 | + | |
269 | +#include <mconfig.h> | |
270 | +#include <stdio.h> | |
271 | +#include <sys/types.h> | |
272 | +#include <sys/stat.h> | |
273 | +#include <unistd.h> | |
274 | +#include <fcntl.h> | |
275 | +#include <stdlib.h> | |
276 | + | |
277 | +#include "mkisofs.h" | |
278 | +#include "iso9660.h" | |
279 | +#include <schily.h> | |
280 | + | |
281 | +/* used by Win32 for opening binary file - not used by Unix */ | |
282 | +#ifndef O_BINARY | |
283 | +#define O_BINARY 0 | |
284 | +#endif /* O_BINARY */ | |
285 | + | |
286 | +struct sun_disklabel { | |
3536726c MM |
287 | + char info[128]; /* Informative text string */ |
288 | + char spare0[14]; | |
016fe5d8 | 289 | + struct sun_info { |
3536726c MM |
290 | + char spare1; |
291 | + char id; | |
292 | + char spare2; | |
293 | + char flags; | |
016fe5d8 | 294 | + } infos[8]; |
3536726c MM |
295 | + char spare1[246]; /* Boot information etc. */ |
296 | + char rspeed[2]; /* 722 - Disk rotational speed */ | |
297 | + char pcylcount[2]; /* 722 - Physical cylinder count */ | |
298 | + char sparecyl[2]; /* 722 - extra sects per cylinder */ | |
299 | + char spare2[4]; /* More magic... */ | |
300 | + char ilfact[2]; /* 722 - Interleave factor */ | |
301 | + char ncyl[2]; /* 722 - Data cylinder count */ | |
302 | + char nacyl[2]; /* 722 - Alt. cylinder count */ | |
303 | + char ntrks[2]; /* 722 - Tracks per cylinder */ | |
304 | + char nsect[2]; /* 722 - Sectors per track */ | |
305 | + char spare3[4]; /* Even more magic... */ | |
016fe5d8 | 306 | + struct sun_partition { |
3536726c MM |
307 | + char start_cylinder[4]; /* 732 */ |
308 | + char num_sectors[4]; /* 732 */ | |
016fe5d8 | 309 | + } partitions[8]; |
3536726c MM |
310 | + char magic[2]; /* 722 - Magic number */ |
311 | + char csum[2]; /* 722 - Label xor'd checksum */ | |
016fe5d8 | 312 | + struct bootblock_header { |
3536726c MM |
313 | + char magic[4]; /* 732 */ |
314 | + char aout[20]; | |
315 | + char siloid[8]; | |
316 | + char insn[16]; | |
317 | + char extent[4]; /* 732 */ | |
318 | + char size[4]; /* 732 */ | |
319 | + char text[2048-512-56]; | |
016fe5d8 | 320 | + } bootblock; |
321 | +}; | |
322 | + | |
323 | +static struct { | |
324 | + char id; | |
325 | + char conf_part; | |
326 | + char part; | |
327 | + char pad; | |
328 | + char conf_file[256]; | |
329 | +} silo_info; | |
330 | + | |
331 | +static int silo_size(int starting_extent) | |
332 | +{ | |
333 | + last_extent += 16; | |
334 | + return 0; | |
335 | +} | |
336 | + | |
337 | +static int silo_filter(char * buffer, int size, int offset) | |
338 | +{ | |
339 | + if (offset < 0x808 + sizeof(silo_info) | |
3536726c | 340 | + && offset + size > 0x808) |
016fe5d8 | 341 | + { |
3536726c MM |
342 | + int i; |
343 | + if (offset < 0x808) | |
344 | + { | |
345 | + offset = 0x808 - offset; | |
346 | + size -= offset; | |
347 | + buffer += offset; | |
348 | + offset = 0; | |
349 | + } | |
350 | + else | |
351 | + offset -= 0x808; | |
352 | + i = sizeof(silo_info) - offset; | |
353 | + if (i > size) i = size; | |
354 | + memcpy (buffer, ((char *)&silo_info) + offset, i); | |
016fe5d8 | 355 | + } |
356 | + return 0; | |
357 | +} | |
358 | + | |
359 | +static int silo_write(FILE * outfile) | |
360 | +{ | |
361 | + struct directory_entry * de; | |
362 | + struct directory_entry * de2; | |
3536726c | 363 | + struct deferred_write * dwpnt; |
016fe5d8 | 364 | + int bootblock, i, should_write; |
3536726c MM |
365 | + struct sun_disklabel silo_bb; |
366 | + | |
016fe5d8 | 367 | + memset (&silo_bb, 0, sizeof (silo_bb)); |
3536726c | 368 | + |
016fe5d8 | 369 | + if (*silo_bootblock == '/') silo_bootblock++; |
370 | + if (*silo_boot_image == '/') silo_boot_image++; | |
371 | + | |
372 | + /* | |
3536726c | 373 | + * search from root of iso fs to find boot catalog |
016fe5d8 | 374 | + */ |
375 | + de2 = search_tree_file(root, silo_bootblock); | |
3536726c | 376 | + if (!de2) |
016fe5d8 | 377 | + { |
3536726c MM |
378 | + fprintf(stderr,"Uh oh, I cant find the SILO bootblock!\n"); |
379 | + exit(1); | |
016fe5d8 | 380 | + } |
381 | + | |
382 | + /* | |
383 | + * now read it from disk | |
384 | + */ | |
385 | + bootblock = open(de2->whole_name, O_RDWR | O_BINARY); | |
3536726c | 386 | + if (bootblock == -1) |
016fe5d8 | 387 | + { |
3536726c MM |
388 | + fprintf(stderr,"Error opening SILO bootblock for reading.\n"); |
389 | + perror(""); | |
390 | + exit(1); | |
016fe5d8 | 391 | + } |
3536726c | 392 | + |
016fe5d8 | 393 | + if (read (bootblock, (char *)&silo_bb.bootblock, 1024) != 1024) |
394 | + { | |
3536726c MM |
395 | + fprintf(stderr,"Error reading SILO bootblock.\n"); |
396 | + perror(""); | |
397 | + exit(1); | |
016fe5d8 | 398 | + } |
399 | + | |
400 | + close (bootblock); | |
401 | + | |
402 | + if (get_732 (silo_bb.bootblock.magic) != 0x01030107 | |
3536726c MM |
403 | + || strncmp (silo_bb.bootblock.siloid, "SILO", 4) |
404 | + || silo_bb.bootblock.siloid[5] != '.' | |
405 | + || silo_bb.bootblock.siloid[4] < '0' | |
406 | + || silo_bb.bootblock.siloid[4] > '9' | |
407 | + || silo_bb.bootblock.siloid[6] < '0' | |
408 | + || silo_bb.bootblock.siloid[6] > '9' | |
409 | + || silo_bb.bootblock.siloid[7] < '0' | |
410 | + || silo_bb.bootblock.siloid[7] > '9') | |
016fe5d8 | 411 | + { |
3536726c MM |
412 | + fprintf(stderr,"Error: the file %s is not a valid SILO bootblock.\n", silo_bootblock); |
413 | + perror(""); | |
414 | + exit(1); | |
016fe5d8 | 415 | + } |
3536726c | 416 | + |
016fe5d8 | 417 | + /* Check version number. Only SILO 0.87 and up is valid. */ |
418 | + if (silo_bb.bootblock.siloid[4] == '0' | |
3536726c MM |
419 | + && (silo_bb.bootblock.siloid[6] < '8' |
420 | + || (silo_bb.bootblock.siloid[6] == '8' | |
421 | + && silo_bb.bootblock.siloid[7] <= '6'))) | |
016fe5d8 | 422 | + { |
3536726c MM |
423 | + fprintf(stderr,"Error: SILO bootblock is too old. Must be at least 0.8.7.\n"); |
424 | + perror(""); | |
425 | + exit(1); | |
016fe5d8 | 426 | + } |
427 | + | |
428 | + /* | |
3536726c | 429 | + * search from root of iso fs to find boot catalog |
016fe5d8 | 430 | + */ |
431 | + de = search_tree_file(root, silo_boot_image); | |
3536726c | 432 | + if (!de) |
016fe5d8 | 433 | + { |
3536726c MM |
434 | + fprintf(stderr,"Uh oh, I cant find the SILO boot image!\n"); |
435 | + exit(1); | |
016fe5d8 | 436 | + } |
437 | + | |
438 | + /* | |
439 | + * need to filter second.b, so that we can seed | |
440 | + * silo.conf location and other stuff. | |
441 | + * We could write it into the de->whole_name file, | |
442 | + * but I prefer filtering it like this because | |
443 | + * then the tree can be e.g. read only NFS mounted. | |
444 | + */ | |
445 | + for (dwpnt = dw_head; dwpnt; dwpnt = dwpnt->next) | |
446 | + { | |
3536726c MM |
447 | + if (!dwpnt->name) continue; |
448 | + if (!strcmp (dwpnt->name, de->whole_name)) | |
449 | + dwpnt->filter = silo_filter; | |
016fe5d8 | 450 | + } |
451 | + | |
452 | + set_732 (silo_bb.bootblock.extent, de->starting_block); | |
453 | + set_732 (silo_bb.bootblock.size, de->size); | |
454 | + | |
455 | + strcpy (silo_bb.info, "SPARC bootable CD-ROM: "); | |
456 | + strcat (silo_bb.info, volume_id); | |
457 | + | |
458 | + should_write = (last_extent - session_start) << 2; | |
459 | + | |
460 | + /* Now some magic */ | |
461 | + silo_bb.spare0[3] = 1; | |
462 | + silo_bb.spare0[13] = 8; | |
463 | + for (i = 0; i < 8; i++) { | |
3536726c MM |
464 | + silo_bb.infos[i].id = 0x83; |
465 | + silo_bb.infos[i].flags = 0x18; | |
016fe5d8 | 466 | + } |
467 | + set_732 (silo_bb.spare1 + 14, 0x600ddeee); | |
468 | + set_722 (silo_bb.rspeed, 0x15e); | |
469 | + set_722 (silo_bb.pcylcount, (should_write + 639) / 640); | |
470 | + set_722 (silo_bb.ilfact, 1); | |
471 | + set_722 (silo_bb.ncyl, (should_write + 639) / 640); | |
472 | + set_722 (silo_bb.ntrks, 1); | |
473 | + set_722 (silo_bb.nsect, 640); | |
474 | + set_732 (silo_bb.partitions[0].num_sectors, should_write); | |
475 | + set_722 (silo_bb.magic, 0xdabe); | |
476 | + for (i = 0; i < 510; i+=2) { | |
3536726c MM |
477 | + silo_bb.csum[0] ^= silo_bb.info[i]; |
478 | + silo_bb.csum[1] ^= silo_bb.info[i+1]; | |
016fe5d8 | 479 | + } |
480 | + | |
481 | + xfwrite(&silo_bb, 1, sizeof(silo_bb), outfile); | |
482 | + memset (&silo_bb, 0, sizeof(silo_bb)); | |
483 | + | |
484 | + for(i=1; i<16; i++) | |
485 | + { | |
3536726c | 486 | + xfwrite(&silo_bb, 1, sizeof(silo_bb), outfile); |
016fe5d8 | 487 | + } |
488 | + | |
489 | + memset (&silo_info, 0, sizeof(silo_info)); | |
490 | + silo_info.id = 'L'; | |
491 | + silo_info.conf_part = 1; | |
492 | + strncpy (silo_info.conf_file, silo_conf_file, 256); | |
493 | + silo_info.conf_file[259] = '\0'; | |
494 | + | |
495 | + last_extent_written += 16; | |
3536726c | 496 | + |
016fe5d8 | 497 | + return 0; |
498 | +} | |
499 | + | |
500 | +struct output_fragment silo_desc = {NULL, silo_size, NULL, silo_write}; | |
3536726c MM |
501 | --- cdrtools-2.00.3/mkisofs/tree.c 2002-12-07 21:40:47.000000000 +0100 |
502 | +++ cdrtools-2.00.3/mkisofs/tree.c 2002-12-27 20:24:53.000000000 +0100 | |
503 | @@ -84,6 +84,7 @@ | |
504 | int scan_directory_tree __PR((struct directory *this_dir, | |
505 | char *path, | |
506 | struct directory_entry *de)); | |
507 | +static int check_dirlevel __PR((char *name)); | |
508 | #ifdef APPLE_HYB | |
509 | int insert_file_entry __PR((struct directory *this_dir, | |
510 | char *whole_path, | |
511 | @@ -1322,6 +1323,34 @@ | |
512 | return 1; | |
513 | } | |
514 | ||
515 | +/* check_dirlevel: returns 1 if | |
516 | + * name is below the tree of follow_links_base */ | |
517 | +static int | |
518 | +check_dirlevel(name) | |
519 | + char *name; | |
520 | +{ | |
521 | + char old[256] = {0,}, buf[256] = {0,}, b2[256], *c; | |
522 | + | |
523 | + strcpy (b2, name); | |
524 | + c = strrchr (b2, '/'); | |
525 | + if (c) { | |
526 | + *c = '\0'; | |
527 | + getcwd (old, 256); | |
528 | + chdir (b2); | |
529 | + getcwd (buf, 256); | |
530 | + chdir (old); | |
531 | + | |
532 | + if (!strncmp (buf, follow_links_base, | |
533 | + strlen (follow_links_base))) { | |
534 | + return 1; | |
535 | + } else { | |
536 | + return 0; | |
537 | + } | |
538 | + } | |
539 | + | |
540 | + return 1; | |
541 | +} | |
542 | + | |
543 | ||
544 | /* | |
545 | * Function: insert_file_entry | |
546 | @@ -1366,6 +1395,8 @@ | |
547 | int htype = TYPE_NONE; | |
548 | ||
549 | #endif /* APPLE_HYB */ | |
550 | + char link_buf[256]; | |
551 | + int do_follow_links = 0; | |
552 | ||
553 | status = stat_filter(whole_path, &statbuf); | |
554 | ||
555 | @@ -1401,7 +1432,35 @@ | |
556 | * is in use, it is easy, we let RR describe the file. If | |
557 | * not, then we punt the file. | |
558 | */ | |
559 | - if ((status || !follow_links)) { | |
560 | + /* First check for the sensible follow_links option */ | |
561 | + if (follow_links_sensible) { | |
562 | + /* Where does the link point to? */ | |
563 | + memset (link_buf, 0, 256); | |
564 | + readlink (whole_path, link_buf, 255); | |
565 | + if (check_dirlevel (link_buf)) { | |
566 | + /* Treat it as a symlink */ | |
567 | + if (!use_RockRidge) { | |
568 | + fprintf(stderr, "Ignoring symlink %s (which wouldn't be followed)\n", | |
569 | + whole_path); | |
570 | + } else { | |
571 | + do_follow_links = 0; | |
572 | + if (status) { | |
573 | + status = 0; | |
574 | + statbuf.st_size = 0; | |
575 | + STAT_INODE(statbuf) = UNCACHED_INODE; | |
576 | + statbuf.st_dev = (dev_t) UNCACHED_DEVICE; | |
577 | + statbuf.st_mode = (statbuf.st_mode & ~S_IFMT) | S_IFREG; | |
578 | + } | |
579 | + } | |
580 | + } else { | |
581 | + /* Follow the link */ | |
582 | + do_follow_links = 1; | |
583 | + } | |
584 | + } | |
585 | + else if (!follow_links_sensible) | |
586 | + do_follow_links = follow_links; | |
587 | + | |
588 | + if((status || !do_follow_links)) { | |
589 | if (use_RockRidge) { | |
590 | status = 0; | |
591 | statbuf.st_size = (off_t)0; | |
592 | @@ -1410,7 +1469,7 @@ | |
593 | statbuf.st_mode = | |
594 | (statbuf.st_mode & ~S_IFMT) | S_IFREG; | |
595 | } else { | |
596 | - if (follow_links) { | |
597 | + if (do_follow_links) { | |
598 | #ifdef USE_LIBSCHILY | |
599 | /* XXX errno may be wrong! */ | |
600 | errmsg("Unable to stat file %s - ignoring and continuing.\n", | |
601 | @@ -1443,7 +1502,7 @@ | |
602 | * time we have seen this, then make this seem as if there was | |
603 | * no symlink there in the first place | |
604 | */ | |
605 | - if (follow_links | |
606 | + if (do_follow_links | |
607 | && S_ISDIR(statbuf.st_mode)) { | |
608 | if (strcmp(short_name, ".") | |
609 | && strcmp(short_name, "..")) { | |
610 | @@ -1478,7 +1537,7 @@ | |
611 | * For non-directories, we just copy the stat information over | |
612 | * so we correctly include this file. | |
613 | */ | |
614 | - if (follow_links | |
615 | + if (do_follow_links | |
616 | && !S_ISDIR(statbuf.st_mode)) { | |
617 | lstatbuf = statbuf; | |
618 | } | |
619 | @@ -1487,7 +1546,7 @@ | |
620 | * Add directories to the cache so that we don't waste space even if | |
621 | * we are supposed to be following symlinks. | |
622 | */ | |
623 | - if (follow_links | |
624 | + if (do_follow_links | |
625 | && strcmp(short_name, ".") | |
626 | && strcmp(short_name, "..") | |
627 | && S_ISDIR(statbuf.st_mode)) { | |
628 | @@ -1537,7 +1596,7 @@ | |
629 | * Add this so that we can detect directory loops with hard links. | |
630 | * If we are set up to follow symlinks, then we skip this checking. | |
631 | */ | |
632 | - if (!follow_links | |
633 | + if (!do_follow_links | |
634 | && S_ISDIR(lstatbuf.st_mode) | |
635 | && strcmp(short_name, ".") | |
636 | && strcmp(short_name, "..")) { | |
637 | --- cdrtools-2.00.3/mkisofs/vms.c 2000-12-05 15:25:10.000000000 +0100 | |
638 | +++ cdrtools-2.00.3/mkisofs/vms.c 2002-12-27 20:24:53.000000000 +0100 | |
016fe5d8 | 639 | @@ -288,7 +288,7 @@ |
640 | extern unsigned int last_extent_written; | |
641 | ||
642 | int | |
643 | -vms_write_one_file(char *filename, int size, FILE * outfile) | |
644 | +vms_write_one_file(struct deferred_write * dwpnt, FILE * outfile) | |
645 | { | |
646 | int status, | |
647 | i; | |
3536726c | 648 | @@ -296,10 +296,11 @@ |
016fe5d8 | 649 | int count; |
650 | int use; | |
651 | int remain; | |
3536726c | 652 | + int offset = 0; |
016fe5d8 | 653 | |
654 | - open_file(filename); | |
3536726c | 655 | + open_file(dwpnt->name); |
016fe5d8 | 656 | |
657 | - remain = size; | |
016fe5d8 | 658 | + remain = dwpnt->size; |
659 | ||
660 | while (remain > 0) { | |
661 | use = (remain > SECTOR_SIZE * NSECT - 1 ? NSECT * SECTOR_SIZE : remain); | |
3536726c | 662 | @@ -308,11 +309,14 @@ |
016fe5d8 | 663 | rab->rab$l_ubf = buffer; |
664 | rab->rab$w_usz = sizeof(buffer); | |
665 | status = sys$read(rab); | |
666 | + if (dwpnt->filter) | |
3536726c | 667 | + (* dwpnt->filter)(buffer, use, offset); |
016fe5d8 | 668 | fwrite(buffer, 1, use, outfile); |
669 | last_extent_written += use / SECTOR_SIZE; | |
670 | if ((last_extent_written % 1000) < use / SECTOR_SIZE) | |
671 | fprintf(stderr, "%d..", last_extent_written); | |
672 | remain -= use; | |
673 | + offset += use; | |
674 | }; | |
675 | ||
676 | close_file(rab); | |
3536726c MM |
677 | --- cdrtools-2.00.3/mkisofs/write.c 2002-12-23 15:16:45.000000000 +0100 |
678 | +++ cdrtools-2.00.3/mkisofs/write.c 2002-12-27 20:24:53.000000000 +0100 | |
679 | @@ -86,10 +86,10 @@ | |
016fe5d8 | 680 | FILE *file)); |
681 | static int assign_directory_addresses __PR((struct directory *node)); | |
682 | #ifdef APPLE_HYB | |
683 | -static void write_one_file __PR((char *filename, unsigned int size, | |
684 | +static void write_one_file __PR((struct deferred_write *dwpnt, | |
685 | FILE *outfile, off_t off)); | |
686 | #else | |
687 | -static void write_one_file __PR((char *filename, unsigned int size, | |
688 | +static void write_one_file __PR((struct deferred_write *dwpnt, | |
689 | FILE *outfile)); | |
690 | #endif | |
691 | static void write_files __PR((FILE *outfile)); | |
3536726c | 692 | @@ -303,8 +303,8 @@ |
016fe5d8 | 693 | static struct deferred_write mac_boot; |
694 | ||
695 | #endif /* APPLE_HYB */ | |
696 | -static struct deferred_write *dw_head = NULL, | |
3536726c | 697 | - *dw_tail = NULL; |
016fe5d8 | 698 | +struct deferred_write *dw_head = NULL, |
3536726c | 699 | + *dw_tail = NULL; |
016fe5d8 | 700 | |
701 | unsigned int last_extent_written = 0; | |
3536726c MM |
702 | static Uint path_table_index; |
703 | @@ -360,16 +360,14 @@ | |
016fe5d8 | 704 | |
705 | #ifdef APPLE_HYB | |
706 | static void | |
707 | -write_one_file(filename, size, outfile, off) | |
708 | - char *filename; | |
709 | - unsigned int size; | |
710 | +write_one_file(dwpnt, outfile, off) | |
3536726c | 711 | + struct deferred_write *dwpnt; |
016fe5d8 | 712 | FILE *outfile; |
713 | off_t off; | |
714 | #else | |
715 | static void | |
716 | -write_one_file(filename, size, outfile) | |
717 | - char *filename; | |
718 | - unsigned int size; | |
719 | +write_one_file(dwpnt, outfile) | |
3536726c | 720 | + struct deferred_write *dwpnt; |
016fe5d8 | 721 | FILE *outfile; |
722 | #endif /* APPLE_HYB */ | |
723 | { | |
3536726c | 724 | @@ -385,18 +383,18 @@ |
016fe5d8 | 725 | FILE *infile; |
726 | int remain; | |
727 | int use; | |
3536726c | 728 | + int offset; |
016fe5d8 | 729 | |
14dbe5f1 | 730 | - |
016fe5d8 | 731 | - if ((infile = fopen(filename, "rb")) == NULL) { |
3536726c | 732 | + if ((infile = fopen(dwpnt->name, "rb")) == NULL) { |
016fe5d8 | 733 | #ifdef USE_LIBSCHILY |
734 | - comerr("cannot open '%s'\n", filename); | |
735 | + comerr("cannot open '%s'\n", dwpnt->name); | |
736 | #else | |
14dbe5f1 | 737 | #ifndef HAVE_STRERROR |
738 | fprintf(stderr, "cannot open '%s': (%d)\n", | |
016fe5d8 | 739 | - filename, errno); |
740 | + dwpnt->name, errno); | |
741 | #else | |
14dbe5f1 | 742 | fprintf(stderr, "cannot open '%s': %s\n", |
016fe5d8 | 743 | - filename, strerror(errno)); |
744 | + dwpnt->name, strerror(errno)); | |
745 | #endif | |
746 | exit(1); | |
747 | #endif | |
3536726c | 748 | @@ -404,7 +402,8 @@ |
016fe5d8 | 749 | #ifdef APPLE_HYB |
750 | fseek(infile, off, SEEK_SET); | |
751 | #endif /* APPLE_HYB */ | |
752 | - remain = size; | |
016fe5d8 | 753 | + remain = dwpnt->size; |
3536726c MM |
754 | + offset = 0; |
755 | ||
016fe5d8 | 756 | while (remain > 0) { |
757 | use = (remain > SECTOR_SIZE * NSECT - 1 ? | |
3536726c | 758 | @@ -414,13 +413,16 @@ |
016fe5d8 | 759 | memset(buffer, 0, use); |
760 | if (fread(buffer, 1, use, infile) == 0) { | |
761 | #ifdef USE_LIBSCHILY | |
14dbe5f1 | 762 | - comerr("cannot read from '%s'\n", filename); |
763 | + comerr("cannot read from '%s'\n", dwpnt->name); | |
016fe5d8 | 764 | #else |
14dbe5f1 | 765 | - fprintf(stderr, "cannot read from '%s'\n", filename); |
766 | + fprintf(stderr, "cannot read from '%s'\n", dwpnt->name); | |
016fe5d8 | 767 | exit(1); |
768 | #endif | |
769 | } | |
3536726c MM |
770 | + if (dwpnt->filter) |
771 | + (* dwpnt->filter)(buffer, use, offset); | |
016fe5d8 | 772 | xfwrite(buffer, 1, use, outfile); |
3536726c | 773 | + offset += use; |
016fe5d8 | 774 | last_extent_written += use / SECTOR_SIZE; |
775 | #if 0 | |
776 | if ((last_extent_written % 1000) < use / SECTOR_SIZE) { | |
3536726c | 777 | @@ -480,13 +482,13 @@ |
016fe5d8 | 778 | } else { |
779 | ||
780 | #ifdef VMS | |
781 | - vms_write_one_file(dwpnt->name, dwpnt->size, outfile); | |
782 | + vms_write_one_file(dwpnt, outfile); | |
783 | #else | |
784 | #ifdef APPLE_HYB | |
785 | - write_one_file(dwpnt->name, dwpnt->size, outfile, | |
3536726c MM |
786 | + write_one_file(dwpnt, outfile, |
787 | dwpnt->off); | |
016fe5d8 | 788 | #else |
789 | - write_one_file(dwpnt->name, dwpnt->size, outfile); | |
790 | + write_one_file(dwpnt, outfile); | |
791 | #endif /* APPLE_HYB */ | |
792 | #endif | |
793 | free(dwpnt->name); | |
3536726c | 794 | @@ -1151,6 +1153,7 @@ |
016fe5d8 | 795 | dwpnt->next = NULL; |
796 | dwpnt->size = s_entry->size; | |
797 | dwpnt->extent = last_extent; | |
798 | + dwpnt->filter = NULL; | |
799 | set_733((char *) s_entry->isorec.extent, | |
800 | last_extent); | |
801 | s_entry->starting_block = last_extent; | |
3536726c | 802 | @@ -1722,8 +1725,7 @@ |
016fe5d8 | 803 | |
804 | /* write out HFS boot block */ | |
805 | if (mac_boot.name) | |
806 | - write_one_file(mac_boot.name, mac_boot.size, outfile, | |
807 | - mac_boot.off); | |
808 | + write_one_file(&mac_boot, outfile, mac_boot.off); | |
809 | } | |
810 | #endif /* APPLE_HYB */ | |
811 |