b0c66d
%define _hardened_build 1
4b90d8
Summary:          Software and/or Hardware watchdog daemon
4b90d8
Name:             watchdog
4b90d8
Version:          5.13
b0c66d
Release:          12%{?dist}
4b90d8
License:          GPLv2+
4b90d8
4b90d8
URL:              http://sourceforge.net/projects/watchdog/
4b90d8
Source0:          http://downloads.sourceforge.net/watchdog/watchdog-%{version}.tar.gz
4b90d8
Source1:          watchdog.init
4b90d8
Source2:          README.watchdog.ipmi
4b90d8
Source3:          README.Fedora
4b90d8
Source4:          watchdog.service
4b90d8
Source5:          watchdog-ping.service
4b90d8
4b90d8
# Documentation fixes (RHBZ#948883).
4b90d8
# Sent upstream on 2013-05-16.
4b90d8
Patch1:           0001-watchdog-Clearer-help-output.patch
4b90d8
Patch2:           0002-wd_identify-wd_keepalive-Document-c-config-file-in-h.patch
4b90d8
Patch3:           0003-watchdog-5.13-rhsel.patch
4b90d8
Patch4:           0004-watchdog-5.13-rhseldoc.patch
4b90d8
4b90d8
BuildRequires:    systemd-units
4b90d8
4b90d8
Requires(post): systemd-units
4b90d8
Requires(preun): systemd-units
4b90d8
Requires(postun): systemd-units
4b90d8
4b90d8
4b90d8
%description
4b90d8
The watchdog program can be used as a powerful software watchdog daemon 
4b90d8
or may be alternately used with a hardware watchdog device such as the 
4b90d8
IPMI hardware watchdog driver interface to a resident Baseboard 
4b90d8
Management Controller (BMC).  watchdog periodically writes to /dev/watchdog; 
4b90d8
the interval between writes to /dev/watchdog is configurable through settings 
4b90d8
in the watchdog sysconfig file.  This configuration file is also used to 
4b90d8
set the watchdog to be used as a hardware watchdog instead of its default 
4b90d8
software watchdog operation.  In either case, if the device is open but not 
4b90d8
written to within the configured time period, the watchdog timer expiration 
4b90d8
will trigger a machine reboot. When operating as a software watchdog, the 
4b90d8
ability to reboot will depend on the state of the machine and interrupts.  
4b90d8
When operating as a hardware watchdog, the machine will experience a hard 
4b90d8
reset (or whatever action was configured to be taken upon watchdog timer 
4b90d8
expiration) initiated by the BMC.
4b90d8
4b90d8
 
4b90d8
%prep
4b90d8
%setup -q -n %{name}-%{version}
4b90d8
%patch1 -p1 -b .help
4b90d8
%patch2 -p1 -b .keepalive
4b90d8
%patch3 -p1 -b .rhsel
4b90d8
%patch4 -p1 -b .rhseldoc
4b90d8
4b90d8
cp %{SOURCE2} .
4b90d8
cp %{SOURCE3} .
4b90d8
%if 0%{?rhel}
4b90d8
mv README.Fedora README.RHEL
4b90d8
%endif
4b90d8
4b90d8
mv README README.orig
4b90d8
iconv -f ISO-8859-1 -t UTF-8 < README.orig > README
4b90d8
4b90d8
4b90d8
%build
4b90d8
%configure 
4b90d8
make %{?_smp_mflags}
4b90d8
4b90d8
4b90d8
%install
4b90d8
install -d -m0755 ${RPM_BUILD_ROOT}%{_sysconfdir}
4b90d8
install -d -m0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/watchdog.d
4b90d8
make DESTDIR=${RPM_BUILD_ROOT} install
4b90d8
install -Dp -m0644 %{name}.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/watchdog
4b90d8
install -Dp -m0644 %{SOURCE4} ${RPM_BUILD_ROOT}%{_unitdir}/watchdog.service
4b90d8
install -Dp -m0644 %{SOURCE5} ${RPM_BUILD_ROOT}%{_unitdir}/watchdog-ping.service
4b90d8
install -Dd -m0755 ${RPM_BUILD_ROOT}%{_libexecdir}/watchdog/scripts
4b90d8
4b90d8
4b90d8
%post
4b90d8
if [ $1 -eq 1 ] ; then 
4b90d8
    # Initial installation 
4b90d8
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
4b90d8
fi
4b90d8
4b90d8
4b90d8
%preun 
4b90d8
if [ $1 -eq 0 ] ; then
4b90d8
    # Package removal, not upgrade
4b90d8
    /bin/systemctl --no-reload disable watchdog.service > /dev/null 2>&1 || :
4b90d8
    /bin/systemctl --no-reload disable watchdog-ping.service > /dev/null 2>&1 || :
4b90d8
    /bin/systemctl stop watchdog.service > /dev/null 2>&1 || :
4b90d8
    /bin/systemctl stop watchdog-ping.service > /dev/null 2>&1 || :
4b90d8
fi
4b90d8
4b90d8
4b90d8
%postun 
4b90d8
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
4b90d8
if [ $1 -ge 1 ] ; then
4b90d8
    # Package upgrade, not uninstall
4b90d8
    /bin/systemctl try-restart watchdog.service >/dev/null 2>&1 || :
4b90d8
    /bin/systemctl try-restart watchdog-ping.service >/dev/null 2>&1 || :
4b90d8
fi
4b90d8
4b90d8
%triggerun -- watchdog < 5.9-4
4b90d8
# Save the current service runlevel info
4b90d8
# User must manually run systemd-sysv-convert --apply watchdog
4b90d8
# to migrate them to systemd targets
4b90d8
/usr/bin/systemd-sysv-convert --save watchdog >/dev/null 2>&1 ||:
4b90d8
4b90d8
# Run these because the SysV package being removed won't do them
4b90d8
/sbin/chkconfig --del watchdog >/dev/null 2>&1 || :
4b90d8
/bin/systemctl try-restart watchdog.service >/dev/null 2>&1 || :
4b90d8
/bin/systemctl try-restart watchdog-ping.service >/dev/null 2>&1 || :
4b90d8
4b90d8
4b90d8
%files
4b90d8
%doc AUTHORS ChangeLog COPYING examples/ IAFA-PACKAGE NEWS README TODO README.watchdog.ipmi
4b90d8
%if 0%{?rhel}
4b90d8
%doc README.RHEL
4b90d8
%else
4b90d8
%doc README.Fedora
4b90d8
%endif
4b90d8
%config(noreplace) %{_sysconfdir}/watchdog.conf
4b90d8
%config(noreplace) %{_sysconfdir}/sysconfig/watchdog
4b90d8
%{_sysconfdir}/watchdog.d
4b90d8
%{_sbindir}/watchdog
4b90d8
%{_sbindir}/wd_identify
4b90d8
%{_sbindir}/wd_keepalive
4b90d8
%{_mandir}/man5/watchdog.conf.5*
4b90d8
%{_mandir}/man8/watchdog.8*
4b90d8
%{_mandir}/man8/wd_identify.8*
4b90d8
%{_mandir}/man8/wd_keepalive.8*
4b90d8
%{_unitdir}/watchdog.service
4b90d8
%{_unitdir}/watchdog-ping.service
4b90d8
%{_libexecdir}/watchdog/scripts
4b90d8
4b90d8
4b90d8
%changelog
b0c66d
* Tue Jun 19 2018 Josef Ridky <jridky@redhat.com> - 5.13-12
b0c66d
- Resolves: #1092523 - add PIE and RELRO check 
b0c66d
- Resolves: #1133135 - add ipmi.service dependency to watchdog.service file
b0c66d
- Resolves: #1259816 - remove deprecated stanza in unit files
b0c66d
1b7ef9
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 5.13-11
1b7ef9
- Mass rebuild 2014-01-24
1b7ef9
1b7ef9
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 5.13-10
1b7ef9
- Mass rebuild 2013-12-27
1b7ef9
4b90d8
* Thu Nov  7 2013 Ales Ledvinka <aledvink@redhat.com> - 5.13-9
4b90d8
- SELinux: Add /usr/libexec/watchdog/scripts/ for test-bin and repair-bin to inherit from.
4b90d8
- systemd: service with network available dependency
4b90d8
- systemd: correct cgroup for realtime settings
4b90d8
- Document SELinux and systemd.
4b90d8
4b90d8
* Thu Oct 24 2013 Ales Ledvinka <aledvink@redhat.com> - 5.13-5
4b90d8
- SELinux: do not reopen descriptors for reading when only appending.
4b90d8
4b90d8
* Fri Aug  9 2013 Richard W.M. Jones <rjones@redhat.com> - 5.13-4
4b90d8
- Fix License field (software is GPLv2+, not "GPL+").
4b90d8
4b90d8
* Thu Aug  8 2013 Richard W.M. Jones <rjones@redhat.com> - 5.13-3
4b90d8
- Rename README.Fedora to README.RHEL on RHEL.
4b90d8
4b90d8
* Tue Jul 30 2013 Richard W.M. Jones <rjones@redhat.com> - 5.13-2
4b90d8
- Enable /etc/watchdog.d directory for storing test binaries
4b90d8
  (RHBZ#657750, RHBZ#831190).
4b90d8
- Missing BR systemd-units.
4b90d8
- Update .gitignore.
4b90d8
- Drop Group line, not required by modern RPM.
4b90d8
4b90d8
* Thu May 16 2013 Richard W.M. Jones <rjones@redhat.com> - 5.13-1
4b90d8
- New upstream version 5.13.
4b90d8
- Various documentation fixes (RHBZ#948883).
4b90d8
4b90d8
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.12-3
4b90d8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
4b90d8
4b90d8
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.12-2
4b90d8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
4b90d8
4b90d8
* Fri Jul 06 2012 Richard W.M. Jones <rjones@redhat.com> - 5.12-1
4b90d8
- New upstream version 5.12 (RHBZ#837949).
4b90d8
- Bring specfile up to modern standards.
4b90d8
- Remove commented sections from previous commit.
4b90d8
- Remove both patches (equivalent changes now upstream).
4b90d8
4b90d8
* Wed Mar 14 2012 Jon Ciesla <limburgher@gmail.com> - 5.9-4
4b90d8
- Migrate to systemd, BZ 661220.
4b90d8
4b90d8
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.9-3
4b90d8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
4b90d8
4b90d8
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.9-2
4b90d8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
4b90d8
4b90d8
* Mon Jan 17 2011 Richard W.M. Jones <rjones@redhat.com> - 5.9-1
4b90d8
- New upstream version 5.9 (RHBZ#645541).
4b90d8
- Package new wd_identify program.
4b90d8
- Drop old cleanup patch, most of it is now upstream.
4b90d8
- Add newer cleanup patch, sent upstream.
4b90d8
- Fix some problems with the initscript (RHBZ#523391).
4b90d8
- Add systemd service (file installed but not used) (RHBZ#661220).
4b90d8
4b90d8
* Wed Jan 13 2010 Richard W.M. Jones <rjones@redhat.com> - 5.5-7
4b90d8
- Fix Source0 URL.
4b90d8
4b90d8
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.5-6
4b90d8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
4b90d8
4b90d8
* Fri Mar 13 2009 Richard W.M. Jones <rjones@redhat.com> - 5.5-5
4b90d8
- Updated the cleanup patch and sent upstream.
4b90d8
4b90d8
* Fri Mar 13 2009 Richard W.M. Jones <rjones@redhat.com> - 5.5-3
4b90d8
- Remove dubious "cleanup-nfs" patch.
4b90d8
4b90d8
* Thu Mar  5 2009 Richard W.M. Jones <rjones@redhat.com> - 5.5-2
4b90d8
- Use '-' in defattr line instead of explicit file mode.
4b90d8
4b90d8
* Thu Feb 26 2009 Richard W.M. Jones <rjones@redhat.com> - 5.5-1
4b90d8
- New upstream version 5.5.
4b90d8
- Prepared the package for Fedora review.
4b90d8
4b90d8
* Mon Jun 11  2007 Lon Hohberger <lhh@redhat.com> - 5.3.1-7
4b90d8
- Rebuild for RHEL5 Update 1 - Resolves: 227401
4b90d8
4b90d8
* Wed May 30  2007 Konrad Rzeszutek <konradr@redhat.com> - 5.3.1-6
4b90d8
- Fixed the init script file.
4b90d8
4b90d8
* Tue May 29  2007 Konrad Rzeszutek <konradr@redhat.com> - 5.3.1-5
4b90d8
- Fixed a compile warning in nfsmount_xdr file.
4b90d8
4b90d8
* Wed May 23  2007 Konrad Rzeszutek <konradr@redhat.com> - 5.3.1-4
4b90d8
- Fixed rpmlint warnings.
4b90d8
4b90d8
* Wed May 16  2007 Konrad Rzeszutek <konradr@redhat.com> - 5.3.1-3
4b90d8
- Changes to spec, init script and README file per Carol Hebert recommendation.
4b90d8
4b90d8
* Thu Apr 19  2007 Konrad Rzeszutek <konradr@redhat.com> - 5.3.1-2
4b90d8
- Added README.watchdog.ipmi
4b90d8
4b90d8
* Mon Apr 16  2007 Konrad Rzeszutek <konradr@redhat.com> - 5.3.1-1
4b90d8
- Initial copy.