Blame SOURCES/bz1376819-2-Use-RuntimeDirectory-instead-of-tmpfiles.d.patch

478375
From fde7fa0c6408709ccdd090aa9064e6a78232498a Mon Sep 17 00:00:00 2001
478375
From: =?UTF-8?q?Ferenc=20W=C3=A1gner?= <wferi@debian.org>
478375
Date: Mon, 28 Nov 2016 14:47:05 +0100
478375
Subject: [PATCH] Use RuntimeDirectory instead of tmpfiles.d
478375
MIME-Version: 1.0
478375
Content-Type: text/plain; charset=UTF-8
478375
Content-Transfer-Encoding: 8bit
478375
478375
This reverts part of commit 32123f6bb2ebc4f9ac7865945cc85a9c9b903dc6.
478375
478375
A simple directive is a much lighter solution to the same problem, and
478375
automatically follows the specified User.  I copied the 0770 modes from
478375
the corresponding init scripts; they could use a little documentation.
478375
478375
Signed-off-by: Ferenc Wágner <wferi@debian.org>
478375
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
478375
(cherry picked from commit c733e9417ef1d2f31268e9b6f99a8fc7712fcea7)
478375
---
478375
 conf/Makefile.am                    |  2 +-
478375
 conf/tmpfiles.d/Makefile.am         | 40 -------------------------------------
478375
 conf/tmpfiles.d/corosync-qnetd.conf |  1 -
478375
 configure.ac                        | 10 +---------
478375
 corosync.spec.in                    |  6 +-----
478375
 init/corosync-qdevice.service.in    |  2 ++
478375
 init/corosync-qnetd.service.in      |  2 ++
478375
 7 files changed, 7 insertions(+), 56 deletions(-)
478375
 delete mode 100644 conf/tmpfiles.d/Makefile.am
478375
 delete mode 100644 conf/tmpfiles.d/corosync-qnetd.conf
478375
478375
diff --git a/conf/Makefile.am b/conf/Makefile.am
478375
index 6382386..807b6cc 100644
478375
--- a/conf/Makefile.am
478375
+++ b/conf/Makefile.am
478375
@@ -70,4 +70,4 @@ dbusdir			= $(sysconfdir)/dbus-1/system.d
478375
 dbus_DATA		= corosync-signals.conf
478375
 endif
478375
 
478375
-SUBDIRS = logrotate tmpfiles.d
478375
+SUBDIRS = logrotate
478375
diff --git a/conf/tmpfiles.d/Makefile.am b/conf/tmpfiles.d/Makefile.am
478375
deleted file mode 100644
478375
index 653129a..0000000
478375
--- a/conf/tmpfiles.d/Makefile.am
478375
+++ /dev/null
478375
@@ -1,40 +0,0 @@
478375
-# Copyright (c) 2016 Red Hat, Inc.
478375
-#
478375
-# Authors:Jan Friesse (jfriesse@redhat.com)
478375
-#
478375
-# This software licensed under BSD license, the text of which follows:
478375
-#
478375
-# Redistribution and use in source and binary forms, with or without
478375
-# modification, are permitted provided that the following conditions are met:
478375
-#
478375
-# - Redistributions of source code must retain the above copyright notice,
478375
-#   this list of conditions and the following disclaimer.
478375
-# - Redistributions in binary form must reproduce the above copyright notice,
478375
-#   this list of conditions and the following disclaimer in the documentation
478375
-#   and/or other materials provided with the distribution.
478375
-# - Neither the name of the MontaVista Software, Inc. nor the names of its
478375
-#   contributors may be used to endorse or promote products derived from this
478375
-#   software without specific prior written permission.
478375
-#
478375
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
478375
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
478375
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
478375
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
478375
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
478375
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
478375
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
478375
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
478375
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
478375
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
478375
-# THE POSSIBILITY OF SUCH DAMAGE.
478375
-
478375
-MAINTAINERCLEANFILES    = Makefile.in
478375
-
478375
-EXTRA_DIST		= corosync-qnetd.conf
478375
-
478375
-if BUILD_QNETD
478375
-if INSTALL_SYSTEMD
478375
-tmpfilesdirdir		= ${TMPFILESDIR}
478375
-tmpfilesdir_DATA	= corosync-qnetd.conf
478375
-endif
478375
-endif
478375
diff --git a/conf/tmpfiles.d/corosync-qnetd.conf b/conf/tmpfiles.d/corosync-qnetd.conf
478375
deleted file mode 100644
478375
index f4cbd03..0000000
478375
--- a/conf/tmpfiles.d/corosync-qnetd.conf
478375
+++ /dev/null
478375
@@ -1 +0,0 @@
478375
-d /var/run/corosync-qnetd 0770 root root -
478375
diff --git a/configure.ac b/configure.ac
478375
index 01f7aa5..342da77 100644
478375
--- a/configure.ac
478375
+++ b/configure.ac
478375
@@ -204,8 +204,7 @@ AC_CONFIG_FILES([Makefile
478375
 		 conf/Makefile
478375
 		 qdevices/Makefile
478375
 		 Doxyfile
478375
-		 conf/logrotate/Makefile
478375
-		 conf/tmpfiles.d/Makefile])
478375
+		 conf/logrotate/Makefile])
478375
 
478375
 ### Local business
478375
 
478375
@@ -401,11 +400,6 @@ AC_ARG_WITH([logrotatedir],
478375
 	[ LOGROTATEDIR="$withval" ],
478375
 	[ LOGROTATEDIR="$sysconfdir/logrotate.d" ])
478375
 
478375
-AC_ARG_WITH([tmpfilesdir],
478375
-	[  --with-tmpfilesdir=DIR   : path to tmpfiles.d configuration files directory. ],
478375
-	[ TMPFILESDIR="$withval" ],
478375
-	[ TMPFILESDIR="/lib/tmpfiles.d" ])
478375
-
478375
 AC_ARG_ENABLE([snmp],
478375
 	[  --enable-snmp                   : SNMP protocol support ],
478375
 	[ default="no" ])
478375
@@ -731,7 +725,6 @@ INITWRAPPERSDIR=$(eval echo ${INITWRAPPERSDIR})
478375
 AC_SUBST([INITWRAPPERSDIR])
478375
 AC_SUBST([LOGDIR])
478375
 AC_SUBST([LOGROTATEDIR])
478375
-AC_SUBST([TMPFILESDIR])
478375
 
478375
 AC_SUBST([SOMAJOR])
478375
 AC_SUBST([SOMINOR])
478375
@@ -774,7 +767,6 @@ AC_MSG_RESULT([  System init.d directory  = ${INITDDIR}])
478375
 AC_MSG_RESULT([  System systemd directory = ${SYSTEMDDIR}])
478375
 AC_MSG_RESULT([  System upstart directory = ${UPSTARTDIR}])
478375
 AC_MSG_RESULT([  System init wraps dir    = ${INITWRAPPERSDIR}])
478375
-AC_MSG_RESULT([  System tmpfiles.d        = ${TMPFILESDIR}])
478375
 AC_MSG_RESULT([  Log directory            = ${LOGDIR}])
478375
 AC_MSG_RESULT([  Log rotate directory     = ${LOGROTATEDIR}])
478375
 AC_MSG_RESULT([  corosync config dir      = ${COROSYSCONFDIR}])
478375
diff --git a/corosync.spec.in b/corosync.spec.in
478375
index d101189..6e57c97 100644
478375
--- a/corosync.spec.in
478375
+++ b/corosync.spec.in
478375
@@ -134,8 +134,7 @@ export rdmacm_LIBS=-lrdmacm \
478375
 %endif
478375
 	--with-initddir=%{_initrddir} \
478375
 	--with-systemddir=%{_unitdir} \
478375
-	--with-upstartdir=%{_sysconfdir}/init \
478375
-	--with-tmpfilesdir=%{_tmpfilesdir}
478375
+	--with-upstartdir=%{_sysconfdir}/init
478375
 
478375
 make %{_smp_mflags}
478375
 
478375
@@ -176,8 +175,6 @@ install -m 644 init/corosync-qnetd.sysconfig.example \
478375
 %if %{with systemd}
478375
 sed -i -e 's/^#User=/User=/' \
478375
    %{buildroot}%{_unitdir}/corosync-qnetd.service
478375
-sed -i -e 's/root/coroqnetd/g' \
478375
-   %{buildroot}%{_tmpfilesdir}/corosync-qnetd.conf
478375
 %else
478375
 sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
478375
    %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
478375
@@ -503,7 +500,6 @@ fi
478375
 %{_unitdir}/corosync-qnetd.service
478375
 %dir %{_datadir}/corosync
478375
 %{_datadir}/corosync/corosync-qnetd
478375
-%{_tmpfilesdir}/corosync-qnetd.conf
478375
 %else
478375
 %{_initrddir}/corosync-qnetd
478375
 %endif
478375
diff --git a/init/corosync-qdevice.service.in b/init/corosync-qdevice.service.in
478375
index 8de4e5b..33746a0 100644
478375
--- a/init/corosync-qdevice.service.in
478375
+++ b/init/corosync-qdevice.service.in
478375
@@ -9,6 +9,8 @@ After=corosync.service
478375
 ExecStart=@INITWRAPPERSDIR@/corosync-qdevice start
478375
 ExecStop=@INITWRAPPERSDIR@/corosync-qdevice stop
478375
 Type=forking
478375
+RuntimeDirectory=corosync-qdevice
478375
+RuntimeDirectoryMode=0770
478375
 
478375
 [Install]
478375
 WantedBy=multi-user.target
478375
diff --git a/init/corosync-qnetd.service.in b/init/corosync-qnetd.service.in
478375
index cae98fe..54b9849 100644
478375
--- a/init/corosync-qnetd.service.in
478375
+++ b/init/corosync-qnetd.service.in
478375
@@ -12,6 +12,8 @@ Type=simple
478375
 Restart=on-abnormal
478375
 # Uncomment and set user who should be used for executing qnetd
478375
 #User=coroqnetd
478375
+RuntimeDirectory=corosync-qnetd
478375
+RuntimeDirectoryMode=0770
478375
 
478375
 [Install]
478375
 WantedBy=multi-user.target
478375
-- 
478375
1.8.3.1
478375