Index: Portfile
===================================================================
--- Portfile	(revision 144276)
+++ Portfile	(working copy)
@@ -2,10 +2,10 @@
 # $Id$
 
 PortSystem          1.0
+PortGroup           perl5 1.0
 
 name                mysql-zrm
-version             2.0
-revision            2
+version             3.0
 categories          databases sysutils
 maintainers         bitwrangler.com:kmayer
 description         Zmanda Recovery Manager for MySQL
@@ -17,11 +17,15 @@
 homepage            http://www.zmanda.com/backup-mysql.html
 platforms           darwin
 master_sites        http://www.zmanda.com/downloads/community/ZRM-MySQL/${version}/Source/
-distname            MySQL-zrm-${version}
-checksums           md5 13a82abeb181d265af553770d1db6718 \
-                    sha1 fbc38a346755fb228296af2a447cb5fd74d5d246
-depends_lib         port:p5.16-dbi \
-                    port:p5.16-xml-parser
+distname            MySQL-zrm-${version}-release
+
+checksums           rmd160  0573cfbeee98626e17411fb17bda6d76c9ad041d \
+                    sha256  05e0342b190b6475f220014a126ed213442e24af7b6e3295fa914fcb47b1b931
+
+perl5.branches      5.22
+# these are probably just runtime dependencies?
+depends_lib         port:p${perl5.major}-dbi \
+                    port:p${perl5.major}-xml-parser
 use_configure       no
 patchfiles          patch-mysql-zrm-backup-0 \
                     patch-mysql-zrm-verify-backup-1 \
@@ -31,11 +35,19 @@
 destroot.keepdirs   ${destroot}${prefix}/var/lib/mysql-zrm \
                     ${destroot}${prefix}/var/log/mysql-zrm
 
+
+post-extract {
+    file mkdir ${worksrcpath}
+    foreach d {etc usr var} {
+        file rename ${workpath}/${d} ${worksrcpath}/${d}
+    }
+}
+
 post-patch {
     # Not the most efficient way to do this, but much more readable
     foreach f [exec find ${worksrcpath} -type f -print] {
         reinplace "s|/opt/csw/bin|${prefix}/bin|" ${f}
-        reinplace "s|/usr/bin/perl|${prefix}/bin/perl5.16|" ${f}
+        reinplace "s|/usr/bin/perl|${perl5.bin}|" ${f}
         reinplace "s|/usr/bin/mysql-zrm|${prefix}/bin/mysql-zrm|" ${f}
         reinplace "s|/usr/lib/mysql-zrm|${prefix}/lib/mysql-zrm|" ${f}
         reinplace "s|/usr/share/mysql-zrm|${prefix}/share/mysql-zrm|" ${f}
@@ -72,9 +84,9 @@
     eval xinstall -m 444 [glob ${worksrcpath}/usr/lib/mysql-zrm/ZRM/*] \
         ${destroot}${prefix}/lib/mysql-zrm/ZRM
 
-    xinstall -m 755 -d ${destroot}${prefix}/share/doc/MySQL-zrm-2.0
-    eval xinstall -m 444 [glob ${worksrcpath}/usr/share/doc/MySQL-zrm-2.0/*] \
-        ${destroot}${prefix}/share/doc/MySQL-zrm-2.0
+    xinstall -m 755 -d ${destroot}${prefix}/share/doc/MySQL-zrm-${version}
+    eval xinstall -m 444 [glob ${worksrcpath}/usr/share/doc/MySQL-zrm-${version}/*] \
+        ${destroot}${prefix}/share/doc/MySQL-zrm-${version}
 
     xinstall -m 755 -d ${destroot}${prefix}/share/man/man1
     eval xinstall -m 444 [glob ${worksrcpath}/usr/share/man/man1/*] \
@@ -95,3 +107,6 @@
     xinstall -m 755 -d ${destroot}${prefix}/var/lib/mysql-zrm
     xinstall -m 755 -d ${destroot}${prefix}/var/log/mysql-zrm
 }
+
+livecheck.url       http://www.zmanda.com/download-zrm.php
+livecheck.regex     {Release ([\d.]+)}
Index: files/patch-mysql-zrm-4
===================================================================
--- files/patch-mysql-zrm-4	(revision 144275)
+++ files/patch-mysql-zrm-4	(working copy)
@@ -1,11 +1,11 @@
---- ./usr/bin/mysql-zrm.orig	2008-04-07 10:40:12.000000000 -1000
-+++ ./usr/bin/mysql-zrm	2008-05-12 09:22:26.000000000 -1000
-@@ -27,7 +27,7 @@
- $ENV{'PATH'} = "/usr/local/bin:/opt/csw/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/ucb";
+--- usr/bin/mysql-zrm.orig
++++ usr/bin/mysql-zrm
+@@ -36,7 +36,7 @@ if ( $^O =~ /^MSWin/ ) {
+ 	$ZRM_BINPATH= catfile( $ZRM_HOME, "usr", "bin" );
+ } else {
+ 	$ENV{'PATH'} = "/usr/local/bin:/opt/csw/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/ucb";
+-	$ZRM_BINPATH="/usr/bin";
++	$ZRM_BINPATH="@BINPATH@";
+ }
  
- #path where ZRM utilities are installed
--my $ZRM_BINPATH="/usr/bin";
-+my $ZRM_BINPATH="@BINPATH@";
  
- my $USAGE="--action <backup|restore|schedule-backup|report|list|getconf|purge|parse-binlogs|check|verify-backup|extract-backup|abort-backup>\nHelp on individual action items can be obtained by specifying --help with the required action.\nFor example: 'mysql-zrm --action backup --help'";
- 
Index: files/patch-mysql-zrm-backup-0
===================================================================
--- files/patch-mysql-zrm-backup-0	(revision 144275)
+++ files/patch-mysql-zrm-backup-0	(working copy)
@@ -1,15 +1,15 @@
---- ./usr/bin/mysql-zrm-backup.orig	2008-04-07 10:40:12.000000000 -1000
-+++ ./usr/bin/mysql-zrm-backup	2008-05-08 10:36:55.000000000 -1000
-@@ -38,7 +38,7 @@
+--- usr/bin/mysql-zrm-backup.orig
++++ usr/bin/mysql-zrm-backup
+@@ -40,7 +40,7 @@ $SIG{'TERM'} = sub { $abort_flag = 1; };
+ $SIG{'PIPE'} = sub { &printWarning( "Communication pipe broke. Continuing\n" ); };
  
- $SIG{'TERM'} = sub { $abort_flag = 1; };
  
 -my $MD5SUM="md5sum";
 +my $MD5SUM="md5";
- my $MAILCMD="mail";
  
- #Neither mysqlhotcopy not mysqldump will do a --flush-logs 
-@@ -1504,7 +1504,7 @@
+ 
+ my $MAILCMD="";
+@@ -2035,7 +2035,7 @@ sub totalSize()
  				    $inputs{"synchronous-checksum"} == 1 ){
  					my $file = $File::Find::fullname;
  					if( -f $file ){
Index: files/patch-mysql-zrm-scheduler-3
===================================================================
--- files/patch-mysql-zrm-scheduler-3	(revision 144275)
+++ files/patch-mysql-zrm-scheduler-3	(working copy)
@@ -1,6 +1,6 @@
---- ./usr/bin/mysql-zrm-scheduler.orig	2008-04-07 10:40:12.000000000 -1000
-+++ ./usr/bin/mysql-zrm-scheduler	2008-05-12 09:19:31.000000000 -1000
-@@ -36,8 +36,8 @@
+--- usr/bin/mysql-zrm-scheduler.orig
++++ usr/bin/mysql-zrm-scheduler
+@@ -38,8 +38,8 @@ my $logdir="/var/log/mysql-zrm";
  my $confdir="/etc/mysql-zrm";
  my $def_dest="/var/lib/mysql-zrm";         # backup root
  my $logfile="$logdir/$prog.log";
@@ -11,7 +11,7 @@
  my $zrm_pre_backup="$pre_scheduler --action backup";
  my $zrm_backup="$zrm --action backup";
  my $zrm_purge="$zrm --action purge";
-@@ -160,7 +160,7 @@
+@@ -162,7 +162,7 @@ sub call_reporter ()
      my $date=`date +%Y%m%d%H%M%S`;
      chomp($date);
      my $report_out="$name.$date.html";  # report name is $backupsetname.timestamp.html
Index: files/patch-mysql-zrm-verify-backup-1
===================================================================
--- files/patch-mysql-zrm-verify-backup-1	(revision 144275)
+++ files/patch-mysql-zrm-verify-backup-1	(working copy)
@@ -1,6 +1,6 @@
---- ./usr/bin/mysql-zrm-verify-backup.orig	2008-04-07 10:40:12.000000000 -1000
-+++ ./usr/bin/mysql-zrm-verify-backup	2008-05-08 10:37:21.000000000 -1000
-@@ -30,7 +30,7 @@
+--- usr/bin/mysql-zrm-verify-backup.orig
++++ usr/bin/mysql-zrm-verify-backup
+@@ -30,7 +30,7 @@ use lib "/usr/lib/mysql-zrm";
  use ZRM::Common;
  
  
@@ -9,7 +9,7 @@
  my $CHECKSUM_FILE="zrm_checksum";
  my $CHECKSUM_PENDING=".checksum_pending";
  
-@@ -55,7 +55,7 @@
+@@ -55,7 +55,7 @@ sub verifyCheckSum()
  				$_ ne $EXTRACTED_FILENAME && $_ ne $CHECKSUM_FILE ){
  				my $file = $File::Find::fullname;
  				if( -f $file ){
@@ -18,7 +18,7 @@
          				$x = &execCmdAndGetOutput($x);
  					if( !defined $x ){
  						&printError( "Could not get md5 checksum\n" );
-@@ -120,7 +120,7 @@
+@@ -120,7 +120,7 @@ sub calculateMD5Sum()
                          if( $_ ne "index" && $_ ne $CHECKSUM_PENDING ){
                                  my $file = $File::Find::fullname;
                                  if( -f $file ){
Index: files/patch-zrm-pre-scheduler-2
===================================================================
--- files/patch-zrm-pre-scheduler-2	(revision 144275)
+++ files/patch-zrm-pre-scheduler-2	(working copy)
@@ -1,6 +1,6 @@
---- ./usr/bin/zrm-pre-scheduler.orig	2008-04-07 10:40:12.000000000 -1000
-+++ ./usr/bin/zrm-pre-scheduler	2008-05-12 09:12:32.000000000 -1000
-@@ -35,7 +35,7 @@
+--- usr/bin/zrm-pre-scheduler.orig
++++ usr/bin/zrm-pre-scheduler
+@@ -34,7 +34,7 @@ use ZRM::Common;
  my $oldPATH = $ENV{'PATH'};
  $ENV{'PATH'} = "/usr/local/bin:/opt/csw/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/ucb";
  
@@ -9,7 +9,7 @@
  my $prog="zrm-pre-scheduler";
  my $logdir="/var/log/mysql-zrm";
  my $logfile="$logdir/$prog.log";
-@@ -162,7 +162,7 @@
+@@ -161,7 +161,7 @@ sub reschedule()
  	if ( $int eq "daily" ) {
  	    $mday = $wday = "*";
  	}
@@ -18,7 +18,7 @@
  	print OUTF "--action $myaction ";
          print OUTF "--interval $int " if ( $int );
  	print OUTF "--backup-level $lev " if ( $lev );
-@@ -205,7 +205,7 @@
+@@ -204,7 +204,7 @@ sub call_reporter ()
      my $date=`date +%Y%m%d%H%M%S`;
      chomp($date);
      my $report_out="$name.$date.html";  # report name is $backupsetname.timestamp.html
