--- /dev/null
+--- sanlock-3.9.1/init.d/sanlock-sysv.orig 1970-01-01 01:00:00.000000000 +0100
++++ sanlock-3.9.1/init.d/sanlock-sysv 2023-12-13 23:47:19.000000000 +0100
+@@ -0,0 +1,126 @@
++#!/bin/bash
++#
++# sanlock - SAN-based lock manager
++#
++# chkconfig: 2345 97 03
++# description: starts and stops sanlock daemon
++#
++
++
++### BEGIN INIT INFO
++# Provides: sanlock
++# Required-Start: $time $syslog wdmd
++# Required-Stop: $syslog
++# Should-Start:
++# Should-Stop:
++# Default-Start: 2 3 4 5
++# Default-Stop: 0 1 6
++# Short-Description: starts and stops sanlock daemon
++# Description: starts and stops sanlock daemon
++### END INIT INFO
++
++. /etc/rc.d/init.d/functions
++
++prog="sanlock"
++runfile="/run/$prog/$prog.pid"
++lockfile="/var/lock/subsys/$prog"
++exec="/usr/sbin/$prog"
++
++SANLOCKUSER="sanlock"
++SANLOCKOPTS="-U $SANLOCKUSER -G $SANLOCKUSER"
++
++[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
++
++start() {
++ [ -x $exec ] || exit 5
++
++ if [ ! -d /run/$prog ]; then
++ install -d -o $SANLOCKUSER -g $SANLOCKUSER -m 775 /run/$prog
++ [ -x /sbin/restorecon ] && restorecon /run/$prog
++ fi
++
++ echo -n $"Starting $prog: "
++ daemon $prog daemon $SANLOCKOPTS
++ retval=$?
++ echo
++ [ $retval -eq 0 ] && touch $lockfile
++ return $retval
++}
++
++stop() {
++ PID=$(pidofproc -p $runfile $prog)
++
++ echo -n $"Sending stop signal $prog ($PID): "
++ killproc -p $runfile $prog -TERM
++ retval=$?
++ echo
++
++ if [ $retval -ne 0 ]; then
++ return $retval
++ fi
++
++ echo -n $"Waiting for $prog ($PID) to stop:"
++
++ timeout=10
++ while checkpid $PID; do
++ sleep 1
++ timeout=$((timeout - 1))
++ if [ "$timeout" -le 0 ]; then
++ failure; echo
++ return 1
++ fi
++ done
++
++ success; echo
++ rm -f $lockfile
++ return $retval
++}
++
++restart() {
++ rh_status_q && stop
++ start
++}
++
++reload() {
++ restart
++}
++
++rh_status() {
++ status $prog
++}
++
++rh_status_q() {
++ rh_status >/dev/null 2>&1
++}
++
++case "$1" in
++ start)
++ rh_status_q && exit 0
++ $1
++ ;;
++ stop)
++ rh_status_q || exit 0
++ $1
++ ;;
++ restart)
++ $1
++ ;;
++ reload)
++ rh_status_q || exit 7
++ $1
++ ;;
++ force-reload)
++ force_reload
++ ;;
++ status)
++ rh_status
++ ;;
++ condrestart|try-restart)
++ rh_status_q || exit 0
++ restart
++ ;;
++ *)
++ echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
++ exit 2
++esac
++exit $?
+--- sanlock-3.9.1/init.d/wdmd-sysv.orig 1970-01-01 01:00:00.000000000 +0100
++++ sanlock-3.9.1/init.d/wdmd-sysv 2023-12-13 23:47:19.000000000 +0100
+@@ -0,0 +1,155 @@
++#!/bin/bash
++#
++# wdmd - watchdog multiplexing daemon
++#
++# chkconfig: 2345 97 03
++# description: starts and stops wdmd daemon
++#
++
++
++### BEGIN INIT INFO
++# Provides: wdmd
++# Required-Start: $time $syslog
++# Required-Stop: $syslog
++# Should-Start:
++# Should-Stop:
++# Default-Start: 2 3 4 5
++# Default-Stop: 0 1 6
++# Short-Description: starts and stops wdmd daemon
++# Description: starts and stops wdmd daemon
++### END INIT INFO
++
++. /etc/rc.d/init.d/functions
++
++prog="wdmd"
++runfile="/run/$prog/$prog.pid"
++lockfile="/var/lock/subsys/$prog"
++exec="/usr/sbin/$prog"
++
++WDMDGROUP="sanlock"
++WDMDOPTS="-G $WDMDGROUP"
++
++[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
++
++watchdog_probe() {
++ $exec --probe > /dev/null 2>&1
++ retval=$?
++ return $retval
++}
++
++watchdog_check() {
++ watchdog_probe
++ retval=$?
++
++ if [ $retval -ne 0 ]; then
++ echo -n $"Loading the softdog kernel module: "
++ modprobe softdog && udevadm settle
++
++ watchdog_probe
++ retval=$?
++ if [ $retval -ne 0 ]; then
++ failure; echo
++ return 1
++ fi
++ success; echo
++ fi
++}
++
++start() {
++ watchdog_check
++
++ [ -x $exec ] || exit 5
++
++ if [ ! -d /run/$prog ]; then
++ install -d -g $WDMDGROUP -m 775 /run/$prog
++ [ -x /sbin/restorecon ] && restorecon /run/$prog
++ fi
++
++ echo -n $"Starting $prog: "
++ daemon $prog $WDMDOPTS
++ retval=$?
++ echo
++ [ $retval -eq 0 ] && touch $lockfile
++ return $retval
++}
++
++stop() {
++ PID=$(pidofproc -p $runfile $prog)
++
++ echo -n $"Sending stop signal $prog ($PID): "
++ killproc -p $runfile $prog -TERM
++ retval=$?
++ echo
++
++ if [ $retval -ne 0 ]; then
++ return $retval
++ fi
++
++ echo -n $"Waiting for $prog ($PID) to stop:"
++
++ timeout=10
++ while checkpid $PID; do
++ sleep 1
++ timeout=$((timeout - 1))
++ if [ "$timeout" -le 0 ]; then
++ failure; echo
++ return 1
++ fi
++ done
++
++ success; echo
++ rm -f $lockfile
++ return $retval
++}
++
++restart() {
++ rh_status_q && stop
++ start
++}
++
++reload() {
++ restart
++}
++
++rh_status() {
++ status $prog
++}
++
++rh_status_q() {
++ rh_status >/dev/null 2>&1
++}
++
++case "$1" in
++ start)
++ rh_status_q && exit 0
++ $1
++ ;;
++ stop)
++ rh_status_q || exit 0
++ $1
++ ;;
++ restart)
++ $1
++ ;;
++ reload)
++ rh_status_q || exit 7
++ $1
++ ;;
++ watchdog-check)
++ watchdog_check
++ ;;
++ force-reload)
++ force_reload
++ ;;
++ status)
++ rh_status
++ ;;
++ condrestart|try-restart)
++ rh_status_q || exit 0
++ restart
++ ;;
++ *)
++ echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
++ exit 2
++esac
++exit $?
Summary: Shared storage lock manager
Summary(pl.UTF-8): Zarządca blokad dla współdzielonego składowania danych
Name: sanlock
-Version: 3.9.0
+Version: 3.9.1
Release: 1
License: LGPL v2+ (libsanlock_client, libwdmd), GPL v2 (libsanlock, utilities)
Group: Networking
Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz
-# Source0-md5: 91ef906496b79a06319234fd49dae662
-Patch0: %{name}-init-pld.patch
+# Source0-md5: 41c94ac99b39f81a962c4fde00ae0dd3
+Patch0: %{name}-restore-sysv.patch
+Patch1: %{name}-init-pld.patch
URL: https://pagure.io/sanlock
BuildRequires: gcc >= 5:3.4
BuildRequires: libaio-devel
%prep
%setup -q
%patch0 -p1
+%patch1 -p1
%build
export CFLAGS="%{rpmcflags}"
install -d $RPM_BUILD_ROOT{%{systemdunitdir},/etc/rc.d/init.d}
install init.d/fence_sanlockd $RPM_BUILD_ROOT/etc/rc.d/init.d
-install init.d/sanlock $RPM_BUILD_ROOT/etc/rc.d/init.d
-install init.d/wdmd $RPM_BUILD_ROOT/etc/rc.d/init.d
-for serv in sanlock wdmd fence_sanlockd ; do
- sed -e "s,/lib/systemd/systemd-${serv},/etc/rc.d/init.d/${serv}," init.d/${serv}.service >$RPM_BUILD_ROOT%{systemdunitdir}/${serv}.service
-done
+install init.d/sanlock-sysv $RPM_BUILD_ROOT/etc/rc.d/init.d/sanlock
+install init.d/wdmd-sysv $RPM_BUILD_ROOT/etc/rc.d/init.d/wdmd
+sed -e "s,/lib/systemd/systemd-fence_sanlockd,/etc/rc.d/init.d/fence_sanlockd," init.d/fence_sanlockd.service >$RPM_BUILD_ROOT%{systemdunitdir}/fence_sanlockd.service
cp -p init.d/sanlk-resetd.service $RPM_BUILD_ROOT%{systemdunitdir}
+cp -p init.d/sanlock.service.native $RPM_BUILD_ROOT%{systemdunitdir}/sanlock.service
+cp -p init.d/wdmd.service $RPM_BUILD_ROOT%{systemdunitdir}
+install init.d/systemd-wdmd $RPM_BUILD_ROOT/lib/systemd
install -d $RPM_BUILD_ROOT/var/run/{sanlock,wdmd,fence_sanlock,fence_sanlockd}
install -d $RPM_BUILD_ROOT%{systemdtmpfilesdir}
%attr(755,root,root) %{_sbindir}/wdmd
%attr(754,root,root) /etc/rc.d/init.d/sanlock
%attr(754,root,root) /etc/rc.d/init.d/wdmd
+%attr(755,root,root) /lib/systemd/systemd-wdmd
%{systemdunitdir}/sanlock.service
%{systemdunitdir}/wdmd.service
%{systemdtmpfilesdir}/sanlock.conf