View | Details | Raw Unified | Return to bug 209852 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-12 / +8 lines)
Lines 1-12 Link Here
1
# $FreeBSD$
1
# $FreeBSD$
2
2
3
PORTNAME=	zrep
3
PORTNAME=	zrep
4
PORTVERSION=	1.0.1
4
PORTVERSION=	1.5.5
5
CATEGORIES=	sysutils
5
CATEGORIES=	sysutils
6
MASTER_SITES=	http://www.bolthole.com/solaris/zrep/ \
7
		http://www.bsdstore.ru/downloads/
8
DISTNAME=	${PORTNAME}
9
EXTRACT_SUFX=
10
6
11
MAINTAINER=	olevole@olevole.ru
7
MAINTAINER=	olevole@olevole.ru
12
COMMENT=	ZFS based replication and failover solution
8
COMMENT=	ZFS based replication and failover solution
Lines 15-30 Link Here
15
11
16
PLIST_FILES=	bin/zrep
12
PLIST_FILES=	bin/zrep
17
13
18
NO_BUILD=	yes
14
ALL_TARGET=	${PORTNAME}
15
USE_GITHUB=	yes
16
GH_ACCOUNT=	bolthole
17
GH_TAGNAME=	52e66a2
19
18
20
.include <bsd.port.options.mk>
21
22
post-patch:
19
post-patch:
23
	@${REINPLACE_CMD} -e 's|#!/bin/ksh -p|#!${PREFIX}/bin/ksh93 -p|' ${WRKSRC}/zrep
20
	@${REINPLACE_CMD} -e 's|#!/bin/ksh -p|#!${PREFIX}/bin/ksh93 -p|' ${WRKSRC}/zrep_top
24
21
25
do-extract:
22
pre-build:
26
	@${MKDIR} ${WRKSRC}
23
	@${RM} ${WRKSRC}/zrep
27
	@${CP} -p ${DISTDIR}/${PORTNAME} ${WRKSRC}
28
24
29
do-install:
25
do-install:
30
	${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}/${PREFIX}/bin
26
	${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}/${PREFIX}/bin
(-)distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (zrep) = 2156852bfe0e9ed3a220cbb459ffb2b423488de023b03f8f9c8e1af876a44b75
1
TIMESTAMP = 1464429457
2
SIZE (zrep) = 45158
2
SHA256 (bolthole-zrep-1.5.5-52e66a2_GH0.tar.gz) = af389ae9205c45d172907788be73ba4b7fac2848d304c9d950298c81a6c126ba
3
SIZE (bolthole-zrep-1.5.5-52e66a2_GH0.tar.gz) = 42336
(-)files/patch-zrep (-94 lines)
Lines 1-94 Link Here
1
--- zrep.orig	2013-05-13 22:01:15.000000000 +0400
2
+++ zrep	2013-11-19 18:37:52.921978370 +0400
3
@@ -15,7 +15,6 @@
4
 ZREP_PATH=${ZREP_PATH:-zrep}  #Set to /path/to/zrep, if needed, for remote
5
 #ZREP_CREATE_FLAGS="-o whatever"   #Set for extra options on remote zfs create
6
 
7
-
8
 #########################################################################
9
 # Everyting else below here, should not be touched. First we have autodetect
10
 # routines, and then internal utilities such as locking functions.
11
@@ -35,8 +34,8 @@
12
 
13
 # dump the usage message, and check for capabilities
14
 # make sure we dont spew for non-root, so that "zrep status" works
15
-case `id` in
16
-	*\(root\))
17
+case `whoami` in
18
+	root)
19
 	zrep_checkfile=/var/run/zrep.check.$$
20
 	;;
21
 	*)
22
@@ -109,7 +108,8 @@
23
 # Note that we check for "us, OR our global parent", if different
24
 #
25
 zrep_has_global_lock(){
26
-	lockpid=`ls -l $Z_GLOBAL_LOCKFILE 2>/dev/null |awk -F/ '{print $NF}'`
27
+	[ ! -f "${Z_GLOBAL_LOCKFILE}" ] && return 1
28
+	lockpid=`cat ${Z_GLOBAL_LOCKFILE}`
29
 	if [[ "$lockpid" == "" ]] ; then return 1 ; fi
30
 	if [[ "$lockpid" != "$Z_GLOBAL_PID" ]] ; then
31
 		if [[ "$lockpid" != "$$" ]] ; then
32
@@ -127,7 +127,10 @@
33
 zrep_get_global_lock(){
34
 	typeset retry_count=$Z_LOCK_RETRY
35
 
36
-	ln -s /proc/$Z_GLOBAL_PID $Z_GLOBAL_LOCKFILE && return 0
37
+	if  [ ! -f "${Z_GLOBAL_LOCKFILE}" ] ; then
38
+            echo $Z_GLOBAL_PID > $Z_GLOBAL_LOCKFILE
39
+            return 0
40
+        fi
41
 
42
 	# otherwise, deal with fail
43
 	# Check for dead old holder first.
44
@@ -135,7 +138,10 @@
45
 	
46
 	while (( retry_count > 0 )); do
47
 		sleep 1
48
-		ln -s /proc/$Z_GLOBAL_PID $Z_GLOBAL_LOCKFILE && return 0
49
+		if  [ ! -f "${Z_GLOBAL_LOCKFILE}" ] ; then
50
+		    echo $Z_GLOBAL_PID > $Z_GLOBAL_LOCKFILE
51
+		    return 0
52
+		fi
53
 		retry_count=$((retry_count-1))
54
 	done
55
 
56
@@ -178,7 +184,9 @@
57
 	typeset check=`zrep_fs_lock_pid $1` newcheck
58
 	if [[ "$check" != "-" ]] ; then
59
 		# validate fs lock before giving up
60
-		ls -d /proc/$check >/dev/null 2>&1 && return 1
61
+	    if [ "${check}" != "-" ] ; then
62
+                [ -f "${Z_GLOBAL_LOCKFILE}" ] && return 1
63
+            fi
64
 	fi
65
 
66
 	zrep_get_global_lock  || return 1
67
@@ -257,8 +265,7 @@
68
 
69
 zrep_gettimeinseconds(){
70
 	# unfortunately, solaris date doesnt do '%s', so need to use perl
71
-	typeset PATH=$PERL_BIN:$PATH
72
-	perl -e 'print int(time);'
73
+	    date +%s
74
 }
75
 ###### zrep_status
76
 
77
@@ -713,7 +720,7 @@
78
 		READONLYPROP="-o readonly=on"
79
 	else
80
 		READONLYPROP=""
81
-		print Ancient local version of ZFS detected.
82
+#		print Ancient local version of ZFS detected.
83
 		print Creating destination filesystem as separate step
84
 		zrep_ssh $desthost zfs create $ZREP_CREATE_FLAGS -o readonly=on $destfs || zrep_errquit "Cannot create $desthost:$destfs"
85
 	fi
86
@@ -757,7 +764,7 @@
87
 	# Successful initial sync! Woo! okay record that, etc.
88
 	# ... after stupid old-zfs-compat junk, that is
89
 	if (( ! Z_HAS_X )) ; then
90
-		print Debug: Because you have old zfs support, setting remote properties by hand
91
+#		print Debug: Because you have old zfs support, setting remote properties by hand
92
 		zrep_ssh $desthost zfs set readonly=on $destfs	||
93
 			clearquit Could not set readonly for $desthost:$destfs
94
 
(-)files/patch-zrep__snap (+18 lines)
Line 0 Link Here
1
--- zrep_snap.orig	2016-05-30 08:17:51 UTC
2
+++ zrep_snap
3
@@ -309,7 +309,6 @@ zrep_init(){
4
 		READONLYPROP="-o readonly=on"
5
 	else
6
 		READONLYPROP=""
7
-		print Ancient local version of ZFS detected.
8
 		print Creating destination filesystem as separate step
9
 		zrep_ssh $desthost zfs create $ZREP_CREATE_FLAGS -o readonly=on $destfs || zrep_errquit "Cannot create $desthost:$destfs"
10
 	fi
11
@@ -359,7 +358,6 @@ zrep_init(){
12
 	# Successful initial sync! Woo! okay record that, etc.
13
 	# ... after stupid old-zfs-compat junk, that is
14
 	if (( ! Z_HAS_X )) ; then
15
-		print Debug: Because you have old zfs support, setting remote properties by hand
16
 		zrep_ssh $desthost zfs set readonly=on $destfs	||
17
 			clearquit Could not set readonly for $desthost:$destfs
18
 
(-)files/patch-zrep__vars (+67 lines)
Line 0 Link Here
1
--- zrep_vars.orig	2016-05-30 08:14:39 UTC
2
+++ zrep_vars
3
@@ -79,8 +79,8 @@ PROPTYPES="local,received" 
4
 
5
 # dump the usage message, and check for capabilities
6
 # make sure we dont spew for non-root, so that "zrep status" works
7
-case `id` in
8
-	*\(root\))
9
+case `whoami` in
10
+	root)
11
 	zrep_checkfile=/var/run/zrep.check.$$
12
 	;;
13
 	*)
14
@@ -159,7 +159,8 @@ Z_SETHOLD=${Z_SETHOLD:-"zfs hold"}
15
 # Note that we check for "us, OR our global parent", if different
16
 #
17
 zrep_has_global_lock(){
18
-	lockpid=`ls -l $Z_GLOBAL_LOCKFILE 2>/dev/null |awk -F/ '{print $NF}'`
19
+	[ ! -f "${Z_GLOBAL_LOCKFILE}" ] && return 1
20
+	lockpid=`cat ${Z_GLOBAL_LOCKFILE}`
21
 	if [[ "$lockpid" == "" ]] ; then return 1 ; fi
22
 	if [[ "$lockpid" != "$Z_GLOBAL_PID" ]] ; then
23
 		if [[ "$lockpid" != "$$" ]] ; then
24
@@ -177,7 +178,10 @@ zrep_has_global_lock(){
25
 zrep_get_global_lock(){
26
 	typeset retry_count=$Z_LOCK_RETRY
27
 
28
-	ln -s /proc/$Z_GLOBAL_PID $Z_GLOBAL_LOCKFILE && return 0
29
+	if  [ ! -f "${Z_GLOBAL_LOCKFILE}" ] ; then
30
+		echo $Z_GLOBAL_PID > $Z_GLOBAL_LOCKFILE
31
+		return 0
32
+	fi
33
 
34
 	# otherwise, deal with fail
35
 	# Check for dead old holder first.
36
@@ -185,7 +189,10 @@ zrep_get_global_lock(){
37
 	
38
 	while (( retry_count > 0 )); do
39
 		sleep 1
40
-		ln -s /proc/$Z_GLOBAL_PID $Z_GLOBAL_LOCKFILE && return 0
41
+		if  [ ! -f "${Z_GLOBAL_LOCKFILE}" ] ; then
42
+			echo $Z_GLOBAL_PID > $Z_GLOBAL_LOCKFILE
43
+			return 0
44
+		fi
45
 		retry_count=$((retry_count-1))
46
 	done
47
 
48
@@ -228,7 +235,9 @@ zrep_lock_fs(){
49
 	typeset check=`zrep_fs_lock_pid $1` newcheck
50
 	if [[ "$check" != "-" ]] ; then
51
 		# validate fs lock before giving up
52
-		ls -d /proc/$check >/dev/null 2>&1 && return 1
53
+		if [ "${check}" != "-" ] ; then
54
+			[ -f "${Z_GLOBAL_LOCKFILE}" ] && return 1
55
+		fi
56
 	fi
57
 
58
 	zrep_get_global_lock  || return 1
59
@@ -306,7 +315,5 @@ zrep_ssh(){
60
 }
61
 
62
 zrep_gettimeinseconds(){
63
-	# unfortunately, solaris date doesnt do '%s', so need to use perl
64
-	typeset PATH=$PERL_BIN:$PATH
65
-	perl -e 'print int(time);'
66
+	date +%s
67
 }

Return to bug 209852