1 --- amanda/trunk/application-src/amstar.c 2010/09/24 21:46:25 3449
2 +++ amanda/trunk/application-src/amstar.c 2010/11/10 11:22:58 3609
6 * INCLUDE-LIST (for restore only)
7 - * EXCLUDE-LIST (for restore only)
14 {"exclude-list" , 1, NULL, 20},
15 {"directory" , 1, NULL, 21},
16 {"command-options" , 1, NULL, 22},
17 + {"exclude-file" , 1, NULL, 23},
22 case 22: argument.command_options =
23 g_slist_append(argument.command_options,
25 + case 23: if (optarg)
26 + argument.dle.exclude_file =
27 + append_sl(argument.dle.exclude_file, optarg);
33 argument->dle.include_list->nb_element >= 0) {
34 fprintf(stdout, "ERROR include-list not supported for backup\n");
36 - if (argument->dle.exclude_list &&
37 - argument->dle.exclude_list->nb_element >= 0) {
38 - fprintf(stdout, "ERROR exclude-list not supported for backup\n");
42 fprintf(stdout, "ERROR STAR-PATH not defined\n");
44 argument->dle.include_list->nb_element >= 0) {
45 fprintf(stderr, "ERROR include-list not supported for backup\n");
47 - if (argument->dle.exclude_list &&
48 - argument->dle.exclude_list->nb_element >= 0) {
49 - fprintf(stderr, "ERROR exclude-list not supported for backup\n");
52 if (check_device(argument) == 0) {
55 argument->dle.include_list->nb_element >= 0) {
56 fprintf(mesgstream, "? include-list not supported for backup\n");
58 - if (argument->dle.exclude_list &&
59 - argument->dle.exclude_list->nb_element >= 0) {
60 - fprintf(mesgstream, "? exclude-list not supported for backup\n");
63 level = GPOINTER_TO_INT(argument->level->data);
66 g_ptr_array_add(argv_ptr, stralloc("-"));
68 g_ptr_array_add(argv_ptr, stralloc("-C"));
70 #if defined(__CYGWIN__)
72 char tmppath[PATH_MAX];
74 g_ptr_array_add(argv_ptr, stralloc2("tardumps=", tardumpfile));
75 if (command == CMD_BACKUP)
76 g_ptr_array_add(argv_ptr, stralloc("-wtardumps"));
78 g_ptr_array_add(argv_ptr, stralloc("-xattr"));
79 g_ptr_array_add(argv_ptr, stralloc("-acl"));
80 g_ptr_array_add(argv_ptr, stralloc("H=exustar"));
82 if (command == CMD_BACKUP && argument->dle.create_index)
83 g_ptr_array_add(argv_ptr, stralloc("-v"));
85 + if ((argument->dle.exclude_file &&
86 + argument->dle.exclude_file->nb_element >= 1) ||
87 + (argument->dle.exclude_list &&
88 + argument->dle.exclude_list->nb_element >= 1)) {
89 + g_ptr_array_add(argv_ptr, stralloc("-match-tree"));
90 + g_ptr_array_add(argv_ptr, stralloc("-not"));
92 + if (argument->dle.exclude_file &&
93 + argument->dle.exclude_file->nb_element >= 1) {
95 + for (excl = argument->dle.exclude_file->first; excl != NULL;
96 + excl = excl->next) {
98 + if (strcmp(excl->name, "./") == 0) {
99 + ex = g_strdup_printf("pat=%s", excl->name+2);
101 + ex = g_strdup_printf("pat=%s", excl->name);
103 + g_ptr_array_add(argv_ptr, ex);
106 + if (argument->dle.exclude_list &&
107 + argument->dle.exclude_list->nb_element >= 1) {
109 + for (excl = argument->dle.exclude_list->first; excl != NULL;
110 + excl = excl->next) {
111 + char *exclname = fixup_relative(excl->name, argument->dle.device);
114 + if ((exclude = fopen(exclname, "r")) != NULL) {
115 + while ((aexc = agets(exclude)) != NULL) {
116 + if (aexc[0] != '\0') {
118 + if (strcmp(aexc, "./") == 0) {
119 + ex = g_strdup_printf("pat=%s", aexc+2);
121 + ex = g_strdup_printf("pat=%s", aexc);
123 + g_ptr_array_add(argv_ptr, ex);
133 g_ptr_array_add(argv_ptr, stralloc("."));
135 g_ptr_array_add(argv_ptr, NULL);