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)
This commit is contained in:
Kaleb KEITHLEY 2011-11-16 14:59:22 -05:00
parent aa2bbd029a
commit 3d38179b1b

View File

@ -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_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) # No RDMA Support on s390(x)
%ifarch s390 s390x %ifarch s390 s390x
%global _without_rdma --disable-ibverbs %global _without_rdma --disable-ibverbs
%endif %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 Name: glusterfs
Version: 3.2.4 Version: 3.2.4
Release: 2%{?dist} Release: 3%{?dist}
Summary: Clustered file-system
Group: System Environment/Base
License: GPLv3 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 Source0: http://download.gluster.com/pub/gluster/glusterfs/3.2/%{version}/glusterfs-%{version}.tar.gz
Source1: glusterd.sysconfig Source1: glusterd.sysconfig
Source2: glusterfsd.sysconfig Source2: glusterfsd.sysconfig
@ -22,42 +37,43 @@ Source3: umount.glusterfs
Source4: glusterfs-fuse.logrotate Source4: glusterfs-fuse.logrotate
Source5: glusterd.logrotate Source5: glusterd.logrotate
Source6: glusterfsd.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) 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 %if 0%{?fedora} < 17
Source7: glusterd.init
Source8: glusterfsd.init
Requires(post): /sbin/chkconfig Requires(post): /sbin/chkconfig
Requires(preun): /sbin/service Requires(preun): /sbin/service
Requires(preun): /sbin/chkconfig Requires(preun): /sbin/chkconfig
Requires(postun): /sbin/service Requires(postun): /sbin/service
%define _daemon_enable() /sbin/chkconfig --add %1 ; %define _init_enable() /sbin/chkconfig --add %1 ;
%define _daemon_disable() /sbin/chkconfig --del %1 ; %define _init_disable() /sbin/chkconfig --del %1 ;
%define _daemon_restart() /sbin/service %1 condrestart &>/dev/null ; %define _init_restart() /sbin/service %1 condrestart &>/dev/null ;
%define _daemon_stop() /sbin/service %1 stop &>/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 %else
Source7: glusterd.service
Source8: glusterfsd.service
BuildRequires: systemd-units BuildRequires: systemd-units
Requires(post): systemd-units Requires(post): systemd-units
Requires(preun): systemd-units Requires(preun): systemd-units
Requires(postun): systemd-units Requires(postun): systemd-units
%define _daemon_enable() /bin/systemctl enable %1.service ; %define _init_enable() /bin/systemctl enable %1.service ;
%define _daemon_disable() /bin/systemctl disable %1.service ; %define _init_disable() /bin/systemctl disable %1.service ;
%define _daemon_restart() /bin/systemctl try-restart %1.service ; %define _init_restart() /bin/systemctl try-restart %1.service ;
%define _daemon_stop() /bin/systemctl stop %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 %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}-libs <= 2.0.0
Obsoletes: %{name}-common < 3.1.0 Obsoletes: %{name}-common < 3.1.0
Provides: %{name}-libs = %{version}-%{release} Provides: %{name}-libs = %{version}-%{release}
@ -79,11 +95,11 @@ both GlusterFS server and client framework.
%if 0%{!?_without_rdma:1} %if 0%{!?_without_rdma:1}
%package rdma %package rdma
Summary: Support for ib-verbs Summary: GlusterFS rdma support for ib-verbs
Group: Applications/File Group: Applications/File
BuildRequires: libibverbs-devel BuildRequires: libibverbs-devel
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
%description rdma %description rdma
GlusterFS is a clustered file-system capable of scaling to several 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. This package provides support to ib-verbs library.
%endif %endif
%package fuse %if 0%{!?_without_georeplication:1}
Summary: Fuse client %package geo-replication
Group: Applications/File Summary: GlusterFS Geo-replication
BuildRequires: fuse-devel 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 Obsoletes: %{name}-client < 3.1.0
Provides: %{name}-client = %{version}-%{release} Provides: %{name}-client = %{version}-%{release}
@ -168,36 +202,28 @@ is in user space and easily manageable.
This package provides the development libraries. This package provides the development libraries.
%prep %prep
%setup -q %setup -q -n %{name}-%{version}
%build %build
%configure %{?_without_rdma} %{?_without_epoll} %{?_with_fusermount} ./autogen.sh
%configure %{?_without_rdma} %{?_without_epoll} %{?_with_fusermount} %{?_without_georeplication}
# Remove rpath # Remove rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool 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 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
# Parallel builds not supported %{__make} %{?_smp_mflags}
%{__make}
%install %install
%{__rm} -rf %{buildroot} %{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{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 # Install include directory
%{__mkdir_p} %{buildroot}%{_includedir}/glusterfs %{__mkdir_p} %{buildroot}%{_includedir}/glusterfs
%{__install} -p -m 0644 libglusterfs/src/*.h \ %{__install} -p -m 0644 libglusterfs/src/*.h \
%{buildroot}%{_includedir}/glusterfs/ %{buildroot}%{_includedir}/glusterfs/
%{__install} -p -m 0644 contrib/uuid/*.h \ %{__install} -p -m 0644 contrib/uuid/*.h \
%{buildroot}%{_includedir}/glusterfs/ %{buildroot}%{_includedir}/glusterfs/
# Following needed by cloudfs multi-tenant translator # Following needed by hekafs multi-tenant translator
%{__mkdir_p} %{buildroot}%{_includedir}/glusterfs/rpc %{__mkdir_p} %{buildroot}%{_includedir}/glusterfs/rpc
%{__install} -p -m 0644 rpc/rpc-lib/src/*.h \ %{__install} -p -m 0644 rpc/rpc-lib/src/*.h \
%{buildroot}%{_includedir}/glusterfs/rpc/ %{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 %{__mkdir_p} %{buildroot}%{_includedir}/glusterfs/server
%{__install} -p -m 0644 xlators/protocol/server/src/*.h \ %{__install} -p -m 0644 xlators/protocol/server/src/*.h \
%{buildroot}%{_includedir}/glusterfs/server/ %{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 # Remove unwanted files from all the shared libraries
find %{buildroot}%{_libdir} -name '*.a' -delete 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* %{__rm} -f examples/Makefile*
# Install init script and sysconfig file # Install init script and sysconfig file
%if 0%{?fedora} < 17 %_init_install %{SOURCE7} glusterd
# Legacy init script and sysconfig file %_init_install %{SOURCE8} glusterfsd
%{__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
%{__install} -D -p -m 0644 %{SOURCE1} \ %{__install} -D -p -m 0644 %{SOURCE1} \
%{buildroot}%{_sysconfdir}/sysconfig/glusterd %{buildroot}%{_sysconfdir}/sysconfig/glusterd
%{__install} -D -p -m 0644 %{SOURCE2} \ %{__install} -D -p -m 0644 %{SOURCE2} \
@ -269,6 +292,12 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha
%clean %clean
%{__rm} -rf %{buildroot} %{__rm} -rf %{buildroot}
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc ChangeLog COPYING INSTALL README THANKS %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* %{_libdir}/glusterfs/%{version}/rpc-transport/rdma*
%endif %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 %files fuse
%defattr(-,root,root,-) %defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/logrotate.d/glusterfs-fuse %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}/logrotate.d/glusterfsd
%config(noreplace) %{_sysconfdir}/sysconfig/glusterfsd %config(noreplace) %{_sysconfdir}/sysconfig/glusterfsd
%{_sharedstatedir}/glusterd %{_sharedstatedir}/glusterd
%if 0%{?fedora} < 17 %_init_file1
# Legacy init %_init_file2
%{_sysconfdir}/init.d/glusterd
%{_sysconfdir}/init.d/glusterfsd
%else
%{_unitdir}/glusterd.service
%{_unitdir}/glusterfsd.service
%endif
%files vim %files vim
%defattr(-,root,root,-) %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 %exclude %{_includedir}/glusterfs/y.tab.h
%{_libdir}/*.so %{_libdir}/*.so
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post server %post server
# Legacy server # Legacy server
%_daemon_enable glusterd %_init_enable glusterd
%_daemon_enable glusterfsd %_init_enable glusterfsd
%preun server %preun server
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
%_daemon_stop glusterfsd %_init_stop glusterfsd
%_daemon_stop glusterd %_init_stop glusterd
%_daemon_disable glusterfsd %_init_disable glusterfsd
%_daemon_disable glusterd %_init_disable glusterd
fi fi
if [ $1 -ge 1 ]; then if [ $1 -ge 1 ]; then
%_daemon_restart glusterd %_init_restart glusterd
%_daemon_restart glusterfsd %_init_restart glusterfsd
fi fi
%changelog %changelog
* Wed Nov 16 2011 Kaleb S. KEITHLEY <kkeithle@redhat.com> - 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 <kkeithle@redhat.com> - 3.2.4-2 * Wed Nov 2 2011 Kaleb S. KEITHLEY <kkeithle@redhat.com> - 3.2.4-2
- Convert init.d to systemd for f17 and later - Convert init.d to systemd for f17 and later