[packages/watchdog] add systemd unit; rel 2
atler
atler at pld-linux.org
Thu May 1 22:39:07 CEST 2025
commit f05ff07c022f0eeb7e239e19692dd48b4c052d50
Author: Jan Palus <atler at pld-linux.org>
Date: Thu May 1 22:37:05 2025 +0200
add systemd unit; rel 2
watchdog.service | 9 +++++++++
watchdog.spec | 18 ++++++++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/watchdog.spec b/watchdog.spec
index 58350a8..f669026 100644
--- a/watchdog.spec
+++ b/watchdog.spec
@@ -5,24 +5,31 @@
# http://www.christoph-probst.com/technik/software/watchdog/5.2.4/
# - separate package with init-script for wd_keepalive - some parts should
# be in -common subpackage.
+#
+# Conditional build
+%bcond_without systemd # systemd unit
+
Summary: A software watchdog
Summary(pl.UTF-8): Programowy strażnik
Name: watchdog
Version: 5.16
-Release: 1
+Release: 2
License: GPL
Group: Daemons
Source0: http://ftp.debian.org/debian/pool/main/w/watchdog/%{name}_%{version}.orig.tar.gz
# Source0-md5: 1b4f51cabc64d1bee2fce7cdd626831f
Source1: %{name}.init
Source2: %{name}.sysconfig
+Source3: %{name}.service
Patch0: %{name}-foreground.patch
Patch1: %{name}-config.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: rpmbuild(macros) >= 1.268
Requires(post,preun): /sbin/chkconfig
+%{?with_systemd:Requires(post,preun,postun): systemd-units >= 1:250.1}
Requires: rc-scripts
+%{?with_systemd:Requires: systemd-units >= 1:250.1}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
@@ -51,19 +58,21 @@ rebootu zależy od stanu maszyny i przerwań.
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
+install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig} %{?with_systemd:$RPM_BUILD_ROOT%{systemdunitdir}}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/watchdog
install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/watchdog
+%{?with_systemd:install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/watchdog.service}
%clean
rm -rf $RPM_BUILD_ROOT
%post
/sbin/chkconfig --add watchdog
+%{?with_systemd:%systemd_post watchdog.service}
%service watchdog restart "watchdog daemon"
%preun
@@ -71,6 +80,10 @@ if [ "$1" = 0 ] ; then
%service watchdog stop
/sbin/chkconfig --del watchdog
fi
+%{?with_systemd:%systemd_preun watchdog.service}
+
+%postun
+%{?with_systemd:%systemd_reload}
%files
%defattr(644,root,root,755)
@@ -79,4 +92,5 @@ fi
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/watchdog
%attr(754,root,root) /etc/rc.d/init.d/watchdog
%attr(755,root,root) %{_sbindir}/*
+%{?with_systemd:%{systemdunitdir}/watchdog.service}
%{_mandir}/man?/*
diff --git a/watchdog.service b/watchdog.service
new file mode 100644
index 0000000..5033de8
--- /dev/null
+++ b/watchdog.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=watchdog daemon
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/watchdog
+
+[Install]
+WantedBy=multi-user.target
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/watchdog.git/commitdiff/f05ff07c022f0eeb7e239e19692dd48b4c052d50
More information about the pld-cvs-commit
mailing list