Bug 184086 - new port: sysutils/zrep
Summary: new port: sysutils/zrep
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Veniamin Gvozdikov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-19 15:00 UTC by Oleg Ginzburg
Modified: 2014-01-03 17:52 UTC (History)
0 users

See Also:


Attachments
file.shar (5.52 KB, text/plain)
2013-11-19 15:00 UTC, Oleg Ginzburg
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Ginzburg 2013-11-19 15:00:00 UTC
ZFS based replication and failover solution

Fix: Patch attached with submission follows:
Comment 1 Veniamin Gvozdikov freebsd_committer freebsd_triage 2013-11-19 18:48:06 UTC
Responsible Changed
From-To: freebsd-ports-bugs->vg

I will take it.
Comment 2 dfilter service freebsd_committer freebsd_triage 2014-01-03 17:49:43 UTC
Author: vg
Date: Fri Jan  3 17:49:34 2014
New Revision: 338565
URL: http://svnweb.freebsd.org/changeset/ports/338565

Log:
  Zrep is an enterprise-grade, single-program solution for handling asynchronous,
  continuous replication of a zfs filesystem, to another filesystem.
  That filesystem can be on another machine, or on the same machine.
  
  It also handles 'failover', as simply as "zrep failover datapool/yourfs".
  This will conveniently handle all the details of
  
   - Making 'yourfs' be a data destination, rather than a source
   - Making 'yourfs' be read-only
   - Making the destination fs be "live", and ready to transfer data to yourfs
  
  WWW: http://www.bolthole.com/solaris/zrep/
  
  PR:		ports/184086
  Submitted by:	Oleg Ginzburg <olevole@olevole.ru>

Added:
  head/sysutils/zrep/
  head/sysutils/zrep/Makefile   (contents, props changed)
  head/sysutils/zrep/distinfo   (contents, props changed)
  head/sysutils/zrep/files/
  head/sysutils/zrep/files/patch-zrep   (contents, props changed)
  head/sysutils/zrep/pkg-descr   (contents, props changed)
Modified:
  head/sysutils/Makefile

Modified: head/sysutils/Makefile
==============================================================================
--- head/sysutils/Makefile	Fri Jan  3 16:47:12 2014	(r338564)
+++ head/sysutils/Makefile	Fri Jan  3 17:49:34 2014	(r338565)
@@ -1069,6 +1069,7 @@
     SUBDIR += zidrav
     SUBDIR += zisofs-tools
     SUBDIR += zogftw
+    SUBDIR += zrep
     SUBDIR += zxfer
 
 .include <bsd.port.subdir.mk>

Added: head/sysutils/zrep/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/zrep/Makefile	Fri Jan  3 17:49:34 2014	(r338565)
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+PORTNAME=	zrep
+PORTVERSION=	1.0.1
+CATEGORIES=	sysutils
+MASTER_SITES=	http://www.bolthole.com/solaris/zrep/ \
+		http://www.bsdstore.ru/downloads/
+DISTNAME=	${PORTNAME}
+EXTRACT_SUFX=
+
+MAINTAINER=	olevole@olevole.ru
+COMMENT=	ZFS based replication and failover solution
+
+RUN_DEPENDS=	ksh93:${PORTSDIR}/shells/ksh93
+
+PLIST_FILES=	bin/zrep
+
+NO_INSTALL_MANPAGES=	yes
+
+NO_BUILD=	yes
+NO_INSTALL=	yes
+NO_EXTRACT=	yes
+
+.include <bsd.port.options.mk>
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|#!/bin/ksh -p|#!${PREFIX}/bin/ksh93 -p|' ${WRKSRC}/zrep
+
+do-extract:
+	@${MKDIR} ${WRKSRC}
+	@${CP} -p ${DISTDIR}/${PORTNAME} ${WRKSRC}
+
+do-install:
+	${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}/${PREFIX}/bin
+
+.include <bsd.port.mk>

Added: head/sysutils/zrep/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/zrep/distinfo	Fri Jan  3 17:49:34 2014	(r338565)
@@ -0,0 +1,2 @@
+SHA256 (zrep) = 2156852bfe0e9ed3a220cbb459ffb2b423488de023b03f8f9c8e1af876a44b75
+SIZE (zrep) = 45158

Added: head/sysutils/zrep/files/patch-zrep
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/zrep/files/patch-zrep	Fri Jan  3 17:49:34 2014	(r338565)
@@ -0,0 +1,94 @@
+--- zrep.orig	2013-05-13 22:01:15.000000000 +0400
++++ zrep	2013-11-19 18:37:52.921978370 +0400
+@@ -15,7 +15,6 @@
+ ZREP_PATH=${ZREP_PATH:-zrep}  #Set to /path/to/zrep, if needed, for remote
+ #ZREP_CREATE_FLAGS="-o whatever"   #Set for extra options on remote zfs create
+ 
+-
+ #########################################################################
+ # Everyting else below here, should not be touched. First we have autodetect
+ # routines, and then internal utilities such as locking functions.
+@@ -35,8 +34,8 @@
+ 
+ # dump the usage message, and check for capabilities
+ # make sure we dont spew for non-root, so that "zrep status" works
+-case `id` in
+-	*\(root\))
++case `whoami` in
++	root)
+ 	zrep_checkfile=/var/run/zrep.check.$$
+ 	;;
+ 	*)
+@@ -109,7 +108,8 @@
+ # Note that we check for "us, OR our global parent", if different
+ #
+ zrep_has_global_lock(){
+-	lockpid=`ls -l $Z_GLOBAL_LOCKFILE 2>/dev/null |awk -F/ '{print $NF}'`
++	[ ! -f "${Z_GLOBAL_LOCKFILE}" ] && return 1
++	lockpid=`cat ${Z_GLOBAL_LOCKFILE}`
+ 	if [[ "$lockpid" == "" ]] ; then return 1 ; fi
+ 	if [[ "$lockpid" != "$Z_GLOBAL_PID" ]] ; then
+ 		if [[ "$lockpid" != "$$" ]] ; then
+@@ -127,7 +127,10 @@
+ zrep_get_global_lock(){
+ 	typeset retry_count=$Z_LOCK_RETRY
+ 
+-	ln -s /proc/$Z_GLOBAL_PID $Z_GLOBAL_LOCKFILE && return 0
++	if  [ ! -f "${Z_GLOBAL_LOCKFILE}" ] ; then
++            echo $Z_GLOBAL_PID > $Z_GLOBAL_LOCKFILE
++            return 0
++        fi
+ 
+ 	# otherwise, deal with fail
+ 	# Check for dead old holder first.
+@@ -135,7 +138,10 @@
+ 	
+ 	while (( retry_count > 0 )); do
+ 		sleep 1
+-		ln -s /proc/$Z_GLOBAL_PID $Z_GLOBAL_LOCKFILE && return 0
++		if  [ ! -f "${Z_GLOBAL_LOCKFILE}" ] ; then
++		    echo $Z_GLOBAL_PID > $Z_GLOBAL_LOCKFILE
++		    return 0
++		fi
+ 		retry_count=$((retry_count-1))
+ 	done
+ 
+@@ -178,7 +184,9 @@
+ 	typeset check=`zrep_fs_lock_pid $1` newcheck
+ 	if [[ "$check" != "-" ]] ; then
+ 		# validate fs lock before giving up
+-		ls -d /proc/$check >/dev/null 2>&1 && return 1
++	    if [ "${check}" != "-" ] ; then
++                [ -f "${Z_GLOBAL_LOCKFILE}" ] && return 1
++            fi
+ 	fi
+ 
+ 	zrep_get_global_lock  || return 1
+@@ -257,8 +265,7 @@
+ 
+ zrep_gettimeinseconds(){
+ 	# unfortunately, solaris date doesnt do '%s', so need to use perl
+-	typeset PATH=$PERL_BIN:$PATH
+-	perl -e 'print int(time);'
++	    date +%s
+ }
+ ###### zrep_status
+ 
+@@ -713,7 +720,7 @@
+ 		READONLYPROP="-o readonly=on"
+ 	else
+ 		READONLYPROP=""
+-		print Ancient local version of ZFS detected.
++#		print Ancient local version of ZFS detected.
+ 		print Creating destination filesystem as separate step
+ 		zrep_ssh $desthost zfs create $ZREP_CREATE_FLAGS -o readonly=on $destfs || zrep_errquit "Cannot create $desthost:$destfs"
+ 	fi
+@@ -757,7 +764,7 @@
+ 	# Successful initial sync! Woo! okay record that, etc.
+ 	# ... after stupid old-zfs-compat junk, that is
+ 	if (( ! Z_HAS_X )) ; then
+-		print Debug: Because you have old zfs support, setting remote properties by hand
++#		print Debug: Because you have old zfs support, setting remote properties by hand
+ 		zrep_ssh $desthost zfs set readonly=on $destfs	||
+ 			clearquit Could not set readonly for $desthost:$destfs
+ 

Added: head/sysutils/zrep/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/zrep/pkg-descr	Fri Jan  3 17:49:34 2014	(r338565)
@@ -0,0 +1,12 @@
+Zrep is an enterprise-grade, single-program solution for handling asynchronous,
+continuous replication of a zfs filesystem, to another filesystem.
+That filesystem can be on another machine, or on the same machine.
+
+It also handles 'failover', as simply as "zrep failover datapool/yourfs". 
+This will conveniently handle all the details of
+
+ - Making 'yourfs' be a data destination, rather than a source
+ - Making 'yourfs' be read-only
+ - Making the destination fs be "live", and ready to transfer data to yourfs 
+
+WWW: http://www.bolthole.com/solaris/zrep/
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Veniamin Gvozdikov freebsd_committer freebsd_triage 2014-01-03 17:52:39 UTC
State Changed
From-To: open->closed

Committed, thank you!