a25cdb433d
- prerequire groupadd and useradd. OBS-URL: https://build.opensuse.org/request/show/483281 OBS-URL: https://build.opensuse.org/package/show/Virtualization/sanlock?expand=0&rev=33
400 lines
11 KiB
RPMSpec
400 lines
11 KiB
RPMSpec
#
|
|
# spec file for package sanlock
|
|
#
|
|
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
%define with_systemd 0
|
|
%define with_fence_sanlockd 0
|
|
%define with_sanlk_reset 0
|
|
|
|
%if 0%{?suse_version} > 1140
|
|
%define with_systemd 1
|
|
%endif
|
|
|
|
%if 0%{?suse_version} > 1320
|
|
%define with_fence_sanlockd 1
|
|
%define with_sanlk_reset 1
|
|
%endif
|
|
|
|
Name: sanlock
|
|
Version: 3.4.0
|
|
Release: 0
|
|
Summary: A shared disk lock manager
|
|
License: GPL-2.0 and GPL-2.0+ and LGPL-2.1+
|
|
Group: System/Base
|
|
|
|
Url: https://pagure.io/sanlock
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
BuildRequires: libaio-devel
|
|
BuildRequires: libblkid-devel
|
|
BuildRequires: python
|
|
BuildRequires: python-devel
|
|
%if %{with_systemd}
|
|
BuildRequires: systemd
|
|
%{?systemd_requires}
|
|
%else
|
|
Requires(pre): %insserv_prereq
|
|
%endif
|
|
BuildRequires: xz
|
|
Requires(pre): %fillup_prereq
|
|
%if 0%{?suse_version} > 1320
|
|
Requires(pre): group(disk)
|
|
%endif
|
|
Requires(pre): %{_sbindir}/groupadd
|
|
Requires(pre): %{_sbindir}/useradd
|
|
Requires: %{name}-lib = %{version}-%{release}
|
|
Recommends: logrotate
|
|
Source0: %{name}-%{version}.tar.xz
|
|
Source1: sanlock.init
|
|
Source2: sysconfig.sanlock
|
|
Source3: wdmd.init
|
|
Source4: sysconfig.wdmd
|
|
Source5: fence_sanlockd.init
|
|
# Upstream patches
|
|
# SUSE patches
|
|
Patch100: sanlock-SCHED_RESET_ON_FORK-undefined.patch
|
|
Patch101: sanlock-python-prefix.patch
|
|
Patch102: sanlock-old_blkid.patch
|
|
Patch103: suse-systemd.patch
|
|
Patch104: suse-no-date-time.patch
|
|
# bsc#1030060
|
|
Patch105: suse-fix-link-errors.patch
|
|
|
|
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
|
|
|
%description
|
|
sanlock uses disk paxos to manage leases on shared storage.
|
|
Hosts connected to a common SAN can use this to synchronize their
|
|
access to the shared disks.
|
|
|
|
%package -n libsanlock1
|
|
Provides: sanlock-lib
|
|
Summary: A shared disk lock manager library
|
|
Group: Development/Libraries/C and C++
|
|
|
|
%description -n libsanlock1
|
|
The %{name}-lib package contains the runtime libraries for sanlock,
|
|
a shared disk lock manager.
|
|
Hosts connected to a common SAN can use this to synchronize their
|
|
access to the shared disks.
|
|
|
|
%package -n python-%name
|
|
Provides: sanlock-python
|
|
Summary: Python bindings for the sanlock library
|
|
Group: Development/Libraries/Python
|
|
Requires: libsanlock1 = %{version}-%{release}
|
|
|
|
%description -n python-%name
|
|
The %{name}-python package contains a module that permits applications
|
|
written in the Python programming language to use the interface
|
|
supplied by the sanlock library.
|
|
|
|
%package devel
|
|
Summary: Development files for %{name}
|
|
Group: Development/Libraries/C and C++
|
|
Requires: libsanlock1 = %{version}-%{release}
|
|
|
|
%description devel
|
|
The %{name}-devel package contains libraries and header files for
|
|
developing applications that use %{name}.
|
|
|
|
%if %{with_fence_sanlockd}
|
|
%package -n fence-sanlock
|
|
Summary: Fence agent using sanlock and wdmd
|
|
Group: System Environment/Base
|
|
Requires: sanlock = %{version}-%{release}
|
|
|
|
%description -n fence-sanlock
|
|
The fence-sanlock package contains the fence agent and
|
|
daemon for using sanlock and wdmd as a cluster fence agent.
|
|
%endif
|
|
|
|
%if %{with_sanlk_reset}
|
|
%package -n sanlk-reset
|
|
Summary: Host reset daemon and client using sanlock
|
|
Group: System Environment/Base
|
|
Requires: libsanlock1 = %{version}-%{release}
|
|
Requires: sanlock = %{version}-%{release}
|
|
|
|
%description -n sanlk-reset
|
|
The sanlk-reset package contains the reset daemon and client.
|
|
A cooperating host running the daemon can be reset by a host
|
|
running the client, so long as both maintain access to a
|
|
common sanlock lockspace.
|
|
%endif
|
|
|
|
%prep
|
|
%setup -q
|
|
%patch100
|
|
%patch101
|
|
%patch102
|
|
%if %{with_systemd}
|
|
%patch103 -p1
|
|
%endif
|
|
%patch104 -p1
|
|
%patch105 -p1
|
|
|
|
%build
|
|
# upstream does not require configure
|
|
# upstream does not support _smp_mflags
|
|
CFLAGS=$RPM_OPT_FLAGS make -C wdmd
|
|
CFLAGS=$RPM_OPT_FLAGS make -C src
|
|
CFLAGS=$RPM_OPT_FLAGS make -C python
|
|
%if %{with_fence_sanlockd}
|
|
CFLAGS=$RPM_OPT_FLAGS make -C fence_sanlock
|
|
%endif
|
|
%if %{with_sanlk_reset}
|
|
CFLAGS=$RPM_OPT_FLAGS make -C reset
|
|
%endif
|
|
|
|
%install
|
|
make -C src \
|
|
install LIBDIR=%{_libdir} \
|
|
DESTDIR=$RPM_BUILD_ROOT
|
|
make -C wdmd \
|
|
install LIBDIR=%{_libdir} \
|
|
DESTDIR=$RPM_BUILD_ROOT
|
|
make -C python \
|
|
install LIBDIR=%{_libdir} \
|
|
DESTDIR=$RPM_BUILD_ROOT PREFIX=%_prefix
|
|
%if %{with_fence_sanlockd}
|
|
make -C fence_sanlock \
|
|
install LIBDIR=%{_libdir} \
|
|
DESTDIR=$RPM_BUILD_ROOT
|
|
%endif
|
|
%if %{with_sanlk_reset}
|
|
make -C reset \
|
|
install LIBDIR=%{_libdir} \
|
|
DESTDIR=$RPM_BUILD_ROOT
|
|
%endif
|
|
|
|
install -D -m 755 src/sanlock.conf $RPM_BUILD_ROOT/%{_sysconfdir}/sanlock/sanlock.conf
|
|
install -D -m 755 %SOURCE2 $RPM_BUILD_ROOT/%{_localstatedir}/adm/fillup-templates/sysconfig.sanlock
|
|
install -D -m 755 %SOURCE4 $RPM_BUILD_ROOT/%{_localstatedir}/adm/fillup-templates/sysconfig.wdmd
|
|
|
|
%if %{with_systemd}
|
|
install -D -m 755 init.d/sanlock.service $RPM_BUILD_ROOT/%{_unitdir}/sanlock.service
|
|
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcsanlock
|
|
install -D -m 755 init.d/wdmd.service $RPM_BUILD_ROOT/%{_unitdir}/wdmd.service
|
|
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcwdmd
|
|
%if %{with_fence_sanlockd}
|
|
install -D -m 0755 %SOURCE5 $RPM_BUILD_ROOT/usr/lib/systemd/systemd-fence_sanlockd
|
|
install -D -m 0644 init.d/fence_sanlockd.service $RPM_BUILD_ROOT/%{_unitdir}/fence_sanlockd.service
|
|
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcfence_sanlockd
|
|
%endif
|
|
%if %{with_sanlk_reset}
|
|
install -D -m 0644 init.d/sanlk-resetd.service $RPM_BUILD_ROOT/%{_unitdir}/sanlk-resetd.service
|
|
%endif
|
|
%else
|
|
install -D -m 755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/sanlock
|
|
ln -s /etc/init.d/sanlock $RPM_BUILD_ROOT%{_sbindir}/rcsanlock
|
|
install -D -m 755 %SOURCE3 $RPM_BUILD_ROOT/etc/init.d/wdmd
|
|
ln -s /etc/init.d/wdmd $RPM_BUILD_ROOT%{_sbindir}/rcwdmd
|
|
%if %{with_fence_sanlockd}
|
|
install -D -m 755 %SOURCE5 $RPM_BUILD_ROOT/%{_initddir}/fence_sanlockd
|
|
ln -s /etc/init.d/fence_sanlockd $RPM_BUILD_ROOT%{_sbindir}/rcfence_sanlockd
|
|
%endif
|
|
%endif
|
|
|
|
install -Dm 0644 src/logrotate.sanlock \
|
|
$RPM_BUILD_ROOT/etc/logrotate.d/sanlock
|
|
|
|
install -Dd -m 0755 $RPM_BUILD_ROOT/etc/wdmd.d
|
|
|
|
%pre
|
|
%{_bindir}/getent group sanlock > /dev/null || %{_sbindir}/groupadd \
|
|
-g 179 sanlock
|
|
%{_bindir}/getent passwd sanlock > /dev/null || %{_sbindir}/useradd \
|
|
-u 179 -c "sanlock" -s /sbin/nologin -r \
|
|
-g 179 -G disk -d /var/run/sanlock sanlock
|
|
|
|
%if %{with_systemd}
|
|
%service_add_pre wdmd.service
|
|
%service_add_pre sanlock.service
|
|
%endif
|
|
|
|
%if %{with_fence_sanlockd}
|
|
%pre -n fence-sanlock
|
|
%if %{with_systemd}
|
|
%service_add_pre fence_sanlockd.service
|
|
%endif
|
|
%endif
|
|
|
|
%if %{with_sanlk_reset}
|
|
%pre -n sanlk-reset
|
|
%if %{with_systemd}
|
|
%service_add_pre sanlk-resetd.service
|
|
%endif
|
|
%endif
|
|
|
|
%post
|
|
%if %{with_systemd}
|
|
%service_add_post wdmd.service sanlock.service
|
|
%else
|
|
%restart_on_update wdmd
|
|
%restart_on_update sanlock
|
|
%endif
|
|
|
|
%fillup_only -n wdmd
|
|
%fillup_only -n sanlock
|
|
|
|
%post -n libsanlock1 -p /sbin/ldconfig
|
|
|
|
%if %{with_fence_sanlockd}
|
|
%post -n fence-sanlock
|
|
%if %{with_systemd}
|
|
%service_add_post fence_sanlockd.service
|
|
%endif
|
|
%restart_on_update fence_sanlockd
|
|
#if [ $1 -eq 1 ] ; then
|
|
#ccs_update_schema > /dev/null 2>&1 ||:
|
|
#fi
|
|
%endif
|
|
|
|
%if %{with_sanlk_reset}
|
|
%post -n sanlk-reset
|
|
%if %{with_systemd}
|
|
%service_add_post sanlk-resetd.service
|
|
%endif
|
|
%restart_on_update sanlk-resetd
|
|
%endif
|
|
|
|
%preun
|
|
%if %{with_systemd}
|
|
%service_del_preun wdmd.service sanlock.service
|
|
%else
|
|
%stop_on_removal wdmd
|
|
%stop_on_removal sanlock
|
|
%endif
|
|
|
|
%if %{with_fence_sanlockd}
|
|
%preun -n fence-sanlock
|
|
%if %{with_systemd}
|
|
%service_del_preun fence_sanlockd.service
|
|
%else
|
|
%stop_on_removal fence_sanlockd
|
|
%endif
|
|
%endif
|
|
|
|
%if %{with_sanlk_reset}
|
|
%preun -n sanlk-reset
|
|
%if %{with_systemd}
|
|
%service_del_preun sanlk-resetd.service
|
|
%else
|
|
%stop_on_removal sanlk-resetd
|
|
%endif
|
|
%endif
|
|
|
|
%postun
|
|
%if %{with_systemd}
|
|
%service_del_postun wdmd.service sanlock.service
|
|
%else
|
|
%insserv_cleanup
|
|
%endif
|
|
|
|
%postun -n libsanlock1 -p /sbin/ldconfig
|
|
|
|
%if %{with_fence_sanlockd}
|
|
%postun -n fence-sanlock
|
|
%if %{with_systemd}
|
|
%service_del_postun fence_sanlockd.service
|
|
%endif
|
|
%endif
|
|
|
|
%if %{with_sanlk_reset}
|
|
%postun -n sanlk-reset
|
|
%if %{with_systemd}
|
|
%service_del_postun sanlk-resetd.service
|
|
%endif
|
|
%endif
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
%dir %attr(0700, root, root) %{_sysconfdir}/wdmd.d/
|
|
%dir %attr(0700, root, root) %{_sysconfdir}/sanlock/
|
|
%config(noreplace) %{_sysconfdir}/sanlock/sanlock.conf
|
|
%{_sbindir}/rcsanlock
|
|
%{_localstatedir}/adm/fillup-templates/sysconfig.sanlock
|
|
%{_sbindir}/rcwdmd
|
|
%{_localstatedir}/adm/fillup-templates/sysconfig.wdmd
|
|
%if %{with_systemd}
|
|
%{_unitdir}/sanlock.service
|
|
%{_unitdir}/wdmd.service
|
|
%else
|
|
/etc/init.d/sanlock
|
|
/etc/init.d/wdmd
|
|
%endif
|
|
%{_sbindir}/sanlock
|
|
%{_sbindir}/wdmd
|
|
%{_mandir}/man8/wdmd*
|
|
%{_mandir}/man8/sanlock*
|
|
%config(noreplace) %{_sysconfdir}/logrotate.d/sanlock
|
|
|
|
%files -n libsanlock1
|
|
%defattr(-,root,root,-)
|
|
%{_libdir}/libsanlock.so.*
|
|
%{_libdir}/libsanlock_client.so.*
|
|
%{_libdir}/libwdmd.so.*
|
|
|
|
%files -n python-%name
|
|
%defattr(-,root,root,-)
|
|
%{python_sitearch}/sanlock_python-%{version}_-py*.egg-info
|
|
%{python_sitearch}/sanlock.so
|
|
|
|
%files devel
|
|
%defattr(-,root,root,-)
|
|
%{_libdir}/libwdmd.so
|
|
%{_includedir}/wdmd.h
|
|
%{_libdir}/libsanlock.so
|
|
%{_libdir}/libsanlock_client.so
|
|
%{_includedir}/sanlock.h
|
|
%{_includedir}/sanlock_rv.h
|
|
%{_includedir}/sanlock_admin.h
|
|
%{_includedir}/sanlock_resource.h
|
|
%{_includedir}/sanlock_direct.h
|
|
%{_libdir}/pkgconfig/libsanlock.pc
|
|
%{_libdir}/pkgconfig/libsanlock_client.pc
|
|
|
|
%if %{with_fence_sanlockd}
|
|
%files -n fence-sanlock
|
|
%defattr(-,root,root,-)
|
|
%{_sbindir}/fence_sanlockd
|
|
%if %{with_systemd}
|
|
/usr/lib/systemd/systemd-fence_sanlockd
|
|
%{_unitdir}/fence_sanlockd.service
|
|
%else
|
|
/etc/init.d/fence_sanlockd
|
|
%endif
|
|
%{_sbindir}/fence_sanlock
|
|
%{_sbindir}/fence_sanlockd
|
|
%{_sbindir}/rcfence_sanlockd
|
|
%{_mandir}/man8/fence_sanlock*
|
|
%endif
|
|
|
|
%if %{with_sanlk_reset}
|
|
%files -n sanlk-reset
|
|
%defattr(-,root,root,-)
|
|
%{_sbindir}/sanlk-reset
|
|
%{_sbindir}/sanlk-resetd
|
|
%if %{with_systemd}
|
|
%{_unitdir}/sanlk-resetd.service
|
|
%endif
|
|
%{_mandir}/man8/sanlk-reset.8.gz
|
|
%{_mandir}/man8/sanlk-resetd.8.gz
|
|
%endif
|
|
|
|
%changelog
|