summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Bidulock2017-05-18 09:11:23 -0600
committerBrian Bidulock2017-05-18 09:11:23 -0600
commitdd1c5b14d1258f2484fc922435d52486c99eac1b (patch)
tree2616ef80faf1e604ac9c13bd4eb4b24bf973b821
downloadaur-dd1c5b14d1258f2484fc922435d52486c99eac1b.tar.gz
initial version
-rw-r--r--.SRCINFO25
-rw-r--r--PKGBUILD54
-rwxr-xr-xcsync2-rm-ssl-cert46
-rw-r--r--csync2.socket7
-rw-r--r--csync2@.service9
5 files changed, 141 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..41963f3f547
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,25 @@
+pkgbase = csync2-git
+ pkgdesc = Asynchronous cluster syncronisation tool based on librsync and inspired by Unison
+ pkgver = 2.0.r8.g175a01c
+ pkgrel = 1
+ url = http://oss.linbit.com/csync2/
+ arch = i686
+ arch = x86_64
+ license = GPL
+ makedepends = texlive-bin
+ makedepends = sqlite
+ makedepends = git
+ depends = librsync
+ depends = gnutls
+ optdepends = sqlite: for sqlite backend
+ source = csync2-git::git://git.linbit.com/csync2.git
+ source = csync2.socket
+ source = csync2@.service
+ source = csync2-rm-ssl-cert
+ md5sums = SKIP
+ md5sums = 276efe22ab32b540fbdd6ada3479f154
+ md5sums = 0b5c64016805a451ca440b679b3674b6
+ md5sums = abadf30dbc4695a1686814937e2cd829
+
+pkgname = csync2-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..c58826401be
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,54 @@
+# vim:set ts=2 sw=2 et:
+# Maintainer: Brian Bidulock <bidulock@openss7.org>
+
+pkgname=csync2-git
+_pkgname=csync2
+pkgver=2.0.r8.g175a01c
+pkgrel=1
+arch=('i686' 'x86_64')
+pkgdesc="Asynchronous cluster syncronisation tool based on librsync and inspired by Unison"
+url="http://oss.linbit.com/csync2/"
+license=('GPL')
+makedepends=('texlive-bin' 'sqlite' 'git')
+depends=('librsync' 'gnutls')
+optdepends=('sqlite: for sqlite backend')
+source=("$pkgname::git://git.linbit.com/csync2.git"
+ 'csync2.socket'
+ 'csync2@.service'
+ 'csync2-rm-ssl-cert')
+md5sums=('SKIP'
+ '276efe22ab32b540fbdd6ada3479f154'
+ '0b5c64016805a451ca440b679b3674b6'
+ 'abadf30dbc4695a1686814937e2cd829')
+
+pkgver() {
+ cd ${pkgname}
+ git describe --long --tags | sed -E 's/^csync2-//;s/([^-]*-g)/r\1/;s/-/./g'
+}
+
+prepare() {
+ cd ${pkgname}
+ sed -r 's,AC_PROG_CC$,AC_PROG_CC\nAC_PROG_CPP,' -i configure.ac
+ autoreconf -fiv
+}
+
+build() {
+ cd ${pkgname}
+
+ ./configure \
+ --prefix=/usr \
+ --bindir=/usr/bin \
+ --sbindir=/usr/bin \
+ --sysconfdir=/etc/csync2 \
+ --localstatedir=/var
+ make V=0
+}
+
+package() {
+ cd ${pkgname}
+
+ make DESTDIR="${pkgdir}" install
+ install -Dm644 ../'csync2.socket' "$pkgdir/usr/lib/systemd/system/csync2.socket"
+ install -Dm644 ../'csync2@.service' "$pkgdir/usr/lib/systemd/system/csync2@.service"
+ install -Dm755 ../'csync2-rm-ssl-cert' "$pkgdir/usr/bin/csync2-rm-ssl-cert"
+}
diff --git a/csync2-rm-ssl-cert b/csync2-rm-ssl-cert
new file mode 100755
index 00000000000..06a3809a595
--- /dev/null
+++ b/csync2-rm-ssl-cert
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+if [ $# -eq 0 -o "$1" = "-h" ]; then
+ cat <<END
+
+Remove a peer's SSL certificate from csync2's local database. Use this after
+replacing a peer node (or regenerating its SSL certificate).
+
+Usage: $0 [-h] <hostname>
+
+Options:
+ -h Display this usage information
+
+END
+ exit 0
+fi
+
+DBFILE=/var/lib/csync2/$(hostname).db3
+if [ ! -f "$DBFILE" ]; then
+ echo "Local csync2 database ($DBFILE) not found."
+ exit 1
+fi
+
+# Strip double and single quotes from hostname so they can't interfere with the SQL
+PEERNAME=$(echo $1 | sed -e "s/['\"]//g")
+
+certcount()
+{
+ echo "SELECT COUNT(peername) FROM x509_cert WHERE peername='$1';" | sqlite3 $DBFILE
+}
+
+if [ $(certcount "$PEERNAME") -eq 0 ]; then
+ echo "Certificate for '$PEERNAME' not in local database."
+ exit 0
+fi
+
+echo "DELETE FROM x509_cert WHERE peername='$PEERNAME';" | sqlite3 $DBFILE
+
+if [ $(certcount "$PEERNAME") -ne 0 ]; then
+ echo "Error removing certificate for '$PEERNAME' from local database."
+ exit 1
+fi
+
+echo "Certificate for '$PEERNAME' removed from local database."
+
+
diff --git a/csync2.socket b/csync2.socket
new file mode 100644
index 00000000000..c314aa27b9c
--- /dev/null
+++ b/csync2.socket
@@ -0,0 +1,7 @@
+[Socket]
+ListenStream=30865
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
+
diff --git a/csync2@.service b/csync2@.service
new file mode 100644
index 00000000000..d2cc59653a3
--- /dev/null
+++ b/csync2@.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Csync2 connection handler
+After=syslog.target
+
+[Service]
+ExecStart=-/usr/bin/csync2 -i -v
+StandardInput=socket
+StandardOutput=socket
+