Mail archive
alpine-aports

[alpine-aports] [PATCH] testing/csync2: some cleanups in strlcpy patch. post-install generate required certificate and setup inetd service

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Wed, 30 Sep 2015 17:29:16 +0300

---
 testing/csync2/APKBUILD                    | 39 +++++++++++++---------------
 testing/csync2/csync2.initd                |  1 -
 testing/csync2/csync2.post-install         | 24 +++++++++++++++++
 testing/csync2/have-strlcpy.patch          | 41 ++++++++++++++++++++++++++++++
 testing/csync2/rsync-strlcpy-disable.patch | 20 ---------------
 5 files changed, 82 insertions(+), 43 deletions(-)
 create mode 100644 testing/csync2/csync2.post-install
 create mode 100644 testing/csync2/have-strlcpy.patch
 delete mode 100644 testing/csync2/rsync-strlcpy-disable.patch
diff --git a/testing/csync2/APKBUILD b/testing/csync2/APKBUILD
index ada4ab4..bdb400f 100644
--- a/testing/csync2/APKBUILD
+++ b/testing/csync2/APKBUILD
_at_@ -4,22 +4,21 @@
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
 pkgname=csync2
 pkgver=2.0
-pkgrel=1
+pkgrel=2
 pkgdesc="Cluster synchronization tool"
 url="http://oss.linbit.com/csync2/"
 arch="all"
-license="GPL2+"
-depends=""
-depends_dev=""
-makedepends="librsync-dev gnutls-dev sqlite-dev mysql-dev postgresql-dev"
-install="$pkgname.post-upgrade"
+license="GPL-2+"
+makedepends="autoconf automake librsync-dev gnutls-dev sqlite-dev mysql-dev postgresql-dev"
 subpackages="$pkgname-compare $pkgname-doc"
 source="http://oss.linbit.com/$pkgname/$pkgname-$pkgver.tar.gz
 	longlong-format.patch
-	rsync-strlcpy-disable.patch
+	have-strlcpy.patch
 	$pkgname.initd"
+install="$pkgname.post-install $pkgname.post-upgrade"
 
 _builddir="$srcdir"/$pkgname-$pkgver
+
 prepare() {
 	cd "$_builddir"
 	for i in $source; do
_at_@ -27,6 +26,7 @@ prepare() {
 		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
 		esac
 	done
+	autoreconf --install --force
 }
 
 build() {
_at_@ -45,31 +45,26 @@ build() {
 package() {
 	cd "$_builddir"
 	make DESTDIR="$pkgdir" install || return 1
-	cp doc/* "$pkgdir"/usr/share/doc/$pkgname/ || return 1
-
-	install -m755 -D "$srcdir"/$pkgname.initd \
-		"$pkgdir"/etc/init.d/$pkgname || return 1
+	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	cp doc/* "$pkgdir"/usr/share/doc/$pkgname/
 }
 
 compare() {
 	subpkgdesc="csync2 compare script"
 	arch="noarch"
-	depends="bash perl-digest-md5"
-
+	depents="bash perl-digest-md5"
 	mkdir -p "$subpkgdir"/usr/sbin
-	mv "$pkgdir"/usr/sbin/$pkgname-compare \
-		"$subpkgdir"/usr/sbin/ || return 1
+	mv "$pkgdir"/usr/sbin/$pkgname-compare "$subpkgdir"/usr/sbin/
 }
-
 md5sums="4069fc9e86e8508c392fe2862059eb91  csync2-2.0.tar.gz
 8fc73254db29316f9125761d18f1ed46  longlong-format.patch
-5908c4106d4866ab1c1f88f4c9482c9f  rsync-strlcpy-disable.patch
-bf77ad1534addbd596a08d1f7084e85e  csync2.initd"
+11d0bb642b3137ede6e97a33e18893d2  have-strlcpy.patch
+0cc2bcbbc3f9dc00bff534bcc785c225  csync2.initd"
 sha256sums="11cb37380fb185bce0c22b804fec9b01c385d9d83cc528cfd48d748453834fa2  csync2-2.0.tar.gz
 afb1317987cc4b81908bc437269162c7af23b34e6842306483da5b53efce2db3  longlong-format.patch
-339c7f5d91ff7ed3e63de5a5e39cf17efd7533f9c460eb81db76003acb164017  rsync-strlcpy-disable.patch
-0c1488e6bca746d8e5c5e3d893997b94e3c1766de69270d7c5c5a2282fb3b767  csync2.initd"
+ad7af0b971b413eb093dd32dd7cb2d8eb17ad590d3ba8f113015a49bde4b7526  have-strlcpy.patch
+f099fcb55fecbf8f4af5e414db5af57e2eedc7eeb369308acc5757dd9af8c1b9  csync2.initd"
 sha512sums="f91fd222f67affe9634471d341b43ff67854a6ed25b620301a454e98a79a9fb80b2a66eb8713546758fd08300d52751e5ca7472c696daa20ee11779b87a830f8  csync2-2.0.tar.gz
 38a17cbf23cbccd4996ad1af049851e33179586e619e3f3edbfacbaa36662e44d916839acd59b1cfc67b3af9042c3258068ec9e5b57f7e26c00a41a0e6f0e148  longlong-format.patch
-c44ad7e7fb7093f66fd9582b5309e3929dfdf7b76ef4d234d346fa25158f088b9436db9a1989d036d739570459867210d053af62125facb66e4f5202448c7bea  rsync-strlcpy-disable.patch
-5050af0004679c7c63e0eb41a8dfed9ca1d92ce6acaee7c5e2150ce808474c61e6feb84f9b77185a282fbb36de9b981e1eab937ee0fb1ec045ab587960fda812  csync2.initd"
+46a12907e8004d5f92aa3ca6af171512590ba99cfb6ee296b4608d4658d9444a5e8b4b90a95a714ecfd834119a83539663991f141ed8258f8b3a78a26bf36ed5  have-strlcpy.patch
+e28e17dee7c619da4166cf1c172c86cf435079ba964ca5a8eceda61823e49050f24714f9b936280686e1903b89cb51f2d5770f0d4bc401ec67e04746f0f3224b  csync2.initd"
diff --git a/testing/csync2/csync2.initd b/testing/csync2/csync2.initd
index 424a1e2..dc5bce0 100644
--- a/testing/csync2/csync2.initd
+++ b/testing/csync2/csync2.initd
_at_@ -1,6 +1,5 @@
 #!/sbin/openrc-run
 
-name="$SVCNAME"
 pidfile="/var/run/$SVCNAME.pid"
 command="/usr/sbin/$SVCNAME"
 command_args="-ii${CSYNC2_OPTS:+ $CSYNC2_OPTS}"
diff --git a/testing/csync2/csync2.post-install b/testing/csync2/csync2.post-install
new file mode 100644
index 0000000..92aa808
--- /dev/null
+++ b/testing/csync2/csync2.post-install
_at_@ -0,0 +1,24 @@
+#!/bin/sh
+
+SSL="/etc/csync2/csync2_ssl_"
+SERV="/etc/services"
+INETD="/etc/inetd.conf"
+
+if [ ! -f ${SSL}key.pem -o ! -f ${SSL}cert.pem ]; then
+        openssl genrsa -out ${SSL}key.pem 1024 >/dev/null 2>&1
+        yes '' | openssl req -new -key ${SSL}key.pem -out ${SSL}cert.csr >/dev/null 2>&1
+        openssl x509 -req -days 3600 -in ${SSL}cert.csr -out ${SSL}cert.pem -signkey ${SSL}key.pem >/dev/null 2>&1
+        rm ${SSL}cert.csr
+fi
+
+if [ ! -f ${SERV} ]; then
+        touch ${SERV}
+fi
+grep -q csync2 ${SERV} || echo -e "csync2\t\t30865/tcp" >> ${SERV}
+
+if [ ! -f ${INETD} ]; then
+        touch ${INETD}
+fi
+grep -q csync2 ${INETD} || echo "csync2 stream tcp nowait root /usr/sbin/csync2 csync2 -i" >> ${INETD}
+
+exit 0
diff --git a/testing/csync2/have-strlcpy.patch b/testing/csync2/have-strlcpy.patch
new file mode 100644
index 0000000..4f2278b
--- /dev/null
+++ b/testing/csync2/have-strlcpy.patch
_at_@ -0,0 +1,41 @@
+--- old/config.h.in
++++ new/config.h.in
+_at_@ -1,5 +1,8 @@
+ /* config.h.in.  Generated from configure.ac by autoheader.  */
+
++/* Define to 1 if you have the `strlcpy' function. */
++#undef HAVE_STRLCPY
++
+ /* Define to 1 if you have the `fchmod' function. */
+ #undef HAVE_FCHMOD
+
+--- old/configure.ac
++++ new/configure.ac
+_at_@ -43,7 +43,7 @@
+
+
+ dnl inspired by rsync's configure.ac
+-AC_CHECK_FUNCS(fchmod setmode open64 mkstemp64)
++AC_CHECK_FUNCS(strlcpy fchmod setmode open64 mkstemp64)
+ AC_CACHE_CHECK([for secure mkstemp],csync_cv_HAVE_SECURE_MKSTEMP,[
+ AC_TRY_RUN([#include <stdlib.h>
+ #include <sys/types.h>
+--- old/rsync.c
++++ new/rsync.c
+_at_@ -38,7 +38,7 @@
+ #include <w32api/windows.h>
+ #endif
+
+-
++#ifndef HAVE_STRLCPY
+ /* This has been taken from rsync:lib/compat.c */
+
+ /**
+_at_@ -61,6 +61,7 @@
+         }
+         return ret;
+ }
++#endif
+
+ /* splits filepath at the last '/', if any, like so:
+  *     dirname         basename        filepath 
\ No newline at end of file
diff --git a/testing/csync2/rsync-strlcpy-disable.patch b/testing/csync2/rsync-strlcpy-disable.patch
deleted file mode 100644
index 5d28e1d..0000000
--- a/testing/csync2/rsync-strlcpy-disable.patch
+++ /dev/null
_at_@ -1,20 +0,0 @@
---- old/rsync.c
-+++ new/rsync.c
-_at_@ -48,7 +48,7 @@
-  * _at_param bufsize is the size of the destination buffer.
-  *
-  * _at_return index of the terminating byte.
-- **/
-+ * disabled
- static size_t strlcpy(char *d, const char *s, size_t bufsize)
- {
-         size_t len = strlen(s);
-_at_@ -61,7 +61,7 @@
-         }
-         return ret;
- }
--
-+ **/
- /* splits filepath at the last '/', if any, like so:
-  *	dirname		basename	filepath
-  *	"/"		""		"/"
-- 
2.5.3
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Wed Sep 30 2015 - 17:29:16 GMT