]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/testing/project-restore-attributes-only.patch
ebl cleanup
[bacula/bacula] / bacula / patches / testing / project-restore-attributes-only.patch
1 diff -Naur cvs/src/baconfig.h my/src/baconfig.h
2 --- cvs/src/baconfig.h  2006-12-30 17:01:49.000000000 +0100
3 +++ my/src/baconfig.h   2006-12-30 17:01:34.000000000 +0100
4 @@ -571,10 +571,12 @@
5   * Replace codes needed in both file routines and non-file routines
6   * Job replace codes -- in "replace"
7   */
8 -#define REPLACE_ALWAYS   'a'
9 -#define REPLACE_IFNEWER  'w'
10 -#define REPLACE_NEVER    'n'
11 -#define REPLACE_IFOLDER  'o'
12 +#define REPLACE_ALWAYS        'a'
13 +#define REPLACE_IFNEWER       'w'
14 +#define REPLACE_NEVER         'n'
15 +#define REPLACE_IFOLDER       'o'
16 +#define REPLACE_ATTR_ALWAYS   'r'
17 +#define REPLACE_ATTR_IFEXISTS 's'
18  
19  /* This probably should be done on a machine by machine basis, but it works */
20  /* This is critical for the smartalloc routines to properly align memory */
21 diff -Naur cvs/src/dird/dird_conf.c my/src/dird/dird_conf.c
22 --- cvs/src/dird/dird_conf.c    2006-12-22 20:47:00.000000000 +0100
23 +++ my/src/dird/dird_conf.c     2006-12-30 17:30:42.000000000 +0100
24 @@ -467,6 +467,8 @@
25     {"ifnewer",        REPLACE_IFNEWER},
26     {"ifolder",        REPLACE_IFOLDER},
27     {"never",          REPLACE_NEVER},
28 +   {"attributes",     REPLACE_ATTR_ALWAYS},
29 +   {"attributesifexists", REPLACE_ATTR_IFEXISTS},
30     {NULL,               0}
31  };
32  
33 diff -Naur cvs/src/filed/restore.c my/src/filed/restore.c
34 --- cvs/src/filed/restore.c     2006-12-21 13:53:48.000000000 +0100
35 +++ my/src/filed/restore.c      2006-12-30 17:22:29.000000000 +0100
36 @@ -383,6 +383,12 @@
37                 extract = true;
38              }
39  #endif
40 +            if (jcr->replace == REPLACE_ATTR_ALWAYS   ||
41 +                jcr->replace == REPLACE_ATTR_IFEXISTS)
42 +            {
43 +               extract = false;        /* we just want attributes */
44 +            }
45 +
46              if (!extract) {
47                 /* set attributes now because file will not be extracted */
48                 set_attributes(jcr, attr, &bfd);
49 diff -Naur cvs/src/findlib/create_file.c my/src/findlib/create_file.c
50 --- cvs/src/findlib/create_file.c       2006-12-20 20:48:59.000000000 +0100
51 +++ my/src/findlib/create_file.c        2006-12-30 17:29:17.000000000 +0100
52 @@ -135,9 +135,17 @@
53           Qmsg(jcr, M_SKIPPED, 0, _("File skipped. Already exists: %s\n"), attr->ofname);
54           return CF_SKIP;
55  
56 +      case REPLACE_ATTR_ALWAYS:
57 +         return CF_CREATED;
58 +
59        case REPLACE_ALWAYS:
60           break;
61        }
62 +   } else { /* File doesn't exists anymore */
63 +      if (replace == REPLACE_ATTR_IFEXISTS) {
64 +         Qmsg(jcr, M_SKIPPED, 0, _("File skipped. Doesn't exists anymore: %s\n"), attr->ofname);         
65 +         return CF_SKIP;
66 +      }
67     }
68     switch (attr->type) {
69     case FT_RAW:                       /* raw device to be written */