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