From 10e4add35f64c24fe9ef03dc6824975fc9db1455 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 16 Jan 2015 13:48:49 +0100 Subject: 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 Reviewed-on: http://review.gluster.org/9458 Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY Reviewed-by: Lalatendu Mohanty --- configure.ac | 8 ++++++++ extras/Makefile.am | 5 +++++ extras/run-gluster.tmpfiles.in | 2 ++ glusterfs.spec.in | 13 +++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 extras/run-gluster.tmpfiles.in diff --git a/configure.ac b/configure.ac index a9326aa1a21..cfb0267209f 100644 --- a/configure.ac +++ b/configure.ac @@ -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])], , diff --git a/extras/Makefile.am b/extras/Makefile.am index a163b1ae3a2..28a66003042 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -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 diff --git a/extras/run-gluster.tmpfiles.in b/extras/run-gluster.tmpfiles.in new file mode 100644 index 00000000000..49a2662c4c8 --- /dev/null +++ b/extras/run-gluster.tmpfiles.in @@ -0,0 +1,2 @@ +# hardcoding /run for now, should be detected while building from source? +d /run/gluster 0755 root root - diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 876db1b635e..cd300ebd621 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -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 +- add support for /run/gluster through a tmpfiles.d config file (#1182934) + * Fri Dec 12 2014 Niels de Vos - do not package all /usr/share/glusterfs/* files in regression-tests (#1169005) -- cgit