NetBSD pkgsrc (which has 2.4.4p1, old I know) has patches to check for
and use -X (patch-ae to -ai in sysutils/amanda-client).  These are
messier than they need to be because configure is patched as well as
configure.in.

Unfortunately FreeBSD and NetBSD dump have different options; L on
NetBSD is for a label, and -x and -X are for snapshots via fss(4) and
fs-internal

Probably the right approach is to add a configure option, have it
look for the right (system-dependent) flag, and pass that in an
AC_SUBST variable.

This doesn't support the solaris snapshot mechanism; there installing
a script ufsdump_snapshot and calling it instead seems like a
reasonable thing to do.  That could be triggered by the same --enable
call, though, since it's semantically equivalent I think.

From pkgsrc:

$NetBSD: patch-ae,v 1.8 2006/03/16 19:13:57 bouyer Exp $

--- configure.in.orig   2004-10-22 15:12:14.000000000 +0200
+++ configure.in        2006-02-17 17:22:12.000000000 +0100
@@ -1488,6 +1488,44 @@
        AC_DEFINE(HAVE_HONOR_NODUMP,1,[Define this if dump accepts -h for 
honoring nodump. ])
       fi
     ])
+    AC_ARG_WITH(dump-use-snapshot,
+    [  --with-dump-use-snapshot  if dump supports -X, use it],
+    [ if test -x $DUMP; then
+        AC_CACHE_CHECK(
+         [whether $DUMP supports -X (use filesystem snapshot)],
+         amanda_cv_use_snapshot,
+         [
+           case "$DUMP" in
+           *dump)
+               AC_TRY_COMMAND($DUMP 9Xf /dev/null /dev/null/invalid/fs 2>&1
+                   | $GREP -v Dumping
+                   | $GREP -v Date
+                   | $GREP -v Label >conftest.d-x 2>&1)
+               cat conftest.d-x >&AS_MESSAGE_LOG_FD()
+               AC_TRY_COMMAND($DUMP 9f /dev/null /dev/null/invalid/fs 2>&1
+                   | $GREP -v Dumping
+                   | $GREP -v Date
+                   | $GREP -v Label >conftest.d 2>&1)
+               cat conftest.d >&AS_MESSAGE_LOG_FD()
+               if AC_TRY_COMMAND(diff conftest.d-x conftest.d 1>&2); then
+                   amanda_cv_use_snapshot=yes
+               else
+                   amanda_cv_use_snapshot=no
+               fi
+               rm -f conftest.d conftest.d-x
+             ;;
+           *) amanda_cv_use_snapshot=no
+             ;;
+           esac
+         ])
+      else
+       AC_MSG_WARN([*** $DUMP is not executable, cannot run -X test])
+       amanda_cv_use_snapshot=no
+      fi
+      if test "$amanda_cv_use_snapshot" = yes; then
+       AC_DEFINE(HAVE_DUMP_SNAPSHOT,1,[Define this if dump accepts -X for 
using snapshots. ])
+      fi
+    ])
 fi
 
 AC_PATH_PROGS(XFSDUMP,xfsdump,,$SYSLOCPATH)
$NetBSD: patch-af,v 1.4 2006/03/16 19:13:57 bouyer Exp $

--- config/config.h.in.orig     2006-02-17 18:06:04.000000000 +0100
+++ config/config.h.in  2006-02-17 18:06:46.000000000 +0100
@@ -373,6 +373,9 @@
 /* Define this if dump accepts -h for honoring nodump. */
 #undef HAVE_HONOR_NODUMP
 
+/* Define this if dump accepts -X for filesystem snapshot. */
+#undef HAVE_DUMP_SNAPSHOT
+
 /* Define to enable HPUX tape-changer support. */
 #undef HAVE_HPUX_LIKE_SCSI
 
$NetBSD: patch-ag,v 1.4 2006/03/16 19:13:57 bouyer Exp $

--- client-src/sendbackup-dump.c.orig   2006-02-17 18:07:17.000000000 +0100
+++ client-src/sendbackup-dump.c        2006-02-17 18:08:53.000000000 +0100
@@ -310,6 +310,9 @@
 #ifdef HAVE_HONOR_NODUMP
                             "h",
 #endif
+#ifdef HAVE_DUMP_SNAPSHOT
+                            "X",
+#endif
                             "f",
                             NULL);
 
$NetBSD: patch-ah,v 1.1 2006/03/16 19:13:57 bouyer Exp $

--- client-src/sendsize.c.orig  2006-02-17 18:09:16.000000000 +0100
+++ client-src/sendsize.c       2006-02-17 18:09:54.000000000 +0100
@@ -873,6 +873,9 @@
 #  ifdef HAVE_HONOR_NODUMP                             /* { */
                             "h",
 #  endif                                               /* } */
+#  ifdef HAVE_DUMP_SNAPSHOT                            /* { */
+                            "X",
+#  endif                                               /* } */
                             "s", "f", NULL);
 
 #  ifdef HAVE_DUMP_ESTIMATE
$NetBSD: patch-ai,v 1.1 2006/03/16 19:13:57 bouyer Exp $

--- configure.orig      2004-10-22 15:12:36.000000000 +0200
+++ configure   2006-02-17 18:15:31.000000000 +0100
@@ -1094,6 +1094,7 @@
   --with-debug-days=NN    number of days to keep debugging files default=4
   --with-testing=suffix use alternate service names
   --with-dump-honor-nodump  if dump supports -h, use it for level0s too
+  --with-dump-use-snapshot  if dump supports -X, use it
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
@@ -9701,6 +9702,72 @@
       fi
 
 fi;
+
+# Check whether --with-dump-use-snapshot or --without-dump-use-snapshot was 
given.
+if test "${with_dump_use_snapshot+set}" = set; then
+  withval="$with_dump_use_snapshot"
+   if test -x $DUMP; then
+        echo "$as_me:$LINENO: checking whether $DUMP supports -X (use 
filesystem snapshot)" >&5
+echo $ECHO_N "checking whether $DUMP supports -X (use filesystem snapshot)... 
$ECHO_C" >&6
+if test "${amanda_cv_use_snapshot+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+           case "$DUMP" in
+           *dump)
+               { ac_try='$DUMP 9Xf /dev/null /dev/null/invalid/fs 2>&1
+                   | $GREP -v Dumping
+                   | $GREP -v Date
+                   | $GREP -v Label >conftest.d-x 2>&1'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }
+               cat conftest.d-x >&5
+               { ac_try='$DUMP 9f /dev/null /dev/null/invalid/fs 2>&1
+                   | $GREP -v Dumping
+                   | $GREP -v Date
+                   | $GREP -v Label >conftest.d 2>&1'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }
+               cat conftest.d >&5
+               if { ac_try='diff conftest.d-x conftest.d 1>&2'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+                   amanda_cv_use_snapshot=yes
+               else
+                   amanda_cv_use_snapshot=no
+               fi
+               rm -f conftest.d conftest.d-x
+             ;;
+           *) amanda_cv_use_snapshot=no
+             ;;
+           esac
+
+fi
+echo "$as_me:$LINENO: result: $amanda_cv_use_snapshot" >&5
+echo "${ECHO_T}$amanda_cv_use_snapshot" >&6
+      else
+       { echo "$as_me:$LINENO: WARNING: *** $DUMP is not executable, cannot 
run -X test" >&5
+echo "$as_me: WARNING: *** $DUMP is not executable, cannot run -X test" >&2;}
+       amanda_cv_use_snapshot=no
+      fi
+      if test "$amanda_cv_use_snapshot" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DUMP_SNAPSHOT 1
+_ACEOF
+
+      fi
+
+fi;
 fi
 
 for ac_prog in xfsdump



-- 
    Greg Troxel <[EMAIL PROTECTED]>

Attachment: pgpUb4jngLOiA.pgp
Description: PGP signature

Reply via email to