sanlock: openEuler init
This commit is contained in:
commit
0a6be55001
40
0000-Fix-libsanlock-build-on-Unubtu-Debian.patch
Normal file
40
0000-Fix-libsanlock-build-on-Unubtu-Debian.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
From 39b4d87397e5a09adcd100e0f379f34d5dde7e9b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nir Soffer <nsoffer@redhat.com>
|
||||||
|
Date: Mon, 15 Jan 2018 01:21:51 +0200
|
||||||
|
Subject: [PATCH 1/2] Fix libsanlock build on Unubtu/Debian
|
||||||
|
|
||||||
|
LIB_ENTIRE_LDFLAGS included libraries (e.g. -laio -lblkid) instead of
|
||||||
|
linker flags. The libraries should be in LIB_ENTIRE_LDDADD and come
|
||||||
|
*after* the sources. Otherwisae, the libraries are not linked, and
|
||||||
|
loading libsanlock.so fail with undefined symbol error.
|
||||||
|
|
||||||
|
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
|
||||||
|
---
|
||||||
|
src/Makefile | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/Makefile b/src/Makefile
|
||||||
|
index 69fcd1321ee7..73a2b3498475 100644
|
||||||
|
--- a/src/Makefile
|
||||||
|
+++ b/src/Makefile
|
||||||
|
@@ -98,15 +98,15 @@ CMD_CFLAGS = $(CFLAGS) -fPIE -DPIE
|
||||||
|
CMD_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
|
||||||
|
CMD_LDADD += -lpthread -luuid -lrt -laio -lblkid -lsanlock -L../wdmd -lwdmd
|
||||||
|
|
||||||
|
-LIB_ENTIRE_LDFLAGS += -lpthread -lrt -laio -lblkid -L../wdmd -lwdmd
|
||||||
|
LIB_ENTIRE_LDFLAGS += -Wl,-z,relro -pie
|
||||||
|
+LIB_ENTIRE_LDADD += -lpthread -lrt -laio -lblkid -L../wdmd -lwdmd
|
||||||
|
|
||||||
|
LIB_CLIENT_LDFLAGS += -Wl,-z,relro -pie
|
||||||
|
|
||||||
|
all: $(LIBSO_ENTIRE_TARGET) $(LIBSO_CLIENT_TARGET) $(CMD_TARGET) $(LIBPC_ENTIRE_TARGET) $(LIBPC_CLIENT_TARGET)
|
||||||
|
|
||||||
|
$(LIBSO_ENTIRE_TARGET): $(LIB_ENTIRE_SOURCE)
|
||||||
|
- $(CC) $(CFLAGS) $(LIB_ENTIRE_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $^
|
||||||
|
+ $(CC) $(CFLAGS) $(LIB_ENTIRE_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $^ $(LIB_ENTIRE_LDADD)
|
||||||
|
ln -sf $(LIBSO_ENTIRE_TARGET) $(LIB_ENTIRE_TARGET).so
|
||||||
|
ln -sf $(LIBSO_ENTIRE_TARGET) $(LIB_ENTIRE_TARGET).so.$(SOMAJOR)
|
||||||
|
|
||||||
|
--
|
||||||
|
2.7.5
|
||||||
|
|
||||||
85
0001-fix-makefile-flags.patch
Normal file
85
0001-fix-makefile-flags.patch
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
From fa6d48a7c8991b2251e50469a7e57058be226ab0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Teigland <teigland@redhat.com>
|
||||||
|
Date: Wed, 14 Mar 2018 11:49:35 -0500
|
||||||
|
Subject: [PATCH 2/2] fix makefile flags
|
||||||
|
|
||||||
|
should let the fedora build flags work
|
||||||
|
---
|
||||||
|
reset/Makefile | 2 +-
|
||||||
|
src/Makefile | 15 +++++++--------
|
||||||
|
wdmd/Makefile | 8 ++++----
|
||||||
|
3 files changed, 12 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/reset/Makefile b/reset/Makefile
|
||||||
|
index c61348a2b9c3..04a23032614a 100644
|
||||||
|
--- a/reset/Makefile
|
||||||
|
+++ b/reset/Makefile
|
||||||
|
@@ -34,7 +34,7 @@ VER=$(shell cat ../VERSION)
|
||||||
|
CFLAGS += -DVERSION=\"$(VER)\" -I../src -I../wdmd
|
||||||
|
CFLAGS += -fPIE -DPIE
|
||||||
|
|
||||||
|
-LDFLAGS = -Wl,-z,now -Wl,-z,relro -pie
|
||||||
|
+LDFLAGS += -Wl,-z,now -Wl,-z,relro
|
||||||
|
LDADD = -lsanlock -lwdmd
|
||||||
|
|
||||||
|
all: $(TARGET1) $(TARGET2)
|
||||||
|
diff --git a/src/Makefile b/src/Makefile
|
||||||
|
index 73a2b3498475..14c0a53e6aeb 100644
|
||||||
|
--- a/src/Makefile
|
||||||
|
+++ b/src/Makefile
|
||||||
|
@@ -94,24 +94,23 @@ VER=$(shell cat ../VERSION)
|
||||||
|
CFLAGS += -DVERSION=\"$(VER)\"
|
||||||
|
|
||||||
|
CMD_CFLAGS = $(CFLAGS) -fPIE -DPIE
|
||||||
|
+CMD_LDFLAGS = $(LDFLAGS) -Wl,-z,now -Wl,-z,relro
|
||||||
|
+CMD_LDADD = -lpthread -luuid -lrt -laio -lblkid -lsanlock -L../wdmd -lwdmd
|
||||||
|
|
||||||
|
-CMD_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
|
||||||
|
-CMD_LDADD += -lpthread -luuid -lrt -laio -lblkid -lsanlock -L../wdmd -lwdmd
|
||||||
|
+LIB_ENTIRE_LDFLAGS = $(LDFLAGS) -Wl,-z,relro
|
||||||
|
+LIB_ENTIRE_LDADD = -lpthread -lrt -laio -lblkid -L../wdmd -lwdmd
|
||||||
|
|
||||||
|
-LIB_ENTIRE_LDFLAGS += -Wl,-z,relro -pie
|
||||||
|
-LIB_ENTIRE_LDADD += -lpthread -lrt -laio -lblkid -L../wdmd -lwdmd
|
||||||
|
-
|
||||||
|
-LIB_CLIENT_LDFLAGS += -Wl,-z,relro -pie
|
||||||
|
+LIB_CLIENT_LDFLAGS = $(LDFLAGS) -Wl,-z,relro
|
||||||
|
|
||||||
|
all: $(LIBSO_ENTIRE_TARGET) $(LIBSO_CLIENT_TARGET) $(CMD_TARGET) $(LIBPC_ENTIRE_TARGET) $(LIBPC_CLIENT_TARGET)
|
||||||
|
|
||||||
|
$(LIBSO_ENTIRE_TARGET): $(LIB_ENTIRE_SOURCE)
|
||||||
|
- $(CC) $(CFLAGS) $(LIB_ENTIRE_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $^ $(LIB_ENTIRE_LDADD)
|
||||||
|
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIB_ENTIRE_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $^ $(LIB_ENTIRE_LDADD)
|
||||||
|
ln -sf $(LIBSO_ENTIRE_TARGET) $(LIB_ENTIRE_TARGET).so
|
||||||
|
ln -sf $(LIBSO_ENTIRE_TARGET) $(LIB_ENTIRE_TARGET).so.$(SOMAJOR)
|
||||||
|
|
||||||
|
$(LIBSO_CLIENT_TARGET): $(LIB_CLIENT_SOURCE)
|
||||||
|
- $(CC) $(CFLAGS) $(LIB_CLIENT_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_CLIENT_TARGET).so.$(SOMAJOR) $^
|
||||||
|
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIB_CLIENT_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_CLIENT_TARGET).so.$(SOMAJOR) $^
|
||||||
|
ln -sf $(LIBSO_CLIENT_TARGET) $(LIB_CLIENT_TARGET).so
|
||||||
|
ln -sf $(LIBSO_CLIENT_TARGET) $(LIB_CLIENT_TARGET).so.$(SOMAJOR)
|
||||||
|
|
||||||
|
diff --git a/wdmd/Makefile b/wdmd/Makefile
|
||||||
|
index bf871c591943..0c4438950d6e 100644
|
||||||
|
--- a/wdmd/Makefile
|
||||||
|
+++ b/wdmd/Makefile
|
||||||
|
@@ -45,12 +45,12 @@ CFLAGS += -D_GNU_SOURCE -g -O2 \
|
||||||
|
VER=$(shell cat ../VERSION)
|
||||||
|
CFLAGS += -DVERSION=\"$(VER)\"
|
||||||
|
|
||||||
|
-CMD_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
|
||||||
|
-CMD_LDADD += -lwdmd -lrt
|
||||||
|
+CMD_LDFLAGS = $(LDFLAGS) -Wl,-z,now -Wl,-z,relro
|
||||||
|
+CMD_LDADD = -lwdmd -lrt
|
||||||
|
|
||||||
|
-LIB_LDFLAGS += -Wl,-z,relro -pie
|
||||||
|
+LIB_LDFLAGS = $(LDFLAGS) -Wl,-z,relro
|
||||||
|
|
||||||
|
-TEST_LDFLAGS = -lwdmd
|
||||||
|
+TEST_LDFLAGS = $(LDFLAGS) -lwdmd
|
||||||
|
|
||||||
|
|
||||||
|
all: $(SHLIB_TARGET) $(CMD_TARGET) $(TEST_TARGET)
|
||||||
|
--
|
||||||
|
2.7.5
|
||||||
|
|
||||||
BIN
sanlock-3.6.0.tar.gz
Normal file
BIN
sanlock-3.6.0.tar.gz
Normal file
Binary file not shown.
160
sanlock.spec
Normal file
160
sanlock.spec
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
Name: sanlock
|
||||||
|
Version: 3.6.0
|
||||||
|
Release: 7
|
||||||
|
Summary: A shared storage lock manager
|
||||||
|
License: GPLv2 and GPLv2+ and LGPLv2+
|
||||||
|
URL: https://pagure.io/sanlock/
|
||||||
|
Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz
|
||||||
|
Patch0001: 0000-Fix-libsanlock-build-on-Unubtu-Debian.patch
|
||||||
|
Patch0002: 0001-fix-makefile-flags.patch
|
||||||
|
|
||||||
|
BuildRequires: libblkid-devel libaio-devel python2 python2-devel systemd-units
|
||||||
|
Requires(pre): shadow
|
||||||
|
Requires(post): systemd-units systemd-sysv
|
||||||
|
Requires(preun): systemd-units
|
||||||
|
Requires(postun): systemd-units
|
||||||
|
|
||||||
|
Provides: sanlock-lib = %{version}-%{release}
|
||||||
|
Obsoletes: sanlock-lib < %{version}-%{release}
|
||||||
|
|
||||||
|
|
||||||
|
%description
|
||||||
|
The sanlock daemon manages leases for applications running on a cluster of hosts
|
||||||
|
with shared storage. All lease management and coordination is done through reading
|
||||||
|
and writing blocks on the shared storage.
|
||||||
|
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: libraries and header files for sanlock
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
The sanklock-devel package contains libraries and header files
|
||||||
|
for developing applications that use sanlock.
|
||||||
|
|
||||||
|
%package help
|
||||||
|
Summary: maninfo for sanlock
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description help
|
||||||
|
The sanklock-help package contains maninfo for sanlock.
|
||||||
|
|
||||||
|
|
||||||
|
%package -n python2-sanlock
|
||||||
|
%{?python_provide:%python_provide python2-sanlock}
|
||||||
|
Provides: %{name}-python = %{version}-%{release}
|
||||||
|
Obsoletes: %{name}-python < %{version}-%{release}
|
||||||
|
Summary: Python bindings for the sanlock library
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description -n python2-sanlock
|
||||||
|
The python2-sanlock package contains a module that
|
||||||
|
permits applications written in the Python programming language
|
||||||
|
to use the interface supplied by the sanlock library.
|
||||||
|
|
||||||
|
|
||||||
|
%package -n sanlk-reset
|
||||||
|
Summary: Host reset daemon and client using sanlock
|
||||||
|
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.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{name}-%{version} -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
%set_build_flags
|
||||||
|
CFLAGS=$RPM_OPT_FLAGS make -C wdmd
|
||||||
|
CFLAGS=$RPM_OPT_FLAGS make -C src
|
||||||
|
CFLAGS=$RPM_OPT_FLAGS make -C python
|
||||||
|
CFLAGS=$RPM_OPT_FLAGS make -C reset
|
||||||
|
|
||||||
|
%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
|
||||||
|
make -C reset install LIBDIR=%{_libdir} DESTDIR=$RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
install -D -m 0644 init.d/sanlock.service.native $RPM_BUILD_ROOT/%{_unitdir}/sanlock.service
|
||||||
|
install -D -m 0755 init.d/wdmd $RPM_BUILD_ROOT/usr/lib/systemd/systemd-wdmd
|
||||||
|
install -D -m 0644 init.d/wdmd.service.native $RPM_BUILD_ROOT/%{_unitdir}/wdmd.service
|
||||||
|
install -D -m 0644 init.d/sanlk-resetd.service $RPM_BUILD_ROOT/%{_unitdir}/sanlk-resetd.service
|
||||||
|
install -D -m 0644 src/logrotate.sanlock $RPM_BUILD_ROOT/etc/logrotate.d/sanlock
|
||||||
|
install -D -m 0644 src/sanlock.conf $RPM_BUILD_ROOT/etc/sanlock/sanlock.conf
|
||||||
|
install -D -m 0644 init.d/wdmd.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/wdmd
|
||||||
|
|
||||||
|
install -Dd -m 0755 $RPM_BUILD_ROOT/etc/wdmd.d
|
||||||
|
install -Dd -m 0775 $RPM_BUILD_ROOT/%{_localstatedir}/run/sanlock
|
||||||
|
install -Dd -m 0775 $RPM_BUILD_ROOT/%{_localstatedir}/run/sanlk-resetd
|
||||||
|
|
||||||
|
%pre
|
||||||
|
getent group sanlock > /dev/null || /usr/sbin/groupadd -g 179 sanlock
|
||||||
|
getent passwd sanlock > /dev/null || /usr/sbin/useradd \
|
||||||
|
-u 179 -c "sanlock" -s /sbin/nologin -r \
|
||||||
|
-g 179 -d /var/run/sanlock sanlock
|
||||||
|
/usr/sbin/usermod -a -G disk sanlock
|
||||||
|
|
||||||
|
%post
|
||||||
|
%systemd_post wdmd.service sanlock.service
|
||||||
|
/sbin/ldconfig
|
||||||
|
|
||||||
|
%preun
|
||||||
|
%systemd_preun wdmd.service sanlock.service
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%systemd_postun wdmd.service sanlock.service
|
||||||
|
/sbin/ldconfig
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
/usr/lib/systemd/systemd-wdmd
|
||||||
|
%{_unitdir}/sanlock.service
|
||||||
|
%{_unitdir}/wdmd.service
|
||||||
|
%{_sbindir}/sanlock
|
||||||
|
%{_sbindir}/wdmd
|
||||||
|
%dir %{_sysconfdir}/wdmd.d
|
||||||
|
%dir %{_sysconfdir}/sanlock
|
||||||
|
%dir %attr(-,sanlock,sanlock) %{_localstatedir}/run/sanlock
|
||||||
|
%config(noreplace) %{_sysconfdir}/logrotate.d/sanlock
|
||||||
|
%config(noreplace) %{_sysconfdir}/sanlock/sanlock.conf
|
||||||
|
%config(noreplace) %{_sysconfdir}/sysconfig/wdmd
|
||||||
|
%doc init.d/sanlock
|
||||||
|
%doc init.d/sanlock.service
|
||||||
|
%doc init.d/wdmd.service
|
||||||
|
%{_libdir}/libsanlock*.so.*
|
||||||
|
%{_libdir}/libwdmd.so.*
|
||||||
|
|
||||||
|
%files help
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_mandir}/man8/wdmd*
|
||||||
|
%{_mandir}/man8/sanlock*
|
||||||
|
%{_mandir}/man8/sanlk-reset*
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_libdir}/libwdmd.so
|
||||||
|
%{_includedir}/wdmd.h
|
||||||
|
%{_libdir}/libsanlock*.so
|
||||||
|
%{_includedir}/sanlock*.h
|
||||||
|
%{_libdir}/pkgconfig/libsanlock*.pc
|
||||||
|
|
||||||
|
%files -n python2-sanlock
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{python_sitearch}/sanlock_python-*.egg-info
|
||||||
|
%{python_sitearch}/sanlock.so
|
||||||
|
|
||||||
|
%files -n sanlk-reset
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_sbindir}/sanlk-reset*
|
||||||
|
%{_unitdir}/sanlk-resetd.service
|
||||||
|
%dir %attr(-,root,root) %{_localstatedir}/run/sanlk-resetd
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sat Nov 30 2019 zoushuangshuang<zoushuangshuang@huawei.com> - 3.6.0-7
|
||||||
|
- Package init
|
||||||
Loading…
x
Reference in New Issue
Block a user