]> git.sur5r.net Git - bacula/bacula/commitdiff
- Add tests for dvd+rw-format in configure script.
authorNicolas Boichat <nicolas@boichat.ch>
Mon, 17 Oct 2005 22:03:52 +0000 (22:03 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Mon, 17 Oct 2005 22:03:52 +0000 (22:03 +0000)
 - scripts/dvd-handler: Reformat DVD-RW when needed. This needs dvd+rw-format.
 - Add patch for dvd+rw-tools in patches dir (this should probably be elsewhere).

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2455 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/autoconf/configure.in
bacula/configure
bacula/nb-1.37
bacula/patches/dvd+rw-tools-5.21.4.10.8.bacula.patch [new file with mode: 0644]
bacula/scripts/dvd-handler.in

index 9b1e5152c3bd9a3badf0099fd2bc308295c57843..3023993568be7329cc6bda06a84d05159966cb12 100644 (file)
@@ -69,6 +69,7 @@ AC_PATH_PROG(MKISOFS, mkisofs, mkisofs)
 AC_PATH_PROG(PYTHON, python, python)
 AC_PATH_PROG(GROWISOFS, growisofs, growisofs)
 AC_PATH_PROG(DVDRWMEDIAINFO, dvd+rw-mediainfo, dvd+rw-mediainfo)
+AC_PATH_PROG(DVDRWFORMAT, dvd+rw-format, dvd+rw-format)
 AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
 AC_ARG_VAR(WXCONFIG, [wx-config command. On some systems, you must set it to wx-config-2.6 to use wxWidgets 2.6.])
 if test "x$WXCONFIG" = x; then
@@ -1908,8 +1909,6 @@ AC_OUTPUT([autoconf/Make.common \
           scripts/bacula.desktop.gnome2.xsu \
           scripts/gnome-console.console_apps \
           scripts/mtx-changer \
-          scripts/dvd-writepart \
-          scripts/dvd-freespace \
           scripts/dvd-handler \
           scripts/bacula-tray-monitor.desktop \
           scripts/logwatch/Makefile \
@@ -1988,7 +1987,7 @@ AC_OUTPUT([autoconf/Make.common \
 
 cd scripts
 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
-chmod 755 dvd-writepart dvd-freespace dvd-handler
+chmod 755 dvd-handler
 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
 cd ..
 
index 692a7f9f555c34a8d055cec9210e934a2a696940..b77b67fc95899ff24a6de4e80b6bed7fa37986af 100755 (executable)
@@ -309,7 +309,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED ECHO CMP TBL AR OPENSSL MTX DF MKISOFS PYTHON GROWISOFS DVDRWMEDIAINFO PKGCONFIG WXCONFIG WXFLAGS CDRECORD PIDOF AWK ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE SET_MAKE MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE INTL_MACOSX_LIBS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB GLIBC2 ALLOCA GLIBC21 HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS DIRD_DIR DIR_TOOLS STORED_DIR CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC PYTHON_LIBS PYTHON_INCDIR OPENSSL_LIBS OPENSSL_INC working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS WRAPLIBS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED ECHO CMP TBL AR OPENSSL MTX DF MKISOFS PYTHON GROWISOFS DVDRWMEDIAINFO DVDRWFORMAT PKGCONFIG WXCONFIG WXFLAGS CDRECORD PIDOF AWK ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE SET_MAKE MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE INTL_MACOSX_LIBS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB GLIBC2 ALLOCA GLIBC21 HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS DIRD_DIR DIR_TOOLS STORED_DIR CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC PYTHON_LIBS PYTHON_INCDIR OPENSSL_LIBS OPENSSL_INC working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS WRAPLIBS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS'
 ac_subst_files='MCOMMON'
 
 # Initialize some variables set by options.
@@ -4016,6 +4016,46 @@ else
 echo "${ECHO_T}no" >&6
 fi
 
+# Extract the first word of "dvd+rw-format", so it can be a program name with args.
+set dummy dvd+rw-format; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_DVDRWFORMAT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $DVDRWFORMAT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DVDRWFORMAT="$DVDRWFORMAT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_DVDRWFORMAT="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_DVDRWFORMAT" && ac_cv_path_DVDRWFORMAT="dvd+rw-format"
+  ;;
+esac
+fi
+DVDRWFORMAT=$ac_cv_path_DVDRWFORMAT
+
+if test -n "$DVDRWFORMAT"; then
+  echo "$as_me:$LINENO: result: $DVDRWFORMAT" >&5
+echo "${ECHO_T}$DVDRWFORMAT" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
 # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
 echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -29653,7 +29693,7 @@ if test "x${subsysdir}" = "x${sbindir}" ; then
    exit 1
 fi
 
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ac_config_files="$ac_config_files autoconf/Make.common Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/gnome-console.console_apps scripts/mtx-changer scripts/dvd-writepart scripts/dvd-freespace scripts/dvd-handler scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/gnome-console.conf src/wx-console/Makefile src/wx-console/wx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/filed/win32/Makefile src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile src/win32/winbacula.nsi src/win32/baculafd/bacula-fd.conf src/win32/Makefile src/win32/console/bconsole.conf src/win32/wx-console/wx-console.conf src/win32/pebuilder/Makefile po/Makefile.in $PFILES"
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ac_config_files="$ac_config_files autoconf/Make.common Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/gnome-console.console_apps scripts/mtx-changer scripts/dvd-handler scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/gnome-console.conf src/wx-console/Makefile src/wx-console/wx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/filed/win32/Makefile src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile src/win32/winbacula.nsi src/win32/baculafd/bacula-fd.conf src/win32/Makefile src/win32/console/bconsole.conf src/win32/wx-console/wx-console.conf src/win32/pebuilder/Makefile po/Makefile.in $PFILES"
           ac_config_commands="$ac_config_commands default"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -30217,8 +30257,6 @@ do
   "scripts/bacula.desktop.gnome2.xsu" ) CONFIG_FILES="$CONFIG_FILES scripts/bacula.desktop.gnome2.xsu" ;;
   "scripts/gnome-console.console_apps" ) CONFIG_FILES="$CONFIG_FILES scripts/gnome-console.console_apps" ;;
   "scripts/mtx-changer" ) CONFIG_FILES="$CONFIG_FILES scripts/mtx-changer" ;;
-  "scripts/dvd-writepart" ) CONFIG_FILES="$CONFIG_FILES scripts/dvd-writepart" ;;
-  "scripts/dvd-freespace" ) CONFIG_FILES="$CONFIG_FILES scripts/dvd-freespace" ;;
   "scripts/dvd-handler" ) CONFIG_FILES="$CONFIG_FILES scripts/dvd-handler" ;;
   "scripts/bacula-tray-monitor.desktop" ) CONFIG_FILES="$CONFIG_FILES scripts/bacula-tray-monitor.desktop" ;;
   "scripts/logwatch/Makefile" ) CONFIG_FILES="$CONFIG_FILES scripts/logwatch/Makefile" ;;
@@ -30418,6 +30456,7 @@ s,@MKISOFS@,$MKISOFS,;t t
 s,@PYTHON@,$PYTHON,;t t
 s,@GROWISOFS@,$GROWISOFS,;t t
 s,@DVDRWMEDIAINFO@,$DVDRWMEDIAINFO,;t t
+s,@DVDRWFORMAT@,$DVDRWFORMAT,;t t
 s,@PKGCONFIG@,$PKGCONFIG,;t t
 s,@WXCONFIG@,$WXCONFIG,;t t
 s,@WXFLAGS@,$WXFLAGS,;t t
@@ -31304,7 +31343,7 @@ fi
 
 cd scripts
 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
-chmod 755 dvd-writepart dvd-freespace dvd-handler
+chmod 755 dvd-handler
 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
 cd ..
 
index 1beab53b961f7680e03ee164e4c398614b232700..291ed0d1904a1308abc42de106abcb9b144ffd7c 100644 (file)
@@ -5,6 +5,9 @@ General:
 
 Changes to 1.37.*:
 16Oct05
+ - Add tests for dvd+rw-format in configure script.
+ - scripts/dvd-handler: Reformat DVD-RW when needed. This needs dvd+rw-format.
+ - Add patch for dvd+rw-tools in patches dir (this should probably be elsewhere).
  - Remove scripts/dvd-freespace and scripts/dvd-writepart, as they are now
    merged into scripts/dvd-handler. Note: Documentation needs to be updated.
  - scripts/dvd-handler: "zero" brand-new DVD+/-RW to fix a problem with some
diff --git a/bacula/patches/dvd+rw-tools-5.21.4.10.8.bacula.patch b/bacula/patches/dvd+rw-tools-5.21.4.10.8.bacula.patch
new file mode 100644 (file)
index 0000000..92e9b05
--- /dev/null
@@ -0,0 +1,86 @@
+diff -u dvd+rw-tools-5.21.4.10.8/growisofs.c dvd+rw-tools-5.22/growisofs.c
+--- dvd+rw-tools-5.21.4.10.8/growisofs.c       2004-08-25 01:02:29.000000000 +0200
++++ dvd+rw-tools-5.22/growisofs.c      2005-10-16 22:48:02.000000000 +0200
+@@ -315,12 +315,17 @@
+  * - Linux: fix for kernel version 2.6>=8, 2.6.8 itself is deficient,
+  *   but the problem can be worked around by installing this version
+  *   set-root-uid;
++ * 5.22: (by Nicolas Boichat, Bacula project)
++ * - Allow session to cross 4GB boundary regardless of medium type
++ *   (don't need to have a DL media)
++ * - Add a -F option (used instead of -M or -Z), which displays next_session
++ *   offset and capacity (free space = next_session - capacity).
+  */
+ #define PRINT_VERSION(cmd)    do {                    \
+     char *s=strrchr((cmd),'/');                               \
+     s ? s++ : (s=(cmd));                              \
+     printf ("* %.*sgrowisofs by <appro@fy.chalmers.se>,"\
+-          " version 5.21,\n",(int)(s-(cmd)),(cmd));   \
++          " version 5.22,\n",(int)(s-(cmd)),(cmd));   \
+ } while (0)
+ #define _LARGEFILE_SOURCE 
+@@ -1720,6 +1725,18 @@
+               else          in_device = argv[++i];
+               dev_found = 'Z';
+           }
++          else if (argv[i][1] == 'F')
++          {   if (len > 2) in_device = argv[i]+2;
++              else         in_device = argv[++i];
++              dev_found = 'F';
++              dry_run = 1; /* NEVER write anything with -F */
++          }
++          else if (!strncmp(opt,"-free-space",11))
++          {   if (len > 11) in_device = opt+11;
++              else          in_device = argv[++i];
++              dev_found = 'F';
++              dry_run = 1; /* NEVER write anything with -F */
++          }
+           else if (!strcmp(opt,"-poor-man"))
+           {   if (poor_man<0) poor_man = 1;
+               continue;
+@@ -1908,7 +1925,9 @@
+               fprintf (stderr,"    you most likely want to use -Z option.\n"), 
+               exit (FATAL_START(errno));
+-          if (dev_found == 'M')
++          if ((dev_found == 'M') || 
++                      ((dev_found == 'F') && !(mmc_profile&0x10000)) && (the_buffer[0] || the_buffer[1] || the_buffer[2]))
++                              /* -F : The medium is not blank, there is a fs on it (the_buffer[0,1 or 2] != 0), so compute next_session. */
+           {   if (memcmp (the_buffer,"\1CD001",6))
+                   fprintf (stderr,":-( %s doesn't look like isofs...\n",
+                               in_device), exit(FATAL_START(EMEDIUMTYPE));
+@@ -1932,7 +1951,7 @@
+                       exit(FATAL_START(EINVAL));
+               }
+               else if (next_session > (0x200000-0x5000)) /* 4GB/2K-40MB/2K */
+-                  if ((mmc_profile&0xFFFF)!=0x2B || !no_4gb_check)
++                  if (!no_4gb_check)
+                       fprintf (stderr,":-( next session would cross 4GB "
+                                       "boundary, aborting...\n"),
+                       exit (FATAL_START(ENOSPC));
+@@ -1974,7 +1993,7 @@
+       exit (FATAL_START(EINVAL));
+     if (imgfd<0)
+-    { if (mkisofs_argc==1)
++    { if ((mkisofs_argc==1) && (dev_found != 'F'))
+           fprintf (stderr,"%s: no mkisofs options specified, "
+                           "aborting...\n",argv[0]),
+           exit (FATAL_START(EINVAL));
+@@ -2114,6 +2133,15 @@
+       }
+     }
++      if (dev_found == 'F') {
++              off64_t capacity = 0;
++              printf("next_session=%lld\n", next_session*CD_BLOCK);
++              if (ioctl_handle!=INVALID_HANDLE)
++                      capacity = get_capacity (ioctl_handle);
++              printf("capacity=%lld\n", capacity);
++              exit(0);
++      }
++
+     if (imgfd>=0)
+     { quiet--;
+       if (builtin_dd (imgfd,out_fd,next_session*CD_BLOCK) < 0)
index fdae793164e70dc7533d6027a782664f3b35212a..44aabb8e867effa8b257182a2c6f9c93f5d7b817 100644 (file)
@@ -26,62 +26,20 @@ import re
 import signal
 import time
 
+class disk:
 # Configurable values:
-dvdrwmediainfo = "@DVDRWMEDIAINFO@"
-growcmd = "@GROWISOFS@"
-margin = 10485760 # 10 mb security margin
+   
+   dvdrwmediainfo = "@DVDRWMEDIAINFO@"
+   growcmd = "@GROWISOFS@"
+   dvdrwformat = "@DVDRWFORMAT@"
+   margin = 10485760 # 10 mb security margin
 
-# Comment the following line if you want the tray to be reloaded
-# when writing ends.
-growcmd += " -use-the-force-luke=notray"
+   # Comment the following line if you want the tray to be reloaded
+   # when writing ends.
+   growcmd += " -use-the-force-luke=notray"
 
 # end of configurable values
 
-## Check if we want to allow growisofs to cross the 4gb boundary
-def is4gbsupported():
-   processi = popen2.Popen4("uname -s -r")
-   status = processi.wait()
-   if not os.WIFEXITED(status):
-#      print "dvd-writepart: Cannot execute uname, allowing to cross the 4gb boundary."
-      return 1
-   if os.WEXITSTATUS(status) != 0:
-#      print "dvd-writepart: Cannot execute uname, allowing to cross the 4gb boundary."
-      return 1
-   strres = processi.fromchild.readline()[0:-1]
-   res = strres.split(" ")
-   if len(res) != 2:
-#      print "dvd-writepart: Unable to parse uname (" + strres + "), allowing to cross the 4gb boundary."
-      return 1
-   if res[0] != "Linux":
-#      print "dvd-writepart: The current OS is no Linux, allowing to cross the 4gb boundary."
-      return 1
-   ver = res[1].split(".")
-   if len(ver) < 3:
-#      print "dvd-writepart: Unable to parse version string (" + res[1] + "), allowing to cross the 4gb boundary."
-      return 1
-   subver = ver[2].split("-")
-   
-   if ((not ver[0].isdigit()) or (not ver[1].isdigit()) or (not subver[0].isdigit())):
-#      print "dvd-writepart: Unable to parse version string (" + res[1] + "), allowing to cross the 4gb boundary."
-      return 1
-   
-   if (int(ver[0]) > 2) or (int(ver[1]) > 6) or ((int(ver[0]) == 2) and (int(ver[1]) == 6) and (int(subver[0]) >= 8)):
-#      print "dvd-writepart: Kernel version >=2.6.8, allowing to cross the 4gb boundary."
-      return 1
-   else:
-#      print "dvd-writepart: Kernel version <2.6.8, not allowing to cross the 4gb boundary."
-      return 0
-
-class DVDError(Exception):
-   def __init__(self, errno, value):
-      self.errno = errno
-      self.value = value
-      if self.value[-1] == '\n':
-         self.value = self.value[0:-1]
-   def __str__(self):
-      return str(self.value) + " || errno = " + str(self.errno) + " (" + os.strerror(self.errno & 0x7F) + ")"
-
-class disk:
 ###############################################################################
 #
 # This class represents DVD disk informations.
@@ -113,6 +71,7 @@ class disk:
    def __init__(self, devicename):
       self.device = devicename
       self.disktype = "none"
+      self.diskmode = "none"
       self.diskstatus = "none"
       self.hardwaredevice = "none"
       self.pid = 0
@@ -122,6 +81,14 @@ class disk:
       self.freespace_collected = 0
       self.mediumtype_collected = 0
 
+      self.growcmd += " -quiet"
+
+      if self.is4gbsupported():
+         self.growcmd += " -use-the-force-luke=4gms"
+
+      self.growparams = " -A 'Bacula Data' -input-charset=default -iso-level 3 -pad " + \
+                        "-p 'dvd-handler / growisofs' -sysid 'BACULADATA' -R"
+
       return
 
    def __repr__(self):
@@ -134,13 +101,32 @@ class disk:
          self.collect_mediumtype();
       
       self.me  = "Class disk, initialized with device '" + self.device + "'\n"
-      self.me += "type = '" + self.disktype + "' status = '" + self.diskstatus + "'\n"
+      self.me += "type = '" + self.disktype + "' mode='" + self.diskmode + "' status = '" + self.diskstatus + "'\n"
       self.me += " next_session = " + str(self.next_session) + " capacity = " + str(self.capacity) + "\n"
       self.me += "Hardware device is '" + self.hardwaredevice + "'\n"
+      self.me += "growcmd = '" + self.growcmd + "'\ngrowparams = '" + self.growparams + "'\n"
       return self.me
 
+   ## Check if we want to allow growisofs to cross the 4gb boundary
+   def is4gbsupported(self):
+      processi = popen2.Popen4("uname -s -r")
+      status = processi.wait()
+      if not os.WIFEXITED(status):
+         return 1
+      if os.WEXITSTATUS(status) != 0:
+         return 1
+      strres = processi.fromchild.readline()[0:-1]
+      version = re.search(r"Linux (\d+)\.(\d+)\.(\d+)", strres)
+      if not version: # Non-Linux: allow
+         return 1
+      
+      if (int(version.group(1)) > 2) or (int(version.group(2)) > 6) or ((int(version.group(1)) == 2) and (int(version.group(2)) == 6) and (int(version.group(3)) >= 8)):
+         return 1
+      else:
+         return 0
+
    def collect_freespace(self): # Collects current free space
-      self.cmd = growcmd + " -F " + self.device
+      self.cmd = self.growcmd + " -F " + self.device
       processi = popen2.Popen4(self.cmd)
       status = processi.wait()
       if not os.WIFEXITED(status):
@@ -156,7 +142,7 @@ class disk:
          else:
             raise DVDError(os.WEXITSTATUS(status), "growisofs returned with an error " + result + ". Please check your are using a patched version of dvd+rw-tools.")
       next_sess = re.search(r"\snext_session=(\d+)\s", result, re.MULTILINE)
-      capa = re.search(r"\capacity=(\d+)\s", result, re.MULTILINE)
+      capa = re.search(r"\scapacity=(\d+)\s", result, re.MULTILINE)
    
       if next_sess and capa:
          self.next_session = long(next_sess.group(1))
@@ -173,18 +159,19 @@ class disk:
    
    def collect_mediumtype(self): # Collects current medium type
       self.lasterror = ""
-      cmd = dvdrwmediainfo + " " + self.device
+      cmd = self.dvdrwmediainfo + " " + self.device
       processi = popen2.Popen4(cmd)
       status = processi.wait()
       if not os.WIFEXITED(status):
-         raise DVDError(dvdrwmediainfo + " process did not exit correctly.")
+         raise DVDError(self.dvdrwmediainfo + " process did not exit correctly.")
       if os.WEXITSTATUS(status) != 0:
-         raise DVDError("Cannot get media info from " + dvdrwmediainfo)
+         raise DVDError("Cannot get media info from " + self.dvdrwmediainfo)
          return
       result = processi.fromchild.read()
       
       hardware = re.search(r"INQUIRY:\s+(.*)\n", result, re.MULTILINE)
       mediatype = re.search(r"\sMounted Media:\s+([0-9A-F]{2})h, (\S*)\s", result, re.MULTILINE)
+      mediamode = re.search(r"\sMounted Media:\s+[0-9A-F]{2}h, \S* (.*)\n", result, re.MULTILINE)
       status = re.search(r"\sDisc status:\s+(.*)\n", result, re.MULTILINE)
       
       if hardware:
@@ -193,12 +180,18 @@ class disk:
       if mediatype:
          self.disktype = mediatype.group(2)
       else:
-         raise DVDError("Media type not found in " + dvdrwmediainfo + " output")
+         raise DVDError("Media type not found in " + self.dvdrwmediainfo + " output")
+      
+      if self.disktype == "DVD-RW":
+         if mediamode:
+            self.diskmode = mediamode.group(1)
+         else:
+            raise DVDError("Media mode not found for DVD-RW in " + self.dvdrwmediainfo + " output")
       
       if status:
          self.diskstatus = status.group(1)
       else:
-         raise DVDError("Disc status not found in " + dvdrwmediainfo + " output")
+         raise DVDError("Disc status not found in " + self.dvdrwmediainfo + " output")
 
       
       self.mediumtype_collected = 1
@@ -213,9 +206,23 @@ class disk:
    def is_RW(self):
       if not self.mediumtype_collected:
          self.collect_mediumtype();
-      
       return "DVD-RW" == self.disktype or "DVD+RW" == self.disktype or "DVD-RAM" == self.disktype
 
+   def is_plus_RW(self):
+      if not self.mediumtype_collected:
+         self.collect_mediumtype();
+      return "DVD+RW" == self.disktype
+
+   def is_minus_RW(self):
+      if not self.mediumtype_collected:
+         self.collect_mediumtype();
+      return "DVD-RW" == self.disktype
+      
+   def is_restricted_overwrite(self):
+      if not self.mediumtype_collected:
+         self.collect_mediumtype();
+      return self.diskmode == "Restricted Overwrite"
+
    def is_blank(self):
       if not self.mediumtype_collected:
          self.collect_mediumtype();
@@ -226,7 +233,7 @@ class disk:
       if not self.freespace_collected:
          self.collect_freespace();
       
-      fr = self.capacity-self.next_session-margin
+      fr = self.capacity-self.next_session-self.margin
       if fr < 0:
          return 0
       else:
@@ -243,13 +250,18 @@ class disk:
          sys.exit(1)
 
    def write(self, newvol, partfile):
-      # Blank DVD+/-RW/-RAM when there is no data on it
-      if newvol and self.is_RW() and self.is_blank():
-         print "DVD+/-RW looks brand-new, blank it to fix some DVD-writers bugs."
+      # Blank DVD+RW when there is no data on it
+      if newvol and self.is_plus_RW() and self.is_blank():
+         print "DVD+RW looks brand-new, blank it to fix some DVD-writers bugs."
          self.blank()
-         print "Done, now writing the real part file."
+         print "Done, now writing the part file."
+      
+      if newvol and self.is_minus_RW() and (not self.is_restricted_overwrite()):
+         print "DVD-RW is in " + self.diskmode + " mode, reformating it to Restricted Overwrite"
+         self.reformat_minus_RW()
+         print "Done, now writing the part file."
       
-      cmd = growcmd + growparams
+      cmd = self.growcmd + self.growparams
       if newvol:
          cmd += " -Z "
       else:
@@ -274,7 +286,27 @@ class disk:
          raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
 
    def blank(self):
-      cmd = growcmd + " -Z " + self.device + "=/dev/zero"
+      cmd = self.growcmd + " -Z " + self.device + "=/dev/zero"
+      print "Running " + cmd
+      oldsig = signal.signal(signal.SIGTERM, self.term_handler)
+      proc = popen2.Popen4(cmd)
+      self.pid = proc.pid
+      status = proc.poll()
+      while status == -1:
+         line = proc.fromchild.readline()
+         while len(line) > 0:
+            print line,
+            line = proc.fromchild.readline()
+         time.sleep(1)
+         status = proc.poll()
+      self.pid = 0
+      print
+      signal.signal(signal.SIGTERM, oldsig)
+      if os.WEXITSTATUS(status) != 0:
+         raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
+
+   def reformat_minus_RW(self):
+      cmd = self.dvdrwformat + " -force " + self.device
       print "Running " + cmd
       oldsig = signal.signal(signal.SIGTERM, self.term_handler)
       proc = popen2.Popen4(cmd)
@@ -295,6 +327,15 @@ class disk:
 
 # class disk ends here.
 
+class DVDError(Exception):
+   def __init__(self, errno, value):
+      self.errno = errno
+      self.value = value
+      if self.value[-1] == '\n':
+         self.value = self.value[0:-1]
+   def __str__(self):
+      return str(self.value) + " || errno = " + str(self.errno) + " (" + os.strerror(self.errno & 0x7F) + ")"
+
 def usage():
    print "Wrong number of arguments."
    print """
@@ -320,14 +361,6 @@ write      Write a part file to disk.
 if len(sys.argv) < 3:
    usage()
 
-growcmd += " -quiet"
-if is4gbsupported():
-   growcmd += " -use-the-force-luke=4gms"
-
-growparams = " -A 'Bacula Data' -input-charset=default -iso-level 3 -pad " + \
-              "-p 'dvd-handler / growisofs' -sysid 'BACULADATA' -R"
-
 dvd = disk(sys.argv[1])
 
 if "free" == sys.argv[2]:
@@ -349,7 +382,7 @@ if "free" == sys.argv[2]:
 elif "test" == sys.argv[2]:
    try:
       print str(dvd)
-      print "Empty disk: " + str(dvd.is_empty()) + " ReWritable disk: " + str(dvd.is_RW())
+      print "Blank disk: " + str(dvd.is_blank()) + " ReWritable disk: " + str(dvd.is_RW())
       print "Free space: " + str(dvd.free())
    except DVDError, e:
       print "Error while getting informations: ", str(e)