فهرست منبع

Use RuntimeDirectory instead of tmpfiles.d

This reverts part of commit 32123f6bb2ebc4f9ac7865945cc85a9c9b903dc6.

A simple directive is a much lighter solution to the same problem, and
automatically follows the specified User.  I copied the 0770 modes from
the corresponding init scripts; they could use a little documentation.

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
(cherry picked from commit c733e9417ef1d2f31268e9b6f99a8fc7712fcea7)
Ferenc Wágner 9 سال پیش
والد
کامیت
fde7fa0c64
7فایلهای تغییر یافته به همراه7 افزوده شده و 56 حذف شده
  1. 1 1
      conf/Makefile.am
  2. 0 40
      conf/tmpfiles.d/Makefile.am
  3. 0 1
      conf/tmpfiles.d/corosync-qnetd.conf
  4. 1 9
      configure.ac
  5. 1 5
      corosync.spec.in
  6. 2 0
      init/corosync-qdevice.service.in
  7. 2 0
      init/corosync-qnetd.service.in

+ 1 - 1
conf/Makefile.am

@@ -70,4 +70,4 @@ dbusdir			= $(sysconfdir)/dbus-1/system.d
 dbus_DATA		= corosync-signals.conf
 dbus_DATA		= corosync-signals.conf
 endif
 endif
 
 
-SUBDIRS = logrotate tmpfiles.d
+SUBDIRS = logrotate

+ 0 - 40
conf/tmpfiles.d/Makefile.am

@@ -1,40 +0,0 @@
-# Copyright (c) 2016 Red Hat, Inc.
-#
-# Authors:Jan Friesse (jfriesse@redhat.com)
-#
-# This software licensed under BSD license, the text of which follows:
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# - Redistributions of source code must retain the above copyright notice,
-#   this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# - Neither the name of the MontaVista Software, Inc. nor the names of its
-#   contributors may be used to endorse or promote products derived from this
-#   software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-# THE POSSIBILITY OF SUCH DAMAGE.
-
-MAINTAINERCLEANFILES    = Makefile.in
-
-EXTRA_DIST		= corosync-qnetd.conf
-
-if BUILD_QNETD
-if INSTALL_SYSTEMD
-tmpfilesdirdir		= ${TMPFILESDIR}
-tmpfilesdir_DATA	= corosync-qnetd.conf
-endif
-endif

+ 0 - 1
conf/tmpfiles.d/corosync-qnetd.conf

@@ -1 +0,0 @@
-d /var/run/corosync-qnetd 0770 root root -

+ 1 - 9
configure.ac

@@ -204,8 +204,7 @@ AC_CONFIG_FILES([Makefile
 		 conf/Makefile
 		 conf/Makefile
 		 qdevices/Makefile
 		 qdevices/Makefile
 		 Doxyfile
 		 Doxyfile
-		 conf/logrotate/Makefile
-		 conf/tmpfiles.d/Makefile])
+		 conf/logrotate/Makefile])
 
 
 ### Local business
 ### Local business
 
 
@@ -401,11 +400,6 @@ AC_ARG_WITH([logrotatedir],
 	[ LOGROTATEDIR="$withval" ],
 	[ LOGROTATEDIR="$withval" ],
 	[ LOGROTATEDIR="$sysconfdir/logrotate.d" ])
 	[ LOGROTATEDIR="$sysconfdir/logrotate.d" ])
 
 
-AC_ARG_WITH([tmpfilesdir],
-	[  --with-tmpfilesdir=DIR   : path to tmpfiles.d configuration files directory. ],
-	[ TMPFILESDIR="$withval" ],
-	[ TMPFILESDIR="/lib/tmpfiles.d" ])
-
 AC_ARG_ENABLE([snmp],
 AC_ARG_ENABLE([snmp],
 	[  --enable-snmp                   : SNMP protocol support ],
 	[  --enable-snmp                   : SNMP protocol support ],
 	[ default="no" ])
 	[ default="no" ])
@@ -731,7 +725,6 @@ INITWRAPPERSDIR=$(eval echo ${INITWRAPPERSDIR})
 AC_SUBST([INITWRAPPERSDIR])
 AC_SUBST([INITWRAPPERSDIR])
 AC_SUBST([LOGDIR])
 AC_SUBST([LOGDIR])
 AC_SUBST([LOGROTATEDIR])
 AC_SUBST([LOGROTATEDIR])
-AC_SUBST([TMPFILESDIR])
 
 
 AC_SUBST([SOMAJOR])
 AC_SUBST([SOMAJOR])
 AC_SUBST([SOMINOR])
 AC_SUBST([SOMINOR])
@@ -774,7 +767,6 @@ AC_MSG_RESULT([  System init.d directory  = ${INITDDIR}])
 AC_MSG_RESULT([  System systemd directory = ${SYSTEMDDIR}])
 AC_MSG_RESULT([  System systemd directory = ${SYSTEMDDIR}])
 AC_MSG_RESULT([  System upstart directory = ${UPSTARTDIR}])
 AC_MSG_RESULT([  System upstart directory = ${UPSTARTDIR}])
 AC_MSG_RESULT([  System init wraps dir    = ${INITWRAPPERSDIR}])
 AC_MSG_RESULT([  System init wraps dir    = ${INITWRAPPERSDIR}])
-AC_MSG_RESULT([  System tmpfiles.d        = ${TMPFILESDIR}])
 AC_MSG_RESULT([  Log directory            = ${LOGDIR}])
 AC_MSG_RESULT([  Log directory            = ${LOGDIR}])
 AC_MSG_RESULT([  Log rotate directory     = ${LOGROTATEDIR}])
 AC_MSG_RESULT([  Log rotate directory     = ${LOGROTATEDIR}])
 AC_MSG_RESULT([  corosync config dir      = ${COROSYSCONFDIR}])
 AC_MSG_RESULT([  corosync config dir      = ${COROSYSCONFDIR}])

+ 1 - 5
corosync.spec.in

@@ -134,8 +134,7 @@ export rdmacm_LIBS=-lrdmacm \
 %endif
 %endif
 	--with-initddir=%{_initrddir} \
 	--with-initddir=%{_initrddir} \
 	--with-systemddir=%{_unitdir} \
 	--with-systemddir=%{_unitdir} \
-	--with-upstartdir=%{_sysconfdir}/init \
-	--with-tmpfilesdir=%{_tmpfilesdir}
+	--with-upstartdir=%{_sysconfdir}/init
 
 
 make %{_smp_mflags}
 make %{_smp_mflags}
 
 
@@ -176,8 +175,6 @@ install -m 644 init/corosync-qnetd.sysconfig.example \
 %if %{with systemd}
 %if %{with systemd}
 sed -i -e 's/^#User=/User=/' \
 sed -i -e 's/^#User=/User=/' \
    %{buildroot}%{_unitdir}/corosync-qnetd.service
    %{buildroot}%{_unitdir}/corosync-qnetd.service
-sed -i -e 's/root/coroqnetd/g' \
-   %{buildroot}%{_tmpfilesdir}/corosync-qnetd.conf
 %else
 %else
 sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
 sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
    %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
    %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
@@ -503,7 +500,6 @@ fi
 %{_unitdir}/corosync-qnetd.service
 %{_unitdir}/corosync-qnetd.service
 %dir %{_datadir}/corosync
 %dir %{_datadir}/corosync
 %{_datadir}/corosync/corosync-qnetd
 %{_datadir}/corosync/corosync-qnetd
-%{_tmpfilesdir}/corosync-qnetd.conf
 %else
 %else
 %{_initrddir}/corosync-qnetd
 %{_initrddir}/corosync-qnetd
 %endif
 %endif

+ 2 - 0
init/corosync-qdevice.service.in

@@ -9,6 +9,8 @@ After=corosync.service
 ExecStart=@INITWRAPPERSDIR@/corosync-qdevice start
 ExecStart=@INITWRAPPERSDIR@/corosync-qdevice start
 ExecStop=@INITWRAPPERSDIR@/corosync-qdevice stop
 ExecStop=@INITWRAPPERSDIR@/corosync-qdevice stop
 Type=forking
 Type=forking
+RuntimeDirectory=corosync-qdevice
+RuntimeDirectoryMode=0770
 
 
 [Install]
 [Install]
 WantedBy=multi-user.target
 WantedBy=multi-user.target

+ 2 - 0
init/corosync-qnetd.service.in

@@ -12,6 +12,8 @@ Type=simple
 Restart=on-abnormal
 Restart=on-abnormal
 # Uncomment and set user who should be used for executing qnetd
 # Uncomment and set user who should be used for executing qnetd
 #User=coroqnetd
 #User=coroqnetd
+RuntimeDirectory=corosync-qnetd
+RuntimeDirectoryMode=0770
 
 
 [Install]
 [Install]
 WantedBy=multi-user.target
 WantedBy=multi-user.target