ports/184086: new port: sysutils/zrep
Oleg Ginzburg
olevole at olevole.ru
Tue Nov 19 15:00:01 UTC 2013
>Number: 184086
>Category: ports
>Synopsis: new port: sysutils/zrep
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Nov 19 15:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Oleg Ginzburg
>Release:
>Organization:
>Environment:
>Description:
ZFS based replication and failover solution
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# zrep
# zrep/Makefile
# zrep/distinfo
# zrep/files
# zrep/files/patch-zrep
# zrep/pkg-descr
#
echo c - zrep
mkdir -p zrep > /dev/null 2>&1
echo x - zrep/Makefile
sed 's/^X//' >zrep/Makefile << 'b0ee7966475c69df318f595d03b204b5'
X# $FreeBSD: $
X
XPORTNAME= zrep
XPORTVERSION= 1.0.1
XCATEGORIES= sysutils
XMASTER_SITES= http://www.bolthole.com/solaris/zrep/ \
X http://www.bsdstore.ru/downloads/
XDISTNAME= ${PORTNAME}
XEXTRACT_SUFX= ""
X
XMAINTAINER= olevole at olevole.ru
XCOMMENT= ZFS based replication and failover solution.
X
XRUN_DEPENDS= ksh93:${PORTSDIR}/shells/ksh93
X
XPLIST_FILES= bin/zrep
X
XNO_INSTALL_MANPAGES= yes
X
XNO_BUILD= yes
XNO_INSTALL= yes
XNO_EXTRACT= yes
X
X.include <bsd.port.options.mk>
X
Xpost-patch:
X @${REINPLACE_CMD} -e 's|#!/bin/ksh -p|#!${PREFIX}/bin/ksh93 -p|' ${WRKSRC}/zrep
X
Xdo-extract:
X @${MKDIR} ${WRKSRC}
X @${CP} -p ${DISTDIR}/${PORTNAME} ${WRKSRC}
X
Xdo-install:
X ${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}/${PREFIX}/bin
X
X.include <bsd.port.mk>
b0ee7966475c69df318f595d03b204b5
echo x - zrep/distinfo
sed 's/^X//' >zrep/distinfo << 'a6f2039f9d8cda21de2ee46a3051b86e'
XSHA256 (zrep) = 2156852bfe0e9ed3a220cbb459ffb2b423488de023b03f8f9c8e1af876a44b75
XSIZE (zrep) = 45158
a6f2039f9d8cda21de2ee46a3051b86e
echo c - zrep/files
mkdir -p zrep/files > /dev/null 2>&1
echo x - zrep/files/patch-zrep
sed 's/^X//' >zrep/files/patch-zrep << 'f78ce14574ed88f9d7e5390f1f563104'
X--- zrep.orig 2013-05-13 22:01:15.000000000 +0400
X+++ zrep 2013-11-19 18:37:52.921978370 +0400
X@@ -15,7 +15,6 @@
X ZREP_PATH=${ZREP_PATH:-zrep} #Set to /path/to/zrep, if needed, for remote
X #ZREP_CREATE_FLAGS="-o whatever" #Set for extra options on remote zfs create
X
X-
X #########################################################################
X # Everyting else below here, should not be touched. First we have autodetect
X # routines, and then internal utilities such as locking functions.
X@@ -35,8 +34,8 @@
X
X # dump the usage message, and check for capabilities
X # make sure we dont spew for non-root, so that "zrep status" works
X-case `id` in
X- *\(root\))
X+case `whoami` in
X+ root)
X zrep_checkfile=/var/run/zrep.check.$$
X ;;
X *)
X@@ -109,7 +108,8 @@
X # Note that we check for "us, OR our global parent", if different
X #
X zrep_has_global_lock(){
X- lockpid=`ls -l $Z_GLOBAL_LOCKFILE 2>/dev/null |awk -F/ '{print $NF}'`
X+ [ ! -f "${Z_GLOBAL_LOCKFILE}" ] && return 1
X+ lockpid=`cat ${Z_GLOBAL_LOCKFILE}`
X if [[ "$lockpid" == "" ]] ; then return 1 ; fi
X if [[ "$lockpid" != "$Z_GLOBAL_PID" ]] ; then
X if [[ "$lockpid" != "$$" ]] ; then
X@@ -127,7 +127,10 @@
X zrep_get_global_lock(){
X typeset retry_count=$Z_LOCK_RETRY
X
X- ln -s /proc/$Z_GLOBAL_PID $Z_GLOBAL_LOCKFILE && return 0
X+ if [ ! -f "${Z_GLOBAL_LOCKFILE}" ] ; then
X+ echo $Z_GLOBAL_PID > $Z_GLOBAL_LOCKFILE
X+ return 0
X+ fi
X
X # otherwise, deal with fail
X # Check for dead old holder first.
X@@ -135,7 +138,10 @@
X
X while (( retry_count > 0 )); do
X sleep 1
X- ln -s /proc/$Z_GLOBAL_PID $Z_GLOBAL_LOCKFILE && return 0
X+ if [ ! -f "${Z_GLOBAL_LOCKFILE}" ] ; then
X+ echo $Z_GLOBAL_PID > $Z_GLOBAL_LOCKFILE
X+ return 0
X+ fi
X retry_count=$((retry_count-1))
X done
X
X@@ -178,7 +184,9 @@
X typeset check=`zrep_fs_lock_pid $1` newcheck
X if [[ "$check" != "-" ]] ; then
X # validate fs lock before giving up
X- ls -d /proc/$check >/dev/null 2>&1 && return 1
X+ if [ "${check}" != "-" ] ; then
X+ [ -f "${Z_GLOBAL_LOCKFILE}" ] && return 1
X+ fi
X fi
X
X zrep_get_global_lock || return 1
X@@ -257,8 +265,7 @@
X
X zrep_gettimeinseconds(){
X # unfortunately, solaris date doesnt do '%s', so need to use perl
X- typeset PATH=$PERL_BIN:$PATH
X- perl -e 'print int(time);'
X+ date +%s
X }
X ###### zrep_status
X
X@@ -713,7 +720,7 @@
X READONLYPROP="-o readonly=on"
X else
X READONLYPROP=""
X- print Ancient local version of ZFS detected.
X+# print Ancient local version of ZFS detected.
X print Creating destination filesystem as separate step
X zrep_ssh $desthost zfs create $ZREP_CREATE_FLAGS -o readonly=on $destfs || zrep_errquit "Cannot create $desthost:$destfs"
X fi
X@@ -757,7 +764,7 @@
X # Successful initial sync! Woo! okay record that, etc.
X # ... after stupid old-zfs-compat junk, that is
X if (( ! Z_HAS_X )) ; then
X- print Debug: Because you have old zfs support, setting remote properties by hand
X+# print Debug: Because you have old zfs support, setting remote properties by hand
X zrep_ssh $desthost zfs set readonly=on $destfs ||
X clearquit Could not set readonly for $desthost:$destfs
X
f78ce14574ed88f9d7e5390f1f563104
echo x - zrep/pkg-descr
sed 's/^X//' >zrep/pkg-descr << 'd400e34ba739a809a784894ceba77235'
XZrep is an enterprise-grade, single-program solution for handling asynchronous,
Xcontinuous replication of a zfs filesystem, to another filesystem.
XThat filesystem can be on another machine, or on the same machine.
X
XIt also handles 'failover', as simply as "zrep failover datapool/yourfs".
XThis will conveniently handle all the details of
X
X - Making 'yourfs' be a data destination, rather than a source
X - Making 'yourfs' be read-only
X - Making the destination fs be "live", and ready to transfer data to yourfs
X
XWWW: http://www.bolthole.com/solaris/zrep/
d400e34ba739a809a784894ceba77235
exit
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list