Add systemd foo, get rid of some obsolete patches
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/csync2?expand=0&rev=25
This commit is contained in:
parent
db6645b046
commit
bd7d9e9f31
@ -1,38 +0,0 @@
|
|||||||
Index: csync2-1.34/conn.c
|
|
||||||
===================================================================
|
|
||||||
--- csync2-1.34.orig/conn.c
|
|
||||||
+++ csync2-1.34/conn.c
|
|
||||||
@@ -50,7 +50,9 @@ SSL *conn_ssl;
|
|
||||||
int conn_open(const char *peername)
|
|
||||||
{
|
|
||||||
struct sockaddr_in sin;
|
|
||||||
+ struct sockaddr_in sme;
|
|
||||||
struct hostent *hp;
|
|
||||||
+ struct hostent *me;
|
|
||||||
int on = 1;
|
|
||||||
|
|
||||||
hp = gethostbyname(peername);
|
|
||||||
@@ -69,6 +71,23 @@ int conn_open(const char *peername)
|
|
||||||
bcopy(hp->h_addr, &sin.sin_addr, hp->h_length);
|
|
||||||
sin.sin_port = htons(csync_port);
|
|
||||||
|
|
||||||
+ /* Try to bind to IP address of local hostname, else in cases where
|
|
||||||
+ * there's multiple local IPs on the same subnet, we might autobind
|
|
||||||
+ * to the wrong one, and the remote csync2 instance will fail because
|
|
||||||
+ * it verifies the expected hostname against the initiating IP.
|
|
||||||
+ * If the explicit bind fails for some reason though, we'll still
|
|
||||||
+ * try to connect (it might work, and it can't hurt...).
|
|
||||||
+ */
|
|
||||||
+ me = gethostbyname(myhostname);
|
|
||||||
+ if (me) {
|
|
||||||
+ sme.sin_family = me->h_addrtype;
|
|
||||||
+ bcopy(me->h_addr, &sme.sin_addr, me->h_length);
|
|
||||||
+ sme.sin_port = 0; /* random port */
|
|
||||||
+ if (bind(conn_fd_in, (struct sockaddr *)&sme, sizeof(sme)) < 0) {
|
|
||||||
+ csync_debug(1, "Can't bind local socket (attempting connect anyway).\n");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (connect(conn_fd_in, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
|
|
||||||
csync_debug(1, "Can't connect to remote host.\n");
|
|
||||||
close(conn_fd_in); conn_fd_in = -1;
|
|
@ -1,15 +1,17 @@
|
|||||||
--- csync2-1.33/csync2.xinetd.fix-xinetd 2007-01-24 21:18:04.000000000 +0100
|
Index: csync2-2.0+git.1368794815.cf835a7/csync2.xinetd
|
||||||
+++ csync2-1.33/csync2.xinetd 2007-01-24 21:19:47.000000000 +0100
|
===================================================================
|
||||||
|
--- csync2-2.0+git.1368794815.cf835a7.orig/csync2.xinetd
|
||||||
|
+++ csync2-2.0+git.1368794815.cf835a7/csync2.xinetd
|
||||||
@@ -1,4 +1,4 @@
|
@@ -1,4 +1,4 @@
|
||||||
-# default: on
|
-# default: on
|
||||||
+# default: off
|
+# default: off
|
||||||
# description: csync2
|
# description: csync2
|
||||||
service csync2
|
service csync2
|
||||||
{
|
{
|
||||||
@@ -9,7 +9,9 @@
|
@@ -9,7 +9,9 @@ service csync2
|
||||||
group = root
|
group = root
|
||||||
server = /usr/sbin/csync2
|
server = /usr/sbin/csync2
|
||||||
server_args = -i
|
server_args = -i -l
|
||||||
+ port = 30865
|
+ port = 30865
|
||||||
+ type = UNLISTED
|
+ type = UNLISTED
|
||||||
#log_on_failure += USERID
|
#log_on_failure += USERID
|
||||||
|
6
csync2.socket
Normal file
6
csync2.socket
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[Socket]
|
||||||
|
ListenStream=30865
|
||||||
|
Accept=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sockets.target
|
40
csync2.spec
40
csync2.spec
@ -28,29 +28,27 @@ Url: http://oss.linbit.com/csync2/
|
|||||||
Source0: %{name}-%{version}.tar.bz2
|
Source0: %{name}-%{version}.tar.bz2
|
||||||
Source1: csync2-README.quickstart
|
Source1: csync2-README.quickstart
|
||||||
Source2: csync2-rm-ssl-cert
|
Source2: csync2-rm-ssl-cert
|
||||||
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
|
Source3: csync2.socket
|
||||||
|
Source4: csync2@.service
|
||||||
Patch0: csync2-fix-xinetd.patch
|
Patch0: csync2-fix-xinetd.patch
|
||||||
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
|
|
||||||
Patch3: force-debug-stderr-off-inetd.patch
|
|
||||||
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
|
|
||||||
Patch4: bind-to-local-hostname.patch
|
|
||||||
Patch10: add-ac_prog_cpp.patch
|
Patch10: add-ac_prog_cpp.patch
|
||||||
Patch11: fix-csync2_ssl_cert-filename.patch
|
Patch11: fix-csync2_ssl_cert-filename.patch
|
||||||
Patch12: fix-sonames.patch
|
Patch12: fix-sonames.patch
|
||||||
|
|
||||||
Requires: openssl
|
Requires: openssl
|
||||||
Requires: sqlite3
|
Requires: sqlite3
|
||||||
|
%{?systemd_requires}
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: bison
|
BuildRequires: bison
|
||||||
BuildRequires: flex
|
BuildRequires: flex
|
||||||
BuildRequires: libgnutls-devel
|
BuildRequires: libgnutls-devel
|
||||||
BuildRequires: libmysqlclient-devel
|
|
||||||
BuildRequires: librsync-devel
|
|
||||||
BuildRequires: librsync-devel
|
BuildRequires: librsync-devel
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: postgresql-devel
|
|
||||||
BuildRequires: sqlite3-devel
|
BuildRequires: sqlite3-devel
|
||||||
|
%if 0%{?suse_version} >= 1210
|
||||||
|
BuildRequires: systemd
|
||||||
|
%endif
|
||||||
# texlive is for pdflatex to build PDF version of the manual
|
# texlive is for pdflatex to build PDF version of the manual
|
||||||
BuildRequires: texlive-latex
|
BuildRequires: texlive-latex
|
||||||
BuildRequires: texlive-nopageno
|
BuildRequires: texlive-nopageno
|
||||||
@ -68,23 +66,18 @@ It is expedient for HA-clusters, HPC-clusters, COWs and server farms.
|
|||||||
# Is this next really necessary?
|
# Is this next really necessary?
|
||||||
%{?suse_update_config:%{suse_update_config}}
|
%{?suse_update_config:%{suse_update_config}}
|
||||||
|
|
||||||
#%patch0 -p1 -b .fix-xinetd
|
%patch0 -p1
|
||||||
# might actually want patch3
|
|
||||||
#%patch3 -p1
|
|
||||||
# patch4 needs rewriting, presumably
|
|
||||||
#%patch4 -p1
|
|
||||||
%patch10 -p1
|
%patch10 -p1
|
||||||
%patch11 -p1
|
%patch11 -p1
|
||||||
%patch12 -p1
|
%patch12 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export CFLAGS="$RPM_OPT_FLAGS -I/usr/include/pgsql"
|
export CFLAGS="$RPM_OPT_FLAGS"
|
||||||
if ! [ -f configure ]; then ./autogen.sh; fi
|
if ! [ -f configure ]; then ./autogen.sh; fi
|
||||||
%configure --enable-mysql --enable-postgres --enable-sqlite3 \
|
%configure --enable-sqlite3 \
|
||||||
--sysconfdir=%{_sysconfdir}/csync2 --docdir=%{_docdir}/%{name}
|
--sysconfdir=%{_sysconfdir}/csync2 --docdir=%{_docdir}/%{name}
|
||||||
|
|
||||||
make all
|
make %{?_smp_mflags}
|
||||||
#make %{?_smp_mflags}
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%makeinstall
|
%makeinstall
|
||||||
@ -92,11 +85,18 @@ mkdir -p %{buildroot}%{_localstatedir}/lib/csync2
|
|||||||
install -p -D -m 644 csync2.xinetd %{buildroot}%{_sysconfdir}/xinetd.d/csync2
|
install -p -D -m 644 csync2.xinetd %{buildroot}%{_sysconfdir}/xinetd.d/csync2
|
||||||
install -p -m 644 %{SOURCE1} %{buildroot}%{_docdir}/%{name}/README.quickstart
|
install -p -m 644 %{SOURCE1} %{buildroot}%{_docdir}/%{name}/README.quickstart
|
||||||
install -p -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/csync2-rm-ssl-cert
|
install -p -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/csync2-rm-ssl-cert
|
||||||
|
mkdir -p %{buildroot}%{_unitdir}
|
||||||
|
install -p -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/
|
||||||
|
install -p -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/
|
||||||
# We need these empty files to be able to %%ghost them
|
# We need these empty files to be able to %%ghost them
|
||||||
touch %{buildroot}%{_sysconfdir}/csync2/csync2_ssl_key.pem
|
touch %{buildroot}%{_sysconfdir}/csync2/csync2_ssl_key.pem
|
||||||
touch %{buildroot}%{_sysconfdir}/csync2/csync2_ssl_cert.pem
|
touch %{buildroot}%{_sysconfdir}/csync2/csync2_ssl_cert.pem
|
||||||
|
|
||||||
|
%pre
|
||||||
|
%service_add_pre csync2.socket
|
||||||
|
|
||||||
%post
|
%post
|
||||||
|
%service_add_post csync2.socket
|
||||||
umask 077
|
umask 077
|
||||||
if [ ! -f %{_sysconfdir}/csync2/csync2_ssl_key.pem ]; then
|
if [ ! -f %{_sysconfdir}/csync2/csync2_ssl_key.pem ]; then
|
||||||
/usr/bin/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %{_sysconfdir}/csync2/csync2_ssl_key.pem 2>/dev/null
|
/usr/bin/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %{_sysconfdir}/csync2/csync2_ssl_key.pem 2>/dev/null
|
||||||
@ -118,15 +118,21 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
|
%service_del_preun csync2.socket
|
||||||
# Cleanup all databases upon last removal
|
# Cleanup all databases upon last removal
|
||||||
if [ $1 -eq 0 ]; then
|
if [ $1 -eq 0 ]; then
|
||||||
rm -f %{_localstatedir}/lib/csync2/*
|
rm -f %{_localstatedir}/lib/csync2/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%service_del_postun csync2.socket
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%{_sbindir}/csync2
|
%{_sbindir}/csync2
|
||||||
%{_sbindir}/csync2-compare
|
%{_sbindir}/csync2-compare
|
||||||
|
%{_unitdir}/csync2.socket
|
||||||
|
%{_unitdir}/csync2@.service
|
||||||
%dir %{_localstatedir}/lib/csync2/
|
%dir %{_localstatedir}/lib/csync2/
|
||||||
%{_docdir}/%{name}
|
%{_docdir}/%{name}
|
||||||
%dir %{_sysconfdir}/csync2/
|
%dir %{_sysconfdir}/csync2/
|
||||||
|
9
csync2@.service
Normal file
9
csync2@.service
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=csync2 connection handler %I %f %u
|
||||||
|
After=syslog.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=-/usr/sbin/csync2 -i -v
|
||||||
|
StandardInput=socket
|
||||||
|
StandardOutput=socket
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
Index: csync2-1.34/csync2.c
|
|
||||||
===================================================================
|
|
||||||
--- csync2-1.34.orig/csync2.c
|
|
||||||
+++ csync2-1.34/csync2.c
|
|
||||||
@@ -458,6 +458,16 @@ int main(int argc, char ** argv)
|
|
||||||
for (i=0; myhostname[i]; i++)
|
|
||||||
myhostname[i] = tolower(myhostname[i]);
|
|
||||||
|
|
||||||
+ if ( mode == MODE_INETD ) {
|
|
||||||
+ /* Force debug level below zero when running under inetd,
|
|
||||||
+ * else stderr junk may be emitted back to some other host
|
|
||||||
+ * which breaks the protocol. One case is where a target
|
|
||||||
+ * directory does not exist resulting in allegations of
|
|
||||||
+ * I/O error during rsync write (bnc#752563)
|
|
||||||
+ */
|
|
||||||
+ csync_debug_level = -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/* Stand-alone server mode. This is a hack..
|
|
||||||
*/
|
|
||||||
if ( mode == MODE_SERVER || mode == MODE_SINGLE ) {
|
|
Loading…
Reference in New Issue
Block a user