From 3d38179b1b059446bbdc83bdb0256bd6144eb3ed Mon Sep 17 00:00:00 2001 From: Kaleb KEITHLEY Date: Wed, 16 Nov 2011 14:59:22 -0500 Subject: [PATCH] revised init.d and native systemd to minimize fedora < 17 get closer to official glusterfs.spec (but with all the typos), including--- add/enable production of geo-replication sub-package, which should have been done at 3.2 (i.e. 3.2.0 or 3.2.1) --- glusterfs.spec | 203 +++++++++++++++++++++++++++++-------------------- 1 file changed, 120 insertions(+), 83 deletions(-) diff --git a/glusterfs.spec b/glusterfs.spec index f1b2855..203d74b 100644 --- a/glusterfs.spec +++ b/glusterfs.spec @@ -1,20 +1,35 @@ + + +# if you wish to compile an rpm without rdma support, compile like this... +# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without rdma %{?_without_rdma:%global _without_rdma --disable-ibverbs} -%{?_without_epoll:%global _without_epoll --disable-epoll} -%{?_with_fusermount:%gobal _with_fusermount --enable-fusermount} # No RDMA Support on s390(x) %ifarch s390 s390x %global _without_rdma --disable-ibverbs %endif +# if you wish to compile an rpm without epoll... +# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without epoll +%{?_without_epoll:%global _without_epoll --disable-epoll} + +# if you wish to compile an rpm with fusermount... +# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --with fusermount +%{?_with_fusermount:%global _with_fusermount --enable-fusermount} + +# if you wish to compile an rpm without geo-replication support, compile like this... +# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without georeplication +%{?_without_georeplication:%global _without_georeplication --disable-geo-replication} + + +Summary: Cluster File System Name: glusterfs Version: 3.2.4 -Release: 2%{?dist} -Summary: Clustered file-system - -Group: System Environment/Base +Release: 3%{?dist} License: GPLv3 -URL: http://www.gluster.org/ +Group: System Environment/Base +Vendor: Red Hat +URL: http://www.gluster.org//docs/index.php/GlusterFS Source0: http://download.gluster.com/pub/gluster/glusterfs/3.2/%{version}/glusterfs-%{version}.tar.gz Source1: glusterd.sysconfig Source2: glusterfsd.sysconfig @@ -22,42 +37,43 @@ Source3: umount.glusterfs Source4: glusterfs-fuse.logrotate Source5: glusterd.logrotate Source6: glusterfsd.logrotate -%if 0%{?fedora} < 17 -# Legacy server -Source7: glusterd.init -Source8: glusterfsd.init -%else -Source7: glusterd.service -Source8: glusterfsd.service -%endif BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -BuildRequires: bison -BuildRequires: flex -BuildRequires: gcc -BuildRequires: make -BuildRequires: ncurses-devel, readline-devel, python-ctypes - %if 0%{?fedora} < 17 +Source7: glusterd.init +Source8: glusterfsd.init Requires(post): /sbin/chkconfig Requires(preun): /sbin/service Requires(preun): /sbin/chkconfig Requires(postun): /sbin/service -%define _daemon_enable() /sbin/chkconfig --add %1 ; -%define _daemon_disable() /sbin/chkconfig --del %1 ; -%define _daemon_restart() /sbin/service %1 condrestart &>/dev/null ; -%define _daemon_stop() /sbin/service %1 stop &>/dev/null ; +%define _init_enable() /sbin/chkconfig --add %1 ; +%define _init_disable() /sbin/chkconfig --del %1 ; +%define _init_restart() /sbin/service %1 condrestart &>/dev/null ; +%define _init_stop() /sbin/service %1 stop &>/dev/null ; +%define _init_install() %{__install} -D -p -m 0755 %{1} %{buildroot}%{_sysconfdir}/init.d/%{2} ; +%define _init_file1 %{_sysconfdir}/init.d/glusterd +%define _init_file2 %{_sysconfdir}/init.d/glusterfsd %else +Source7: glusterd.service +Source8: glusterfsd.service BuildRequires: systemd-units Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units -%define _daemon_enable() /bin/systemctl enable %1.service ; -%define _daemon_disable() /bin/systemctl disable %1.service ; -%define _daemon_restart() /bin/systemctl try-restart %1.service ; -%define _daemon_stop() /bin/systemctl stop %1.service ; +%define _init_enable() /bin/systemctl enable %1.service ; +%define _init_disable() /bin/systemctl disable %1.service ; +%define _init_restart() /bin/systemctl try-restart %1.service ; +%define _init_stop() /bin/systemctl stop %1.service ; +%define _init_install() %{__install} -D -p -m 0644 %{1} %{buildroot}%{_unitdir}/%{2}.service ; +%define _init_file1 %{_unitdir}/glusterd.service +%define _init_file2 %{_unitdir}/glusterfsd.service %endif +BuildRequires: bison flex +BuildRequires: gcc make automake libtool +BuildRequires: ncurses-devel readline-devel +BuildRequires: python-ctypes + Obsoletes: %{name}-libs <= 2.0.0 Obsoletes: %{name}-common < 3.1.0 Provides: %{name}-libs = %{version}-%{release} @@ -79,11 +95,11 @@ both GlusterFS server and client framework. %if 0%{!?_without_rdma:1} %package rdma -Summary: Support for ib-verbs -Group: Applications/File -BuildRequires: libibverbs-devel +Summary: GlusterFS rdma support for ib-verbs +Group: Applications/File +BuildRequires: libibverbs-devel -Requires: %{name} = %{version}-%{release} +Requires: %{name} = %{version}-%{release} %description rdma GlusterFS is a clustered file-system capable of scaling to several @@ -97,12 +113,30 @@ is in user space and easily manageable. This package provides support to ib-verbs library. %endif -%package fuse -Summary: Fuse client -Group: Applications/File -BuildRequires: fuse-devel +%if 0%{!?_without_georeplication:1} +%package geo-replication +Summary: GlusterFS Geo-replication +Group: Applications/File +Requires: %{name} = %{version}-%{release} , python-ctypes , rsync >= 3.0.0 -Requires: %{name} = %{version}-%{release} +%description geo-replication +GlusterFS is a clustered file-system capable of scaling to several +peta-bytes. It aggregates various storage bricks over Infiniband RDMA +or TCP/IP interconnect into one large parallel network file +system. GlusterFS is one of the most sophisticated file system in +terms of features and extensibility. It borrows a powerful concept +called Translators from GNU Hurd kernel. Much of the code in GlusterFS +is in userspace and easily manageable. + +This package provides support to geo-replication. +%endif + +%package fuse +Summary: Fuse client +Group: Applications/File +BuildRequires: fuse-devel + +Requires: %{name} = %{version}-%{release} Obsoletes: %{name}-client < 3.1.0 Provides: %{name}-client = %{version}-%{release} @@ -168,36 +202,28 @@ is in user space and easily manageable. This package provides the development libraries. %prep -%setup -q +%setup -q -n %{name}-%{version} %build -%configure %{?_without_rdma} %{?_without_epoll} %{?_with_fusermount} +./autogen.sh +%configure %{?_without_rdma} %{?_without_epoll} %{?_with_fusermount} %{?_without_georeplication} # Remove rpath sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool -# Parallel builds not supported -%{__make} +%{__make} %{?_smp_mflags} %install %{__rm} -rf %{buildroot} %{__make} install DESTDIR=%{buildroot} - -# We'll use our init.d -%{__rm} -f %{buildroot}%{_sysconfdir}/init.d/glusterd - -%{__mkdir_p} %{buildroot}%{_localstatedir}/log/glusterd -%{__mkdir_p} %{buildroot}%{_localstatedir}/log/glusterfs -%{__mkdir_p} %{buildroot}%{_localstatedir}/log/glusterfsd - # Install include directory %{__mkdir_p} %{buildroot}%{_includedir}/glusterfs %{__install} -p -m 0644 libglusterfs/src/*.h \ %{buildroot}%{_includedir}/glusterfs/ %{__install} -p -m 0644 contrib/uuid/*.h \ %{buildroot}%{_includedir}/glusterfs/ -# Following needed by cloudfs multi-tenant translator +# Following needed by hekafs multi-tenant translator %{__mkdir_p} %{buildroot}%{_includedir}/glusterfs/rpc %{__install} -p -m 0644 rpc/rpc-lib/src/*.h \ %{buildroot}%{_includedir}/glusterfs/rpc/ @@ -206,6 +232,13 @@ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool %{__mkdir_p} %{buildroot}%{_includedir}/glusterfs/server %{__install} -p -m 0644 xlators/protocol/server/src/*.h \ %{buildroot}%{_includedir}/glusterfs/server/ +# We'll use our init.d +%{__rm} -f %{buildroot}%{_sysconfdir}/init.d/glusterd + +%{__mkdir_p} %{buildroot}%{_localstatedir}/log/glusterd +%{__mkdir_p} %{buildroot}%{_localstatedir}/log/glusterfs +%{__mkdir_p} %{buildroot}%{_localstatedir}/log/glusterfsd + # Remove unwanted files from all the shared libraries find %{buildroot}%{_libdir} -name '*.a' -delete @@ -231,18 +264,8 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha %{__rm} -f examples/Makefile* # Install init script and sysconfig file -%if 0%{?fedora} < 17 -# Legacy init script and sysconfig file -%{__install} -D -p -m 0755 %{SOURCE7} \ - %{buildroot}%{_sysconfdir}/init.d/glusterd -%{__install} -D -p -m 0755 %{SOURCE8} \ - %{buildroot}%{_sysconfdir}/init.d/glusterfsd -%else -%{__install} -D -p -m 0644 %{SOURCE7} \ - %{buildroot}%{_unitdir}/glusterd.service -%{__install} -D -p -m 0644 %{SOURCE8} \ - %{buildroot}%{_unitdir}/glusterfsd.service -%endif +%_init_install %{SOURCE7} glusterd +%_init_install %{SOURCE8} glusterfsd %{__install} -D -p -m 0644 %{SOURCE1} \ %{buildroot}%{_sysconfdir}/sysconfig/glusterd %{__install} -D -p -m 0644 %{SOURCE2} \ @@ -269,6 +292,12 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha %clean %{__rm} -rf %{buildroot} +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + %files %defattr(-,root,root,-) %doc ChangeLog COPYING INSTALL README THANKS @@ -293,6 +322,19 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha %{_libdir}/glusterfs/%{version}/rpc-transport/rdma* %endif +%if 0%{!?_without_georeplication:1} +%post geo-replication +#restart glusterd. +%{_sysconfdir}/init.d/glusterd restart &> /dev/null +%endif + +%if 0%{!?_without_georeplication:1} +%files geo-replication +%defattr(-,root,root) +%{_libexecdir}/glusterfs/gsyncd +%{_libexecdir}/glusterfs/python/syncdaemon/* +%endif + %files fuse %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/logrotate.d/glusterfs-fuse @@ -315,14 +357,8 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha %config(noreplace) %{_sysconfdir}/logrotate.d/glusterfsd %config(noreplace) %{_sysconfdir}/sysconfig/glusterfsd %{_sharedstatedir}/glusterd -%if 0%{?fedora} < 17 -# Legacy init -%{_sysconfdir}/init.d/glusterd -%{_sysconfdir}/init.d/glusterfsd -%else -%{_unitdir}/glusterd.service -%{_unitdir}/glusterfsd.service -%endif +%_init_file1 +%_init_file2 %files vim %defattr(-,root,root,-) @@ -335,28 +371,29 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha %exclude %{_includedir}/glusterfs/y.tab.h %{_libdir}/*.so -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - %post server # Legacy server -%_daemon_enable glusterd -%_daemon_enable glusterfsd +%_init_enable glusterd +%_init_enable glusterfsd %preun server if [ $1 -eq 0 ]; then - %_daemon_stop glusterfsd - %_daemon_stop glusterd - %_daemon_disable glusterfsd - %_daemon_disable glusterd + %_init_stop glusterfsd + %_init_stop glusterd + %_init_disable glusterfsd + %_init_disable glusterd fi if [ $1 -ge 1 ]; then - %_daemon_restart glusterd - %_daemon_restart glusterfsd + %_init_restart glusterd + %_init_restart glusterfsd fi %changelog +* Wed Nov 16 2011 Kaleb S. KEITHLEY - 3.2.4-3 +- revised init.d/systemd to minimize fedora < 17 +- get closer to the official glusterfs spec, including... +- add geo-replication, which should have been there since 3.2 + * Wed Nov 2 2011 Kaleb S. KEITHLEY - 3.2.4-2 - Convert init.d to systemd for f17 and later