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

Collapse All | Expand All

(-)./rdup/Makefile (-3 / +1 lines)
Lines 7-13 Link Here
7
#
7
#
8
8
9
PORTNAME=	rdup
9
PORTNAME=	rdup
10
PORTVERSION=	1.1.2
10
PORTVERSION=	1.1.3
11
CATEGORIES=	sysutils
11
CATEGORIES=	sysutils
12
MASTER_SITES=	http://miek.nl/projects/rdup/
12
MASTER_SITES=	http://miek.nl/projects/rdup/
13
13
Lines 39-45 Link Here
39
39
40
MAN7=		rdup-backups.7
40
MAN7=		rdup-backups.7
41
41
42
post-patch:
43
	@${REINPLACE_CMD} -e 's|/bin/bash|${LOCALBASE}/bin/bash|' ${WRKSRC}/sh/rdup-simple.in
44
42
45
.include <bsd.port.mk>
43
.include <bsd.port.mk>
(-)./rdup/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (rdup-1.1.2.tar.bz2) = 4e543871c6178d5edc597fcb628a24e7
1
MD5 (rdup-1.1.3.tar.bz2) = bb6cc5b8a3e5915a91d31f2bb90607ec
2
SHA256 (rdup-1.1.2.tar.bz2) = d5b2c4e7a4df62909a18ae70c241fb4bf3c405afa369dbd1259efd22eed9b327
2
SHA256 (rdup-1.1.3.tar.bz2) = 2e1df6f7bf1a8eaea477e3cb81eada10cfa486206ba02e3d173241b88a08c531
3
SIZE (rdup-1.1.2.tar.bz2) = 357713
3
SIZE (rdup-1.1.3.tar.bz2) = 357994
(-)./rdup/files/patch-GNUmakefile.in (-2 / +2 lines)
Lines 1-5 Link Here
1
--- GNUmakefile.in.orig	2010-03-02 11:04:44.000000000 -0800
1
--- ./GNUmakefile.in.orig	2010-03-21 10:17:54.000000000 -0700
2
+++ GNUmakefile.in	2010-03-02 11:06:56.000000000 -0800
2
+++ ./GNUmakefile.in	2010-03-30 11:42:33.000000000 -0700
3
@@ -19,7 +19,7 @@
3
@@ -19,7 +19,7 @@
4
 sbindir=@sbindir@
4
 sbindir=@sbindir@
5
 mandir=@mandir@
5
 mandir=@mandir@
(-)./rdup/files/patch-mkpath.c (+52 lines)
Line 0 Link Here
1
--- ./mkpath.c.orig	2010-03-30 11:43:00.000000000 -0700
2
+++ ./mkpath.c	2010-03-30 11:44:22.000000000 -0700
3
@@ -14,34 +14,31 @@
4
 
5
         if (strcmp(s, ".") == 0 || strcmp(s, "/") == 0)
6
                 return 0;
7
-
8
-#ifdef DEBUG
9
-	msgd(__func__, __LINE__, _("Path ele '%s\'"), s);
10
-#endif /* DEBUG */
11
  
12
-        path = g_strdup(s);
13
-        q = g_strdup(s);
14
+        if ((path = g_strdup(s)) == NULL)
15
+                return -1;
16
+ 
17
+        if ((q = g_strdup(s)) == NULL)
18
+                return -1;
19
  
20
         if ((r = dirname(q)) == NULL)
21
                 goto out;
22
  
23
-	up = g_strdup(q);
24
+        if ((up = g_strdup(r)) == NULL)
25
+                return -1;
26
  
27
-	if ((mkpath(up, mode) == -1) && (errno != EEXIST)) {
28
-		msgd(__func__, __LINE__, _("Failed or exists '%s\': %s"), up, strerror(errno));
29
-		goto out;
30
-	}
31
+        if ((mkpath(up, mode) == -1) && (errno != EEXIST)) 
32
+                goto out;
33
  
34
-        if ((mkdir(path, mode) == -1) && (errno != EEXIST)) {
35
-		msgd(__func__, __LINE__, _("Failed to create directory '%s\': %s"), path, strerror(errno));
36
+        if ((mkdir(path, mode) == -1) && (errno != EEXIST))
37
                 rv = -1;
38
-	} else {
39
+        else
40
                 rv = 0;
41
-	}
42
  
43
 out:
44
-        if (up) g_free(up);
45
-        if (q) g_free(q);
46
-        if (path) g_free(path);
47
+        if (up)
48
+                free(up);
49
+        free(q);
50
+        free(path);
51
         return (rv);
52
 }
(-)./rdup/files/patch-rdup-simple.in (-9 / +197 lines)
Lines 1-11 Link Here
1
--- sh/rdup-simple.in.orig	2009-10-09 23:37:15.000000000 -0700
1
--- ./sh/rdup-simple.in.orig	2010-03-21 10:17:54.000000000 -0700
2
+++ sh/rdup-simple.in	2009-10-09 23:44:36.000000000 -0700
2
+++ ./sh/rdup-simple.in	2010-03-30 11:42:33.000000000 -0700
3
@@ -41,7 +41,7 @@
3
@@ -1,16 +1,19 @@
4
-#!/bin/bash
5
+#!/bin/sh
6
 
7
 # updates a hardlinked backup
8
 # licensed under the GPL version 3
9
 # Copyright Miek Gieben, 2007 - 2010
10
 # rewritten for rdup-up and rdup-tr
11
+#
12
+# Revised 29 Mar 2010 by corky1951 AT comcast.net
13
+# to use /bin/sh rather than bash
14
 
15
 echo2() {
16
     echo "** $PROGNAME: $@" >&2
17
 }
18
 
19
 version() {
20
-    echo "rdup @PACKAGE_VERSION@"
21
+    echo "@PACKAGE_VERSION@"
4
 }
22
 }
5
 
23
 
6
 PROGNAME=$0
24
 copy_and_link() {
7
-NOW=`date +%Y%m/%d`
25
@@ -31,23 +34,24 @@
8
+NOW=`gdate +%Y%m/%d`
26
     TOPDIR="$1"
9
 DAYS=8
27
 
10
 ssh=
28
     if $dry; then return 1; fi
11
 trans=
29
-    [[ -z $TOPDIR ]] && exit 2
30
-    [[ -d $TOPDIR/$TODAY ]] && exit 0
31
+    [ -z "$TOPDIR" ] && exit 2
32
+    [ -d $TOPDIR/$TODAY ] && exit 0
33
 
34
     if ! mkdir -p $TOPDIR/$TODAY; then
35
 	exit 2
36
     fi
37
 
38
-    let i=1
39
-    while [[ $i -le $LOOKBACK ]]; do
40
-	    D=$(date $DATESTR --date "$i days ago")
41
-	    if [[ -d $TOPDIR/$D ]]; then
42
-		if ! cp -plr $TOPDIR/$D/* $TOPDIR/$TODAY; then
43
+    i=1
44
+    while [ $i -le $LOOKBACK ]; do
45
+	    adjust=`printf %dd $i`
46
+	    D=$(date -v-$adjust $DATESTR)
47
+	    if [ -d $TOPDIR/$D ]; then
48
+		if ! cp -plR $TOPDIR/$D/* $TOPDIR/$TODAY; then
49
 		    exit 2
50
 		fi
51
 		exit 0
52
 	    fi
53
-	    let i=i+1
54
+	    i=$((i+1))
55
     done
56
     exit 1
57
 }
58
@@ -105,7 +109,7 @@
59
         case $o in
60
 		a) atime=" -a " ;;
61
 		E)
62
-                if [[ -z "$OPTARG" ]]; then
63
+                if [ -z "$OPTARG" ]; then
64
                         echo2 "-E needs an argument"
65
                         exit 1
66
                 fi
67
@@ -116,11 +120,11 @@
68
 		pathtrans="-$o $OPTARG";
69
 		;;
70
                 k)
71
-                if [[ -z "$OPTARG" ]]; then
72
+                if [ -z "$OPTARG" ]; then
73
                         echo2 "-k needs an argument"
74
                         exit 1
75
                 fi
76
-                if [[ ! -r "$OPTARG" ]]; then
77
+                if [ ! -r "$OPTARG" ]; then
78
                         echo2 "Cannot read keyfile \`$OPTARG': failed"
79
                         exit 1
80
                 fi
81
@@ -144,7 +148,7 @@
82
 			exit 1
83
 		fi
84
 		# if there a no key, this will fail
85
-		if [[ $(gpg --list-keys | wc -l) -eq "0" ]]; then
86
+		if [ $(gpg --list-keys | wc -l) -eq "0" ]; then
87
 			echo2 "No gpg keys found"
88
 			exit 1
89
 		fi
90
@@ -163,9 +167,9 @@
91
 done
92
 shift $((OPTIND - 1))
93
 
94
-if [[ ${1:0:1} == "+" ]]; then
95
-        DAYS=${1:1}
96
-        if [[ $DAYS -lt 1 || $DAYS -gt 99 ]]; then
97
+if [ "${1%${1#?}}" = "+" ]; then
98
+        DAYS=${1#?}
99
+        if [ $DAYS -lt 1 ] || [ $DAYS -gt 99 ]; then
100
                 echo2 "+N needs to be a number [1..99]"
101
                 exit 1
102
         fi
103
@@ -174,7 +178,7 @@
104
         DAYS=8
105
 fi
106
 
107
-[[ $# -lt 2 ]] && usage && exit
108
+[ $# -lt 2 ] && usage && exit
109
 
110
 if $mcrypt; then
111
     if ! which mcrypt 2>/dev/null 1>&2; then
112
@@ -184,10 +188,10 @@
113
 fi
114
 
115
 i=1; last=$#; DIRS=
116
-while [[ $i -lt $last ]]; do
117
+while [ $i -lt $last ]; do
118
 	DIRS="$DIRS $1"
119
 	shift
120
-	((i=$i+1))
121
+	i=$((i+1))
122
 done
123
 # rdup [options] source destination
124
 #dest="ssh://elektron.atoom.net/directory"
125
@@ -197,44 +201,44 @@
126
 #dest="ssh://miekg@elektron.atoom.net/directory"
127
 
128
 dest=$1
129
-if [[ ${dest:0:6} == "ssh://" ]]; then
130
-	rest=${dest/ssh:\/\//}
131
+if [ "${dest%${dest#??????}}" = "ssh://" ]; then
132
+	rest=${dest#ssh://}
133
 	u=${rest%%@*}
134
-	rest=${rest/$u@/}
135
+	rest=${rest#$u@}
136
 	h=`echo $rest | cut -s -f1 -d/`
137
-	BACKUPDIR=${rest/$h/}
138
+	BACKUPDIR=${rest#$h}
139
 
140
-	if [[ -z $u ]]; then
141
+	if [ -z "$u" ]; then
142
 		ssh=" ssh -c blowfish -x $h"
143
 	else
144
 		ssh=" ssh -c blowfish -x $u@$h"
145
 	fi
146
 fi
147
-if [[ ${dest:0:7} == "file://" ]]; then
148
-	rest=${dest/file:\/\//}
149
+if [ "${dest%${dest#???????}}" = "file://" ]; then
150
+	rest=${dest#file://}
151
 	BACKUPDIR=$rest
152
 fi
153
-[[ ${dest:0:1} == "/" ]] && BACKUPDIR=$dest
154
+[ "${dest%${dest#?}}" = "/" ] && BACKUPDIR=$dest
155
 
156
 # no hits above, assume relative filename
157
-[[ -z $BACKUPDIR ]] && BACKUPDIR=$PWD/$dest
158
+[ -z "$BACKUPDIR" ] && BACKUPDIR=$PWD/$dest
159
 
160
 $link && copy_and_link $DAYS $BACKUPDIR
161
 
162
 # change all / to _ to make a valid filename
163
-STAMP=$etc/timestamp.${HOSTNAME}.${dest//\//_}
164
-LIST=$etc/list.${HOSTNAME}.${dest//\//_}
165
+STAMP=$etc/timestamp.${HOSTNAME}.`echo $dest | tr / _`
166
+LIST=$etc/list.${HOSTNAME}.`echo $dest | tr / _`
167
 
168
-[[ ! -d $etc ]] && mkdir $etc
169
+[ ! -d $etc ] && mkdir $etc
170
 
171
 # remote or not
172
-if [[ -z $ssh ]]; then
173
+if [ -z "$ssh" ]; then
174
         pipe="rdup-up$OPT $STRIP -t $BACKUPDIR/$NOW"
175
 else
176
         pipe="$ssh rdup-up$OPT $STRIP -t $BACKUPDIR/$NOW"
177
 fi
178
 # path encryption
179
-if [[ -n $pathtrans ]]; then
180
+if [ -n "$pathtrans" ]; then
181
 	pipe="rdup-tr $pathtrans | $pipe"
182
 fi
183
 
184
@@ -242,7 +246,7 @@
185
 
186
 if ! $force; then
187
 	# path is set at the top
188
-        if [[ -z $ssh ]]; then
189
+        if [ -z "$ssh" ]; then
190
 		$PROGNAME -L +$DAYS /dev/null $BACKUPDIR
191
 #		rdup-ln -l $DAYS $BACKUPDIR
192
                 purpose=$?
193
@@ -269,5 +273,5 @@
194
 if $dry; then
195
     echo "${cmd}"
196
 else
197
-    eval ${cmd}
198
+    eval "${cmd}"
199
 fi
(-)./rdup/pkg-descr (-3 / +1 lines)
Lines 5-12 Link Here
5
removed, allowing for correct incremental backups.
5
removed, allowing for correct incremental backups.
6
6
7
An example script named rdup-simple is included to show how to 
7
An example script named rdup-simple is included to show how to 
8
implement a simple snapshot-style backup strategy.  This bash script requires 
8
implement a simple snapshot-style backup strategy.
9
GNU date and cp, which are not installed by this FreeBSD port. If you want to 
10
use the script, you should also install the sysutils/coreutils port.
11
9
12
WWW: http://miek.nl/projects/rdup
10
WWW: http://miek.nl/projects/rdup

Return to bug 144998