watchdog/watchdog.spec
2020-09-19 17:17:39 +08:00

80 lines
2.8 KiB
RPMSpec

Name: watchdog
Summary: A powerful software and/or Hardware watchdog daemon and/or device
Version: 5.15
Release: 5
License: GPLv2+
URL: http://sourceforge.net/projects/watchdog/
Source0: http://downloads.sourceforge.net/watchdog/watchdog-%{version}.tar.gz
Source1: https://sourceforge.net/p/watchdog/code/ci/master/tree/redhat/watchdog.init
Source2: https://sourceforge.net/p/watchdog/code/ci/master/tree/README.watchdog.ipmi
# watchdog.service and watchdog-ping.service enable systemd support for watchdog.
# https://patchwork.openembedded.org/patch/113573
Source4: watchdog.service
Source5: watchdog-ping.service
Patch0000: 0003-watchdog-5.13-rhsel.patch
Patch0001: 0004-watchdog-5.13-rhseldoc.patch
BuildRequires: gcc libtirpc-devel systemd-units
Requires: systemd
%description
The watchdog program can be used as a powerful software watchdog daemon or
a hardware watchdog device.
%prep
%autosetup -n watchdog-%{version} -p1
cp %{SOURCE2} .
mv README README.orig
iconv -f ISO-8859-1 -t UTF-8 < README.orig > README
%build
%configure CFLAGS="%{__global_cflags} -I/usr/include/tirpc" \
LDFLAGS="%{__global_ldflags} -ltirpc"
%make_build
%install
install -d -m0755 %{buildroot}%{_sysconfdir}
install -d -m0755 %{buildroot}%{_sysconfdir}/watchdog.d
%make_install
install -Dp -m0644 watchdog.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/watchdog
install -Dp -m0644 %{SOURCE4} %{buildroot}%{_unitdir}/watchdog.service
install -Dp -m0644 %{SOURCE5} %{buildroot}%{_unitdir}/watchdog-ping.service
install -Dd -m0755 %{buildroot}%{_libexecdir}/watchdog/scripts
%post
%systemd_post watchdog.service
%preun
%systemd_preun watchdog.service
%systemd_preun watchdog-ping.service
%postun
%systemd_postun_with_restart watchdog.service
%systemd_postun_with_restart watchdog-ping.service
%triggerun -- watchdog < 5.9-4
/usr/bin/systemd-sysv-convert --save watchdog >/dev/null 2>&1 ||:
/sbin/chkconfig --del watchdog >/dev/null 2>&1 || :
/bin/systemctl try-restart watchdog.service >/dev/null 2>&1 || :
/bin/systemctl try-restart watchdog-ping.service >/dev/null 2>&1 || :
%files
%doc AUTHORS ChangeLog COPYING examples/ IAFA-PACKAGE NEWS README TODO README.watchdog.ipmi
%config(noreplace) %{_sysconfdir}/{watchdog.conf,sysconfig/watchdog}
%{_sysconfdir}/watchdog.d
%{_sbindir}/{watchdog,wd_identify,wd_keepalive}
%{_mandir}/man5/watchdog.conf.5*
%{_mandir}/man8/{watchdog.8*,wd_identify.8*,wd_keepalive.8*}
%{_unitdir}/{watchdog.service,watchdog-ping.service}
%{_libexecdir}/watchdog/scripts
%changelog
* Sat Sep 19 2020 Guoshuai Sun <sunguoshuai@huawei.com> - 5.15-5
- scripts when uninstall in %preun and %postun should watchdog-ping.service but not watchdog.ping.service
* Mon Apr 27 2020 chengzihan <chengzihan2@huawei.com> - 5.15-4
- Package init