- Add support for systemd
- Add /etc/sysconfig/sanlock configuration file OBS-URL: https://build.opensuse.org/package/show/Virtualization/sanlock?expand=0&rev=3
This commit is contained in:
parent
c3db1be504
commit
85b7dd53be
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jan 19 17:05:58 MST 2012 - jfehlig@suse.com
|
||||||
|
|
||||||
|
- Add support for systemd
|
||||||
|
- Add /etc/sysconfig/sanlock configuration file
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Jan 19 16:23:03 MST 2012 - jfehlig@suse.com
|
Thu Jan 19 16:23:03 MST 2012 - jfehlig@suse.com
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo -n "Starting sanlock "
|
echo -n "Starting sanlock "
|
||||||
startproc $SANLOCK_BIN daemon $SANLOCKOPTS
|
startproc $SANLOCK_BIN daemon $SANLOCK_OPTS
|
||||||
rc_status -v
|
rc_status -v
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
|
47
sanlock.spec
47
sanlock.spec
@ -15,6 +15,12 @@
|
|||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
%define with_systemd 0
|
||||||
|
%if 0%{?suse_version} > 1140
|
||||||
|
%define with_systemd 1
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
Name: sanlock
|
Name: sanlock
|
||||||
Version: 1.9
|
Version: 1.9
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
@ -25,13 +31,19 @@ License: GPLv2, GPLv2+, LGPLv2+
|
|||||||
URL: https://fedorahosted.org/sanlock/
|
URL: https://fedorahosted.org/sanlock/
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
BuildRequires: libblkid-devel libaio-devel python python-devel
|
BuildRequires: libblkid-devel libaio-devel python python-devel
|
||||||
|
%if %{with_systemd}
|
||||||
|
BuildRequires: systemd
|
||||||
|
%{?systemd_requires}
|
||||||
|
%endif
|
||||||
Requires: %{name}-lib = %{version}-%{release}
|
Requires: %{name}-lib = %{version}-%{release}
|
||||||
Source0: https://fedorahosted.org/releases/s/a/sanlock/%{name}-%{version}.tar.gz
|
Source0: https://fedorahosted.org/releases/s/a/sanlock/%{name}-%{version}.tar.gz
|
||||||
Source1: sanlock.init
|
Source1: sanlock.init
|
||||||
Source2: wdmd.init
|
Source2: wdmd.init
|
||||||
|
Source3: sysconfig.sanlock
|
||||||
Patch0: sanlock-SCHED_RESET_ON_FORK-undefined.patch
|
Patch0: sanlock-SCHED_RESET_ON_FORK-undefined.patch
|
||||||
Patch1: sanlock-python-prefix.patch
|
Patch1: sanlock-python-prefix.patch
|
||||||
Patch2: sanlock-old_blkid.patch
|
Patch2: sanlock-old_blkid.patch
|
||||||
|
Patch3: suse-systemd.patch
|
||||||
|
|
||||||
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||||
|
|
||||||
@ -45,6 +57,7 @@ access to the shared disks.
|
|||||||
%patch0
|
%patch0
|
||||||
%patch1
|
%patch1
|
||||||
%patch2
|
%patch2
|
||||||
|
%patch3 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# upstream does not require configure
|
# upstream does not require configure
|
||||||
@ -64,7 +77,12 @@ make -C python \
|
|||||||
install LIBDIR=%{_libdir} \
|
install LIBDIR=%{_libdir} \
|
||||||
DESTDIR=$RPM_BUILD_ROOT PREFIX=%_prefix
|
DESTDIR=$RPM_BUILD_ROOT PREFIX=%_prefix
|
||||||
install -D -m 755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/sanlock
|
install -D -m 755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/sanlock
|
||||||
|
install -D -m 755 %SOURCE1 $RPM_BUILD_ROOT/$(localstatedir)/adm/fillup-templates/sysconfig.sanlock
|
||||||
install -D -m 755 %SOURCE2 $RPM_BUILD_ROOT/etc/init.d/wdmd
|
install -D -m 755 %SOURCE2 $RPM_BUILD_ROOT/etc/init.d/wdmd
|
||||||
|
%if %{with_systemd}
|
||||||
|
install -D -m 755 init.d/sanlock.service $RPM_BUILD_ROOT/%{_unitdir}/sanlock.service
|
||||||
|
install -D -m 755 init.d/wdmd.service $RPM_BUILD_ROOT/%{_unitdir}/wdmd.service
|
||||||
|
%endif
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
@ -72,14 +90,25 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%pre
|
%pre
|
||||||
/usr/sbin/useradd -u 179 -g 179 -c "sanlock" -s /sbin/nologin -r \
|
/usr/sbin/useradd -u 179 -g 179 -c "sanlock" -s /sbin/nologin -r \
|
||||||
-d /var/run/sanlock sanlock 2> /dev/null || :
|
-d /var/run/sanlock sanlock 2> /dev/null || :
|
||||||
|
%if %{with_systemd}
|
||||||
|
%service_add_pre wdmd.service
|
||||||
|
%service_add_pre sanlock.service
|
||||||
|
%endif
|
||||||
|
|
||||||
##%post
|
%post
|
||||||
##/sbin/chkconfig --add sanlock
|
%if %{with_systemd}
|
||||||
##/sbin/chkconfig --add wdmd
|
%service_add_post wdmd.service sanlock.service
|
||||||
|
%else
|
||||||
|
%{fillup_only -n sanlock}
|
||||||
|
%endif
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
%{stop_on_removal sanlock}
|
%if %{with_systemd}
|
||||||
|
%service_del_preun wdmd.service sanlock.service
|
||||||
|
%else
|
||||||
%{stop_on_removal wdmd}
|
%{stop_on_removal wdmd}
|
||||||
|
%{stop_on_removal sanlock}
|
||||||
|
%endif
|
||||||
##if [ $1 = 0 ]; then
|
##if [ $1 = 0 ]; then
|
||||||
## /sbin/service sanlock stop > /dev/null 2>&1
|
## /sbin/service sanlock stop > /dev/null 2>&1
|
||||||
## /sbin/service wdmd stop > /dev/null 2>&1
|
## /sbin/service wdmd stop > /dev/null 2>&1
|
||||||
@ -88,6 +117,12 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
##fi
|
##fi
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
|
%if %{with_systemd}
|
||||||
|
%service_del_postun wdmd.service sanlock.service
|
||||||
|
%else
|
||||||
|
%restart_on_update wdmd
|
||||||
|
%restart_on_update sanlock
|
||||||
|
%endif
|
||||||
%{insserv_cleanup}
|
%{insserv_cleanup}
|
||||||
#/sbin/service sanlock condrestart >/dev/null 2>&1 || :
|
#/sbin/service sanlock condrestart >/dev/null 2>&1 || :
|
||||||
#/sbin/service wdmd condrestart >/dev/null 2>&1 || :
|
#/sbin/service wdmd condrestart >/dev/null 2>&1 || :
|
||||||
@ -96,6 +131,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
/etc/init.d/sanlock
|
/etc/init.d/sanlock
|
||||||
/etc/init.d/wdmd
|
/etc/init.d/wdmd
|
||||||
|
%if %{with_systemd}
|
||||||
|
%{_unitdir}/sanlock.service
|
||||||
|
%{_unitdir}/wdmd.service
|
||||||
|
%endif
|
||||||
%{_sbindir}/sanlock
|
%{_sbindir}/sanlock
|
||||||
%{_sbindir}/wdmd
|
%{_sbindir}/wdmd
|
||||||
%{_mandir}/man8/wdmd*
|
%{_mandir}/man8/wdmd*
|
||||||
|
31
suse-systemd.patch
Normal file
31
suse-systemd.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
Index: sanlock-1.9/init.d/sanlock.service
|
||||||
|
===================================================================
|
||||||
|
--- sanlock-1.9.orig/init.d/sanlock.service
|
||||||
|
+++ sanlock-1.9/init.d/sanlock.service
|
||||||
|
@@ -3,8 +3,9 @@ After=syslog.target wdmd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
-ExecStart=/lib/systemd/systemd-sanlock start
|
||||||
|
-ExecStop=/lib/systemd/systemd-sanlock stop
|
||||||
|
+EnvironmentFile=-/etc/sysconfig/sanlock
|
||||||
|
+ExecStart=/usr/sbin/sanlock daemon $SANLOCKOPTS
|
||||||
|
+ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
Index: sanlock-1.9/init.d/wdmd.service
|
||||||
|
===================================================================
|
||||||
|
--- sanlock-1.9.orig/init.d/wdmd.service
|
||||||
|
+++ sanlock-1.9/init.d/wdmd.service
|
||||||
|
@@ -3,8 +3,8 @@ After=syslog.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
-ExecStart=/lib/systemd/systemd-wdmd start
|
||||||
|
-ExecStop=/lib/systemd/systemd-wdmd stop
|
||||||
|
+ExecStart=/usr/sbin/wdmd
|
||||||
|
+ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
10
sysconfig.sanlock
Normal file
10
sysconfig.sanlock
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
## Path: System/Virtualization/sanlock
|
||||||
|
|
||||||
|
## Type: string
|
||||||
|
## Default: ""
|
||||||
|
# Options passed to sanlock daemon, see man sanlock(8)
|
||||||
|
# E.g. to use sanlock without the watchdog multiplexing
|
||||||
|
# daemon set SANLOCK_OPTS as follows
|
||||||
|
#
|
||||||
|
# SANLOCK_OPTS="-w 0"
|
||||||
|
SANLOCK_OPTS=""
|
Loading…
x
Reference in New Issue
Block a user