3. Solution

The idea of a solution is the following: let AMANDA use a wrapper program instead of tar. The wrapper will still call tar internally to do the backup job, but for vfat filesystems it will pass different parameters to tar than for the ext2 ones.

3.1. Modifying the AMANDA code

I decided to use --newer-mtime (which worked fine in a test run) for the vfat filesystems and --listed-incremental for the rest. In order to do this I needed to write my own gtar-wrapper script. I also needed _both_ options to be passed to gtar-wrapper, which would then decide which one to pass to tar. For this, the following has been entered in 2 places in client-src/sendsize.c:

#ifdef GNUTAR_LISTED_INCREMENTAL_DIR
                        "--listed-incremental", incrname,
 
/* Changed by root.
 * I want to use my own gtar-wrapper script.
 * For this I need _all_  the options relevant to
 * incrementals, so I just commented this "#else" here.
 
#else
 
 
 */
 
                        "--incremental", "--newer-mtime", dumptimestr,
#endif
                        "--sparse","--one-file-system",

(just search for GNUTAR_LISTED_INCREMENTAL_DIR). In sendbackup-gnutar.c:

 
      {
        char *format_buf;
        char *a00, *a01, *a02, *a03, *a04, *a05;
        char *a06, *a07, *a08, *a09, *a10, *a11;
 
        /* Changed by root.
         * incr1 and incr2 instead of just incr.
         * They are both needed in the print statement below.
         */
 
        char *incr1;
        char *incr2;
        char *tarcmd;
 

and:

 
 
#ifdef GNUTAR_LISTED_INCREMENTAL_DIR
 
/*      Changed by root.
        Original code:
 
        a03 = " --listed-incremental %s";
#else
        a03 = " --incremental --newer-mtime %s";
 */
        a03 = " --listed-incremental %s --incremental --newer-mtime %s";
#endif

and:

/* Changed by root.
 * incr1 and incr2, instead of just incr1
 */
#ifdef GNUTAR_LISTED_INCREMENTAL_DIR
        incr1 = incrname;
/* #else */
        incr2 = dumptimestr;
#endif
 
        /* Changed by root.
         * incr1 and incr2, instead of just incr1
         */
        dbprintf((format_buf, dumppid, cmd, dirname, incr1, incr2,
                  efile ? efile : "."));
        amfree(format_buf);
      }

Finally, in /usr/src/packages/SOURCES/amanda-2.4.1p1.dif:

--with-gnutar=/usr/local/bin/gtar-wrapper

Do not forget: also in config/config.h:

#define GNUTAR "/usr/local/bin/gtar-wrapper"

(this is necessary, since I don't run configure every time).

3.2. The gtar-wrapper script

The wrapper script, called "gtar-wrapper" is a direct modification of the "gtar-wrapper" script that comes with AMANDA. It determines if the directory is on a vfat or an ext2 filesystem and then eliminates the parameters in the argument list that do not fit. Remember that AMANDA passes --listed-incremental as well as --incremental, --newer-mtime and date to gtar-wrapper, due to the changes in the code above. So gtar-wrapper's job is to call tar with --listed-incremental eliminated from the parameter list, if it the filesystem is vfat - and to call tar with --incremental, --newer-mtime and the date eliminated from the parameter list, if it is ext2. You will find my gtar-wrapper script here.