build: add a tmpfiles.d config file for /run/gluster

New distrubutions have a /run directory on a volatile tmpfs filesystem.
This causes /run/gluster to be removed with each reboot. A tmpfiles.d
configuration is used to create the directory on boot.

EL5 and EL-6 do not use /run, current Fedora versions do. By checking
%{_tmpfilesdir} in the .spec, we can identify if the distribution uses
tmpfiles.d.

Change-Id: I231e7d6603d573cb905246558e14a51577c0eb56
BUG: 1182934
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/9458
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Lalatendu Mohanty <lmohanty@redhat.com>
This commit is contained in:
Niels de Vos 2015-01-16 13:48:49 +01:00
parent 4d003c1b1b
commit 10e4add35f
4 changed files with 28 additions and 0 deletions

View File

@ -180,6 +180,7 @@ AC_CONFIG_FILES([Makefile
extras/init.d/glusterd-SuSE
extras/systemd/Makefile
extras/systemd/glusterd.service
extras/run-gluster.tmpfiles
extras/benchmarking/Makefile
extras/hook-scripts/Makefile
extras/ocf/Makefile
@ -295,6 +296,13 @@ AC_ARG_WITH(launchddir,
[launchddir='/Library/LaunchDaemons'])
AC_SUBST(launchddir)
AC_ARG_WITH(tmpfilesdir,
AC_HELP_STRING([--with-tmpfilesdir=DIR],
[tmpfiles config in DIR, disabled by default]),
[tmpfilesdir=$withval],
[tmpfilesdir=''])
AC_SUBST(tmpfilesdir)
AC_ARG_WITH([ocf],
[AS_HELP_STRING([--without-ocf], [build OCF-compliant cluster resource agents])],
,

View File

@ -21,6 +21,11 @@ EXTRA_DIST = $(conf_DATA) specgen.scm glusterfs-mode.el glusterfs.vim \
command-completion/README
install-data-local:
if [ -n "$(tmpfilesdir)" ]; then \
$(mkdir_p) $(DESTDIR)$(tmpfilesdir); \
$(INSTALL_DATA) run-gluster.tmpfiles \
$(DESTDIR)$(tmpfilesdir)/gluster.conf; \
fi
$(mkdir_p) $(DESTDIR)$(GLUSTERD_WORKDIR)/groups
$(INSTALL_DATA) $(top_srcdir)/extras/group-virt.example \
$(DESTDIR)$(GLUSTERD_WORKDIR)/groups/virt

View File

@ -0,0 +1,2 @@
# hardcoding /run for now, should be detected while building from source?
d /run/gluster 0755 root root -

View File

@ -73,6 +73,12 @@
%global _with_systemd true
%endif
%if 0%{?_tmpfilesdir:1}
%define _with_tmpfilesdir --with-tmpfilesdir=%{_tmpfilesdir}
%else
%define _with_tmpfilesdir --without-tmpfilesdir
%endif
# there is no systemtap support! Perhaps some day there will be
%global _without_systemtap --enable-systemtap=no
@ -485,6 +491,7 @@ This package provides the glusterfs server daemon.
# there is no need to run ./autogen or have a BuildRequires for automake.
[ -e 'install-sh' -o -e 'install.sh' ] || ./autogen.sh
%configure \
%{?_with_tmpfilesdir} \
%{?_without_rdma} \
%{?_without_epoll} \
%{?_without_fusermount} \
@ -831,6 +838,9 @@ fi
%exclude %{_mandir}/man8/gluster.8*
%dir %{_localstatedir}/log/glusterfs
%dir %{_localstatedir}/run/gluster
%if 0%{?_tmpfilesdir:1}
%{_tmpfilesdir}/gluster.conf
%endif
%dir %{_sharedstatedir}/glusterd
%if ( 0%{!?_without_rdma:1} )
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/rpc-transport/rdma*
@ -1020,6 +1030,9 @@ fi
%ghost %attr(0600,-,-) %{_sharedstatedir}/glusterd/nfs/run/nfs.pid
%changelog
* Fri Jan 16 2015 Niels de Vos <ndevos@redhat.com>
- add support for /run/gluster through a tmpfiles.d config file (#1182934)
* Fri Dec 12 2014 Niels de Vos <ndevos@redhat.com>
- do not package all /usr/share/glusterfs/* files in regression-tests (#1169005)