--- squashfs-tools/mksquashfs.c 2005-09-08 18:34:28.000000000 -0400 +++ squashfs-tools-suf/mksquashfs.c 2006-01-26 01:32:10.000000000 -0500 @@ -200,6 +200,9 @@ int sorted = 0; /* save destination file name for deleting on error */ char *destination_file = NULL; +/* append suffix for already existing entires */ +char *append_suffix = NULL; + /* structure to used to pass in a pointer or an integer * to duplicate buffer read helper functions. */ @@ -1331,7 +1334,15 @@ int encomp_opendir(char *pathname, struc if(n == dir->count) break; ERROR("Source directory entry %s already used! - trying ", dir_name); - sprintf(dir_name, "%s_%d", basename, pass++); + if(append_suffix) { + if(pass == 1) + sprintf(dir_name, "%s%s", basename, append_suffix); + else + sprintf(dir_name, "%s%s_%d", basename, append_suffix, pass-1); + pass++; + } + else + sprintf(dir_name, "%s_%d", basename, pass++); ERROR("%s\n", dir_name); } add_dir_entry(dir_name, source_path[i], NULL, dir); @@ -1729,6 +1740,14 @@ int main(int argc, char *argv[]) else if(strcmp(argv[i], "-keep-as-directory") == 0) keep_as_directory = TRUE; + + else if(strcmp(argv[i], "-append-suffix") == 0) { + if(++i == argc) { + ERROR("%s: -append-suffix: missing name\n", argv[0]); + exit(1); + } + append_suffix = argv[i]; + } else if(strcmp(argv[i], "-root-becomes") == 0) { if(++i == argc) { @@ -1757,6 +1776,8 @@ printOptions: ERROR("-keep-as-directory\tif one source directory is specified, create a root\n"); ERROR("\t\t\tdirectory containing that directory, rather than the\n"); ERROR("\t\t\tcontents of the directory\n"); + ERROR("-append-suffix \twhen appending, source files/directories having the\n"); + ERROR("\t\t\tsame name as the destination filesystem will be appended that suffix.\n"); ERROR("-root-becomes \twhen appending source files/directories, make the\n"); ERROR("\t\t\toriginal root become a subdirectory in the new root\n"); ERROR("\t\t\tcalled , rather than adding the new source items\n"); @@ -1842,7 +1863,7 @@ printOptions: fclose(fd); } else if(strcmp(argv[i], "-e") == 0) break; - else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-sort") == 0) + else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-sort") == 0 || strcmp(argv[i], "-append-suffix") == 0) i++; if(i != argc) { @@ -1860,7 +1881,7 @@ printOptions: sorted ++; } else if(strcmp(argv[i], "-e") == 0) break; - else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-ef") == 0) + else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-ef") == 0 || strcmp(argv[i], "-append-suffix") == 0) i++; if(delete) {