diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..056a752 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/watchdog-5.13.tar.gz diff --git a/.watchdog.metadata b/.watchdog.metadata new file mode 100644 index 0000000..8a00603 --- /dev/null +++ b/.watchdog.metadata @@ -0,0 +1 @@ +1d29298361fb693ebbe7a6d21d2395961a3e589c SOURCES/watchdog-5.13.tar.gz diff --git a/SOURCES/0001-watchdog-Clearer-help-output.patch b/SOURCES/0001-watchdog-Clearer-help-output.patch new file mode 100644 index 0000000..eba527a --- /dev/null +++ b/SOURCES/0001-watchdog-Clearer-help-output.patch @@ -0,0 +1,54 @@ +From 2053c6f5f1c597637d4791af4c34eeac144e7802 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 16 May 2013 12:57:33 +0100 +Subject: [PATCH 1/2] watchdog: Clearer --help output. + +Document all the (non-obsolete) options in the --help output, +including long variants. + +The new output is: + +./src/watchdog: unrecognized option '--help' +watchdog version 5.13, usage: +watchdog [options] +options: + -F | --foreground run in foreground + -f | --force don't sanity-check config + -c | --config-file specify location of config file + -s | --sync sync filesystem + -b | --softboot soft-boot on error + -q | --no-action do not reboot or halt + -v | --verbose verbose messages +--- + src/watchdog.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/watchdog.c b/src/watchdog.c +index 6f93de8..2231f8a 100644 +--- a/src/watchdog.c ++++ b/src/watchdog.c +@@ -103,11 +103,17 @@ int mlocked = FALSE, realtime = FALSE; + static void usage(void) + { + fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); ++ fprintf(stderr, "%s [options]\n", progname); ++ fprintf(stderr, "options:\n"); ++ fprintf(stderr, " -F | --foreground run in foreground\n"); ++ fprintf(stderr, " -f | --force don't sanity-check config\n"); ++ fprintf(stderr, " -c | --config-file specify location of config file\n"); ++ fprintf(stderr, " -s | --sync sync filesystem\n"); ++ fprintf(stderr, " -b | --softboot soft-boot on error\n"); ++ fprintf(stderr, " -q | --no-action do not reboot or halt\n"); + #if USE_SYSLOG +- fprintf(stderr, "%s [-F] [-f] [-c ] [-v] [-s] [-b] [-q]\n", progname); +-#else /* USE_SYSLOG */ +- fprintf(stderr, "%s [-F] [-f] [-c ] [-s] [-b] [-q]\n", progname); +-#endif /* USE_SYSLOG */ ++ fprintf(stderr, " -v | --verbose verbose messages\n"); ++#endif + exit(1); + } + +-- +1.8.1.4 + diff --git a/SOURCES/0002-wd_identify-wd_keepalive-Document-c-config-file-in-h.patch b/SOURCES/0002-wd_identify-wd_keepalive-Document-c-config-file-in-h.patch new file mode 100644 index 0000000..29274d5 --- /dev/null +++ b/SOURCES/0002-wd_identify-wd_keepalive-Document-c-config-file-in-h.patch @@ -0,0 +1,40 @@ +From 1c5937a9f852293459f26813f3f166d6650af44f Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 16 May 2013 13:01:11 +0100 +Subject: [PATCH 2/2] wd_identify, wd_keepalive: Document -c/--config-file in + --help output. + +--- + src/wd_identify.c | 2 +- + src/wd_keepalive.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/wd_identify.c b/src/wd_identify.c +index 4eb71fd..41ba0ac 100644 +--- a/src/wd_identify.c ++++ b/src/wd_identify.c +@@ -31,7 +31,7 @@ char *devname = NULL, *progname = NULL; + static void usage(void) + { + fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); +- fprintf(stderr, "%s \n", progname); ++ fprintf(stderr, "%s [-c | --config-file ]\n", progname); + exit(1); + } + +diff --git a/src/wd_keepalive.c b/src/wd_keepalive.c +index 960036a..18e8698 100644 +--- a/src/wd_keepalive.c ++++ b/src/wd_keepalive.c +@@ -57,7 +57,7 @@ int mlocked = FALSE, realtime = FALSE; + static void usage(void) + { + fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); +- fprintf(stderr, "%s \n", progname); ++ fprintf(stderr, "%s [-c | --config-file ]\n", progname); + exit(1); + } + +-- +1.8.1.4 + diff --git a/SOURCES/0003-watchdog-5.13-rhsel.patch b/SOURCES/0003-watchdog-5.13-rhsel.patch new file mode 100644 index 0000000..7e8d6fd --- /dev/null +++ b/SOURCES/0003-watchdog-5.13-rhsel.patch @@ -0,0 +1,34 @@ +diff -up watchdog-5.13/src/test_binary.c.rhsel watchdog-5.13/src/test_binary.c +--- watchdog-5.13/src/test_binary.c.rhsel 2013-10-24 15:53:53.375647812 +0200 ++++ watchdog-5.13/src/test_binary.c 2013-10-24 15:54:05.201666469 +0200 +@@ -101,11 +101,11 @@ int check_bin(char *tbinary, time_t time + * to cause trouble, so make them go to their respective files */ + strcpy(filename_buf, logdir); + strcat(filename_buf, "/test-bin.stdout"); +- if (!freopen(filename_buf, "a+", stdout)) ++ if (!freopen(filename_buf, "a", stdout)) + exit (errno); + strcpy(filename_buf, logdir); + strcat(filename_buf, "/test-bin.stderr"); +- if (!freopen(filename_buf, "a+", stderr)) ++ if (!freopen(filename_buf, "a", stderr)) + exit (errno); + + /* now start binary */ +diff -up watchdog-5.13/src/watchdog.c.rhsel watchdog-5.13/src/watchdog.c +--- watchdog-5.13/src/watchdog.c.rhsel 2013-10-24 15:58:09.245051038 +0200 ++++ watchdog-5.13/src/watchdog.c 2013-10-24 15:58:15.958061605 +0200 +@@ -148,11 +148,11 @@ static int repair(char *rbinary, int res + * So make stdout and stderr go to their respective files */ + strcpy(filename_buf, logdir); + strcat(filename_buf, "/repair-bin.stdout"); +- if (!freopen(filename_buf, "a+", stdout)) ++ if (!freopen(filename_buf, "a", stdout)) + exit (errno); + strcpy(filename_buf, logdir); + strcat(filename_buf, "/repair-bin.stderr"); +- if (!freopen(filename_buf, "a+", stderr)) ++ if (!freopen(filename_buf, "a", stderr)) + exit (errno); + + /* now start binary */ diff --git a/SOURCES/0004-watchdog-5.13-rhseldoc.patch b/SOURCES/0004-watchdog-5.13-rhseldoc.patch new file mode 100644 index 0000000..ef9969c --- /dev/null +++ b/SOURCES/0004-watchdog-5.13-rhseldoc.patch @@ -0,0 +1,137 @@ +diff -up ./watchdog.8.rhseldoc ./watchdog.8 +--- ./watchdog.8.rhseldoc 2013-02-01 12:15:44.000000000 +0100 ++++ ./watchdog.8 2013-11-07 14:57:52.460258672 +0100 +@@ -190,6 +190,7 @@ by + .BR watchdog . + So you can for instance restart the server from your + .IR repair-binary . ++See the Systemd section below for additinal information. + .PP + .B watchdog + will try periodically to fork itself to see whether the process +@@ -216,6 +217,8 @@ a given interface for traffic. If no tra + considered unreachable causing a soft reboot or action from the + repair binary. + .PP ++To start the watchdog when network is available see the Systemd section below. ++.PP + .B watchdog can run an external command for user-defined tests. A return code + not equal 0 means an error occured and watchdog should react. If the external + command is killed by an uncaught signal this is considered an error by watchdog +@@ -317,6 +320,9 @@ Child process did not return in time. + .TP + \-10 + Free for personal use. ++.PP ++With enforcing SELinux policy please use the /usr/libexec/watchdog/scripts/ ++for your test-binary configuration. + .SH "REPAIR BINARY" + The repair binary is started with one parameter: the error number that + caused +@@ -333,6 +339,9 @@ are using the real-time properties since + .B watchdog + will wait for + the return of this binary before proceeding. ++.PP ++With enforcing SELinux policy please use the /usr/libexec/watchdog/scripts/ ++for your repair-binary configuration. + .SH "TEST DIRECTORY" + Executables placed in the test directory are discovered by watchdog on + startup and are automatically executed. They are bounded time-wise by +@@ -365,6 +374,27 @@ return a non-zero value so the machine w + Note that the watchdog daemon may interpret and act upon any of the reserved + return codes noted in the Check Binary section prior to calling a given + command in "repair" mode. ++.SH SYSTEMD ++To start watchdog after the network is available: ++.PP ++.br ++systemctl disable watchdog ++.br ++systemctl enable NetworkManager-wait-online ++.br ++systemctl enable watchdog-ping ++.PP ++ ++When using custom service pid check with custom service ++systemd unit file please be aware the "Requires=" ++does dependent service deactivation. ++Using "Before=watchdog.service" or "Before=watchdog-ping.service" ++in the custom service unit file may be the desired operation instead. ++See systemd.unit documentation for more details. ++ ++.SH SELINUX ++The directories /etc/watchdog.d/ and /usr/libexec/watchdog/scripts/ are ++recognized locations for custom executables. + .SH BUGS + None known so far. + .SH AUTHORS +@@ -383,4 +413,4 @@ The watchdog device. + The pid file of the running + .BR watchdog . + .SH "SEE ALSO" +-.BR watchdog.conf (5) ++.BR watchdog.conf (5), systemd.unit (5) +diff -up ./watchdog.conf.5.rhseldoc ./watchdog.conf.5 +--- ./watchdog.conf.5.rhseldoc 2013-02-01 12:15:44.000000000 +0100 ++++ ./watchdog.conf.5 2013-11-07 14:51:20.358128245 +0100 +@@ -84,6 +84,7 @@ no matter what. + pidfile = + Set pidfile name for server test mode. + This option can be given as often as you like to check several servers. ++See the Systemd section in watchdog (8) for more information. + .TP + ping = + Set IP address for ping mode. +@@ -97,6 +98,8 @@ interfaces. + .TP + test-binary = + Execute the given binary to do some user defined tests. ++With enforcing SELinux policy please use the /usr/libexec/watchdog/scripts/ ++for your test-binary configuration. + .TP + test-timeout = + User defined tests may only run for seconds. Set to 0 for unlimited. +@@ -104,6 +107,8 @@ User defined tests may only run for + Execute the given binary in case of a problem instead of shutting down the + system. ++With enforcing SELinux policy please use the /usr/libexec/watchdog/scripts/ ++for your repair-binary configuration. + .TP + repair-timeout = + repair command may only run for seconds. Set to 0 for unlimited. +@@ -122,6 +127,7 @@ Set the schedule priority for realtime m + .TP + test-directory = + Set the directory to run user test/repair scripts. Default is '/etc/watchdog.d' ++The /etc/watchdog.d/ is recognized by SELinux policy. + See the Test Directory section in watchdog(8) for more information. + .TP + log-dir = +diff -up ./watchdog.conf.rhseldoc ./watchdog.conf +--- ./watchdog.conf.rhseldoc 2013-02-01 12:15:44.000000000 +0100 ++++ ./watchdog.conf 2013-11-07 14:47:49.955156208 +0100 +@@ -15,6 +15,8 @@ + # To get the real size, check how large the pagesize is on your machine. + #min-memory = 1 + ++# With enforcing SELinux policy please use the /usr/libexec/watchdog/scripts/ ++# or /etc/watchdog.d/ for your test-binary and repair-binary configuration. + #repair-binary = /usr/sbin/repair + #repair-timeout = + #test-binary = +@@ -37,6 +39,13 @@ + realtime = yes + priority = 1 + ++# When using custom service pid check with custom service ++# systemd unit file please be aware the "Requires=" ++# does dependent service deactivation. ++# Using "Before=watchdog.service" or "Before=watchdog-ping.service" ++# in the custom service unit file may be the desired operation instead. ++# See man 5 systemd.unit for more details. ++# + # Check if rsyslogd is still running by enabling the following line + #pidfile = /var/run/rsyslogd.pid + diff --git a/SOURCES/README.Fedora b/SOURCES/README.Fedora new file mode 100644 index 0000000..e51e053 --- /dev/null +++ b/SOURCES/README.Fedora @@ -0,0 +1,34 @@ +This is the watchdog package for Fedora. It implements a userspace +daemon which periodically pings (usually hardware) to tell the +hardware that the machine is alive. If the hardware times out without +receiving a ping, it assumes userspace is dead and reboots the +machine. + +There are several major classes of watchdog available: + + - watchdog hardware implementing the Linux /dev/watchdog API + + * drivers in /lib/modules/$(uname -r)/kernel/drivers/watchdog/ + * http://lxr.linux.no/linux/Documentation/watchdog/watchdog-api.txt + + - softdog + + * software watchdog (just runs inside the kernel) + * implements the Linux /dev/watchdog API + * won't help you if the kernel fails (obvious, right?) + + - IPMI + + * a heavyweight standard for all things server-management + * separate Linux driver + * ipmitool to control it + * see README.watchdog.ipmi for how to use this daemon together + with IPMI + +You can also use watchdogs inside recent QEMU/KVM virtual machines. +When running qemu, specify "-watchdog i6300esb" on the qemu command +line (or use libvirt). Inside the guest, the i6300esb watchdog driver +should automatically load and provide you with a Linux /dev/watchdog- +compatible API. + + - Richard W.M. Jones (rjones@redhat.com) 2009-02-26 diff --git a/SOURCES/README.watchdog.ipmi b/SOURCES/README.watchdog.ipmi new file mode 100644 index 0000000..4a83238 --- /dev/null +++ b/SOURCES/README.watchdog.ipmi @@ -0,0 +1,107 @@ + +Instructions for how to set up the watchdog daemon to work with IPMI's hardware watchdog +---------------------------------------------------------------------------------------- + +First, verify that the ipmitool utility is present on the system to allow +the watchdog timer to be turned off via the command line (which ipmitool). +This will allow the hardware watchdog timer to be turned off gracefully +should it ever become necessary. If ipmitool is not present, install +it or download the latest version from http://ipmitool.sourceforge.net and +build and install it on your system. + +Next, prior to starting up the watchdog daemon, the BMC BIOS should be set +to enable the IPMI/BMC hardware watchdog timer, the OpenIPMI watchdog driver +module should be inserted with the desired configuration/startup settings, +and the watchdog daemon's configuration file should be modified to use /dev/watchdog: + + 1. To setup the IPMI/BMC BIOS to enable the hardware watchdog + timer, see BMC documentation. The main settings in the BMC BIOS + requiring modification to turn on the IPMI watchdog timer are: + + - Set the BMC POST Watchdog to "ENABLED". + - Set the BMC POST Watchdog Timeout to "5 Minutes". + + 2. To insert the OpenIPMI watchdog driver module with the + desired configuration settings, two steps are necessary: + + i.) Configure the OpenIPMI watchdog driver by editing the + /etc/sysconfig/ipmi configuration file: + + - Set "IPMI_WATCHDOG=yes". + - Set desired options via the IPMI_WATCHDOG_OPTIONS + config entry. + + EXAMPLE: 'IPMI_WATCHDOG_OPTIONS="timeout=60 start_now=1 \ + preop=preop_give_data action=power_cycle pretimeout=1" ' + + Execute "modinfo ipmi_watchdog" for more detailed information + on the available ipmi watchdog timer options. + + - Execute "service ipmi start" (the watchdog driver starts + automatically along with the other ipmi drivers). + + IMPORTANT: If "start_now=1" has been set as one of the + configuration options, be sure to start up the watchdog + daemon before the BMC timer expires! + + ii.) Set the OpenIPMI daemon and watchdog to start during bootup: + + - chkconfig ipmi on + - chkconfig watchdog on + + + 3. Configure the watchdog daemon by editing the + /etc/watchdog.conf configuration file: + + - Uncomment the "watchdog-device = /dev/watchdog" line. + - Ensure that "realtime = yes" and "priority = 1" are set and not + commented-out. + - Uncomment the "interval" line, and set the interval to be less + than what you set the timeout option to be in the /etc/sysconfig/ipmi + file (ex "timeout=60" so you might set interval to 50). + + So in the example described herein, the BMC BIOS setting is in + minutes (5), and the "interval" and ipmi_watchdog "timeout" settings + are both in seconds (50 and 60 respectively). Therefore, the BMC + hardware watchdog timer is set to expire and trigger a system power + cycle unless reset by the watchdog daemon within 5 minutes, and the + watchdog daemon will reset the timer every 60 seconds. + + + 4. Start the Watchdog daemon: + + - execute "service watchdog start" + + +IMPORTANT: To gracefully stop/kill the watchdog daemon, be sure +to use "service watchdog stop" (which executes "kill -s SIGTERM ") +and do *not* use "kill -9 ". Using "kill -9 " will cause the +daemon to be shut off without stopping the BMC's watchdog timer, thus +a system reboot will be triggered when the BMC's watchdog timer expires. + +Alternately, or in case the watchdog daemon is killed "ungracefully", +you can stop the BMC timer by executing the following ipmitool utility +command before the watchdog timer expires: + + # ipmitool -v raw 0x06 0x24 0x04 0x01 0x00 0x10 0x00 0x0a + +---------------------------------------------------------------------- + +To test the watchdog after system configuration and setup: + +. Use kill -9 on the watchdog daemon so it doesn't shut down the watchdog daemon + gracefully. Verify that the system gets reset after the BMC timer expires. + +. Use "service watchdog stop" and verify that the watchdog daemon shuts off + the BMC watchdog timer gracefully (the system doesn't get reset). + +. Set the timer on the watchdog daemon to be greater than the time set in + the BMC BIOS for system reset and verify that the system is reset. + +. Set the timer on the daemon to be less than the time set in the + BMC timer and verify that the BMC watchdog is poked regularly and the + system is not reset. + +. Test some of the other actions the BMC can take when the watchdog timer + goes off (see modinfo ipmi_watchdog for some other settings to try). + diff --git a/SOURCES/watchdog-ping.service b/SOURCES/watchdog-ping.service new file mode 100644 index 0000000..1ae93b1 --- /dev/null +++ b/SOURCES/watchdog-ping.service @@ -0,0 +1,11 @@ +[Unit] +Description=watchdog daemon for use with ping test / network dependency +After=network.target +Conflicts=watchdog.service + +[Service] +Type=forking +ExecStart=/usr/sbin/watchdog + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/watchdog.init b/SOURCES/watchdog.init new file mode 100644 index 0000000..3c5cf6a --- /dev/null +++ b/SOURCES/watchdog.init @@ -0,0 +1,91 @@ +#! /bin/sh +# +# watchdog - a watchdog daemon +# +# chkconfig: - 27 46 +# description: A watchdog daemon +# +# rc file author: Marc Merlin +# Henning P. Schmiedehausen +# Richard W.M. Jones + +# Source function library. +. /etc/rc.d/init.d/functions + +[ -x /usr/sbin/watchdog -a -e /etc/watchdog.conf ] || exit 0 + +VERBOSE="no" +if [ -f /etc/sysconfig/watchdog ]; then + . /etc/sysconfig/watchdog +fi + +RETVAL=0 +prog=watchdog +pidfile=/var/run/watchdog.pid +lockfile=/var/lock/subsys/watchdog + +start() { + + echo -n $"Starting $prog: " + if [ -n "$(pidofproc $prog)" ]; then + echo -n $"$prog: already running" + echo_failure + echo + return 1 + fi + if [ "$VERBOSE" = "yes" ]; then + daemon /usr/sbin/${prog} -v + else + daemon /usr/sbin/${prog} + fi + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $lockfile + [ $RETVAL -eq 0 ] && echo_success + [ $RETVAL -ne 0 ] && echo_failure + return $RETVAL +} + +stop() { + echo -n "Stopping $prog: " + # We are forcing it to _only_ use -TERM as killproc could use + # -KILL which would result in BMC timer not being set properly + # and reboot the box. + killproc $prog -TERM + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile + return $RETVAL +} + +restart() { + stop + sleep 6 + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + reload|restart) + restart + ;; + condrestart) + if [ -f $lockfile ]; then + restart + fi + ;; + status) + status $prog + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|status|condrestart}" + exit 1 +esac + +exit $RETVAL diff --git a/SOURCES/watchdog.service b/SOURCES/watchdog.service new file mode 100644 index 0000000..ad141a2 --- /dev/null +++ b/SOURCES/watchdog.service @@ -0,0 +1,13 @@ +[Unit] +Description=watchdog daemon +Wants=ipmi.service +After=ipmi.service +# man systemd.special +# auto added After=basic.target + +[Service] +Type=forking +ExecStart=/usr/sbin/watchdog + +[Install] +WantedBy=multi-user.target diff --git a/SPECS/watchdog.spec b/SPECS/watchdog.spec new file mode 100644 index 0000000..1140609 --- /dev/null +++ b/SPECS/watchdog.spec @@ -0,0 +1,243 @@ +%define _hardened_build 1 +Summary: Software and/or Hardware watchdog daemon +Name: watchdog +Version: 5.13 +Release: 12%{?dist} +License: GPLv2+ + +URL: http://sourceforge.net/projects/watchdog/ +Source0: http://downloads.sourceforge.net/watchdog/watchdog-%{version}.tar.gz +Source1: watchdog.init +Source2: README.watchdog.ipmi +Source3: README.Fedora +Source4: watchdog.service +Source5: watchdog-ping.service + +# Documentation fixes (RHBZ#948883). +# Sent upstream on 2013-05-16. +Patch1: 0001-watchdog-Clearer-help-output.patch +Patch2: 0002-wd_identify-wd_keepalive-Document-c-config-file-in-h.patch +Patch3: 0003-watchdog-5.13-rhsel.patch +Patch4: 0004-watchdog-5.13-rhseldoc.patch + +BuildRequires: systemd-units + +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units + + +%description +The watchdog program can be used as a powerful software watchdog daemon +or may be alternately used with a hardware watchdog device such as the +IPMI hardware watchdog driver interface to a resident Baseboard +Management Controller (BMC). watchdog periodically writes to /dev/watchdog; +the interval between writes to /dev/watchdog is configurable through settings +in the watchdog sysconfig file. This configuration file is also used to +set the watchdog to be used as a hardware watchdog instead of its default +software watchdog operation. In either case, if the device is open but not +written to within the configured time period, the watchdog timer expiration +will trigger a machine reboot. When operating as a software watchdog, the +ability to reboot will depend on the state of the machine and interrupts. +When operating as a hardware watchdog, the machine will experience a hard +reset (or whatever action was configured to be taken upon watchdog timer +expiration) initiated by the BMC. + + +%prep +%setup -q -n %{name}-%{version} +%patch1 -p1 -b .help +%patch2 -p1 -b .keepalive +%patch3 -p1 -b .rhsel +%patch4 -p1 -b .rhseldoc + +cp %{SOURCE2} . +cp %{SOURCE3} . +%if 0%{?rhel} +mv README.Fedora README.RHEL +%endif + +mv README README.orig +iconv -f ISO-8859-1 -t UTF-8 < README.orig > README + + +%build +%configure +make %{?_smp_mflags} + + +%install +install -d -m0755 ${RPM_BUILD_ROOT}%{_sysconfdir} +install -d -m0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/watchdog.d +make DESTDIR=${RPM_BUILD_ROOT} install +install -Dp -m0644 %{name}.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/watchdog +install -Dp -m0644 %{SOURCE4} ${RPM_BUILD_ROOT}%{_unitdir}/watchdog.service +install -Dp -m0644 %{SOURCE5} ${RPM_BUILD_ROOT}%{_unitdir}/watchdog-ping.service +install -Dd -m0755 ${RPM_BUILD_ROOT}%{_libexecdir}/watchdog/scripts + + +%post +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi + + +%preun +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable watchdog.service > /dev/null 2>&1 || : + /bin/systemctl --no-reload disable watchdog-ping.service > /dev/null 2>&1 || : + /bin/systemctl stop watchdog.service > /dev/null 2>&1 || : + /bin/systemctl stop watchdog-ping.service > /dev/null 2>&1 || : +fi + + +%postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart watchdog.service >/dev/null 2>&1 || : + /bin/systemctl try-restart watchdog-ping.service >/dev/null 2>&1 || : +fi + +%triggerun -- watchdog < 5.9-4 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply watchdog +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save watchdog >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/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 +%if 0%{?rhel} +%doc README.RHEL +%else +%doc README.Fedora +%endif +%config(noreplace) %{_sysconfdir}/watchdog.conf +%config(noreplace) %{_sysconfdir}/sysconfig/watchdog +%{_sysconfdir}/watchdog.d +%{_sbindir}/watchdog +%{_sbindir}/wd_identify +%{_sbindir}/wd_keepalive +%{_mandir}/man5/watchdog.conf.5* +%{_mandir}/man8/watchdog.8* +%{_mandir}/man8/wd_identify.8* +%{_mandir}/man8/wd_keepalive.8* +%{_unitdir}/watchdog.service +%{_unitdir}/watchdog-ping.service +%{_libexecdir}/watchdog/scripts + + +%changelog +* Tue Jun 19 2018 Josef Ridky - 5.13-12 +- Resolves: #1092523 - add PIE and RELRO check +- Resolves: #1133135 - add ipmi.service dependency to watchdog.service file +- Resolves: #1259816 - remove deprecated stanza in unit files + +* Fri Jan 24 2014 Daniel Mach - 5.13-11 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 5.13-10 +- Mass rebuild 2013-12-27 + +* Thu Nov 7 2013 Ales Ledvinka - 5.13-9 +- SELinux: Add /usr/libexec/watchdog/scripts/ for test-bin and repair-bin to inherit from. +- systemd: service with network available dependency +- systemd: correct cgroup for realtime settings +- Document SELinux and systemd. + +* Thu Oct 24 2013 Ales Ledvinka - 5.13-5 +- SELinux: do not reopen descriptors for reading when only appending. + +* Fri Aug 9 2013 Richard W.M. Jones - 5.13-4 +- Fix License field (software is GPLv2+, not "GPL+"). + +* Thu Aug 8 2013 Richard W.M. Jones - 5.13-3 +- Rename README.Fedora to README.RHEL on RHEL. + +* Tue Jul 30 2013 Richard W.M. Jones - 5.13-2 +- Enable /etc/watchdog.d directory for storing test binaries + (RHBZ#657750, RHBZ#831190). +- Missing BR systemd-units. +- Update .gitignore. +- Drop Group line, not required by modern RPM. + +* Thu May 16 2013 Richard W.M. Jones - 5.13-1 +- New upstream version 5.13. +- Various documentation fixes (RHBZ#948883). + +* Fri Feb 15 2013 Fedora Release Engineering - 5.12-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sun Jul 22 2012 Fedora Release Engineering - 5.12-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jul 06 2012 Richard W.M. Jones - 5.12-1 +- New upstream version 5.12 (RHBZ#837949). +- Bring specfile up to modern standards. +- Remove commented sections from previous commit. +- Remove both patches (equivalent changes now upstream). + +* Wed Mar 14 2012 Jon Ciesla - 5.9-4 +- Migrate to systemd, BZ 661220. + +* Sat Jan 14 2012 Fedora Release Engineering - 5.9-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Feb 07 2011 Fedora Release Engineering - 5.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jan 17 2011 Richard W.M. Jones - 5.9-1 +- New upstream version 5.9 (RHBZ#645541). +- Package new wd_identify program. +- Drop old cleanup patch, most of it is now upstream. +- Add newer cleanup patch, sent upstream. +- Fix some problems with the initscript (RHBZ#523391). +- Add systemd service (file installed but not used) (RHBZ#661220). + +* Wed Jan 13 2010 Richard W.M. Jones - 5.5-7 +- Fix Source0 URL. + +* Mon Jul 27 2009 Fedora Release Engineering - 5.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Fri Mar 13 2009 Richard W.M. Jones - 5.5-5 +- Updated the cleanup patch and sent upstream. + +* Fri Mar 13 2009 Richard W.M. Jones - 5.5-3 +- Remove dubious "cleanup-nfs" patch. + +* Thu Mar 5 2009 Richard W.M. Jones - 5.5-2 +- Use '-' in defattr line instead of explicit file mode. + +* Thu Feb 26 2009 Richard W.M. Jones - 5.5-1 +- New upstream version 5.5. +- Prepared the package for Fedora review. + +* Mon Jun 11 2007 Lon Hohberger - 5.3.1-7 +- Rebuild for RHEL5 Update 1 - Resolves: 227401 + +* Wed May 30 2007 Konrad Rzeszutek - 5.3.1-6 +- Fixed the init script file. + +* Tue May 29 2007 Konrad Rzeszutek - 5.3.1-5 +- Fixed a compile warning in nfsmount_xdr file. + +* Wed May 23 2007 Konrad Rzeszutek - 5.3.1-4 +- Fixed rpmlint warnings. + +* Wed May 16 2007 Konrad Rzeszutek - 5.3.1-3 +- Changes to spec, init script and README file per Carol Hebert recommendation. + +* Thu Apr 19 2007 Konrad Rzeszutek - 5.3.1-2 +- Added README.watchdog.ipmi + +* Mon Apr 16 2007 Konrad Rzeszutek - 5.3.1-1 +- Initial copy.