From ac9baefef014caa827620d41263a6a40281ce765 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 17 Jan 2011 13:54:42 +0000 Subject: [PATCH] - 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). --- .gitignore | 1 + sources | 2 +- watchdog-5.5-cleanup.patch | 419 -------------------- watchdog-5.9-cleanups.patch | 70 ++++ watchdog-5.9-write-warn-unused-result.patch | 28 ++ watchdog.init | 11 +- watchdog.service | 10 + watchdog.spec | 30 +- 8 files changed, 143 insertions(+), 428 deletions(-) delete mode 100644 watchdog-5.5-cleanup.patch create mode 100644 watchdog-5.9-cleanups.patch create mode 100644 watchdog-5.9-write-warn-unused-result.patch create mode 100644 watchdog.service diff --git a/.gitignore b/.gitignore index b65cc05..ad7b606 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ watchdog-5.5.tar.gz +/watchdog-5.9.tar.gz diff --git a/sources b/sources index ee5a4d5..00a1aca 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -f4fbb3465bdc0d0ac27bdd2972f7f469 watchdog-5.5.tar.gz +d7cae3c9829f5d9a680764f314234867 watchdog-5.9.tar.gz diff --git a/watchdog-5.5-cleanup.patch b/watchdog-5.5-cleanup.patch deleted file mode 100644 index 9273fa0..0000000 --- a/watchdog-5.5-cleanup.patch +++ /dev/null @@ -1,419 +0,0 @@ -diff -ur watchdog-5.5.orig/include/extern.h watchdog-5.5.cleanup/include/extern.h ---- watchdog-5.5.orig/include/extern.h 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/include/extern.h 2009-03-13 10:34:52.000000000 +0000 -@@ -48,8 +48,12 @@ - #define MAXICMPLEN 76 - #define MAXPACKET (65536 - 60 - 8) /* max packet size */ - -+#ifndef TRUE - #define TRUE 1 -+#endif -+#ifndef FALSE - #define FALSE 0 -+#endif - - #define TS_SIZE 12 - -diff -ur watchdog-5.5.orig/src/iface.c watchdog-5.5.cleanup/src/iface.c ---- watchdog-5.5.orig/src/iface.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/iface.c 2009-03-13 10:21:43.000000000 +0000 -@@ -66,7 +66,7 @@ - #if USE_SYSLOG - /* do verbose logging */ - if (verbose && logtick && ticker == 1) -- syslog(LOG_INFO, "device %s received %u bytes", dev->name, bytes); -+ syslog(LOG_INFO, "device %s received %lu bytes", dev->name, bytes); - #endif - - if (dev->parameter.iface.bytes == bytes) { -diff -ur watchdog-5.5.orig/src/keep_alive.c watchdog-5.5.cleanup/src/keep_alive.c ---- watchdog-5.5.orig/src/keep_alive.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/keep_alive.c 2009-03-13 10:40:32.000000000 +0000 -@@ -20,7 +20,6 @@ - struct tm *tm; - char tbuf[TS_SIZE + 1]; - char tbufw[TS_SIZE + 1]; -- int i; - - if (hb == NULL) - return (ENOERR); -@@ -41,7 +40,8 @@ - // success - if (nrts < hbstamps) - nrts++; -- lastts = ++lastts % hbstamps; -+ ++lastts; -+ lastts = lastts % hbstamps; - - // write the buffer to the file - rewind(hb); -diff -ur watchdog-5.5.orig/src/lomount.c watchdog-5.5.cleanup/src/lomount.c ---- watchdog-5.5.orig/src/lomount.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/lomount.c 2009-03-13 10:24:55.000000000 +0000 -@@ -195,13 +195,13 @@ - break; - case LO_CRYPT_XOR: - pass = getpass ("Password: "); -- strncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE); -+ strncpy ((char *) loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE); - loopinfo.lo_encrypt_key[LO_KEY_SIZE - 1] = 0; -- loopinfo.lo_encrypt_key_size = strlen (loopinfo.lo_encrypt_key); -+ loopinfo.lo_encrypt_key_size = (int) strlen ((char *) loopinfo.lo_encrypt_key); - break; - case LO_CRYPT_DES: - pass = getpass ("Password: "); -- strncpy (loopinfo.lo_encrypt_key, pass, 8); -+ strncpy ((char *) loopinfo.lo_encrypt_key, pass, 8); - loopinfo.lo_encrypt_key[8] = 0; - loopinfo.lo_encrypt_key_size = 8; - pass = getpass ("Init (up to 16 hex digits): "); -diff -ur watchdog-5.5.orig/src/mntent.c watchdog-5.5.cleanup/src/mntent.c ---- watchdog-5.5.orig/src/mntent.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/mntent.c 2009-03-13 10:25:47.000000000 +0000 -@@ -21,11 +21,11 @@ - static char need_escaping[] = { ' ', '\t', '\n', '\\' }; - - static char * --mangle(unsigned char *s) { -+mangle(const char *s) { - char *ss, *sp; - int n; - -- n = strlen(s); -+ n = (int) strlen(s); - ss = sp = xmalloc(4*n+1); - while(1) { - for (n = 0; n < sizeof(need_escaping); n++) { -diff -ur watchdog-5.5.orig/src/net.c watchdog-5.5.cleanup/src/net.c ---- watchdog-5.5.orig/src/net.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/net.c 2009-03-13 10:28:09.000000000 +0000 -@@ -57,7 +57,9 @@ - for (i = 0; i < count; i++) { - - struct sockaddr_in from; -- int fromlen, fdmask, j; -+ int fdmask, j; -+ int *fdmask_p; -+ socklen_t fromlen; - struct timeval timeout, dtimeout; - struct icmphdr *icp = (struct icmphdr *) outpack; - -@@ -119,10 +121,11 @@ - break; - #if USE_SYSLOG - if (verbose && logtick && ticker == 1) -- syslog(LOG_ERR, "ping select timeout = %d seconds and %d useconds\n", dtimeout.tv_sec, dtimeout.tv_usec); -+ syslog(LOG_ERR, "ping select timeout = %ld seconds and %ld useconds\n", dtimeout.tv_sec, dtimeout.tv_usec); - #endif /* USE_SYSLOG */ -+ fdmask_p = &fdmask; - -- if (select(sock_fp + 1, (fd_set *) & fdmask, (fd_set *) NULL, -+ if (select(sock_fp + 1, (fd_set *) fdmask_p, (fd_set *) NULL, - (fd_set *) NULL, &dtimeout) >= 1) { - - /* read reply */ -diff -ur watchdog-5.5.orig/src/nfsmount.c watchdog-5.5.cleanup/src/nfsmount.c ---- watchdog-5.5.orig/src/nfsmount.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/nfsmount.c 2009-03-13 10:28:33.000000000 +0000 -@@ -48,6 +48,7 @@ - #include - #include - #include -+#include - - #include "sundries.h" - #include "nfsmount.h" -diff -ur watchdog-5.5.orig/src/nfsmount_xdr.c watchdog-5.5.cleanup/src/nfsmount_xdr.c ---- watchdog-5.5.orig/src/nfsmount_xdr.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/nfsmount_xdr.c 2009-03-13 10:29:31.000000000 +0000 -@@ -43,8 +43,6 @@ - bool_t - xdr_fhandle (XDR *xdrs, fhandle objp) - { -- register int32_t *buf; -- - if (!xdr_opaque (xdrs, objp, FHSIZE)) - return FALSE; - return TRUE; -@@ -53,8 +51,6 @@ - bool_t - xdr_fhandle3 (XDR *xdrs, fhandle3 *objp) - { -- register int32_t *buf; -- - if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, FHSIZE3)) - return FALSE; - return TRUE; -@@ -63,8 +59,6 @@ - bool_t - xdr_mountstat3 (XDR *xdrs, mountstat3 *objp) - { -- register int32_t *buf; -- - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -@@ -73,8 +67,6 @@ - bool_t - xdr_fhstatus (XDR *xdrs, fhstatus *objp) - { -- register int32_t *buf; -- - if (!xdr_u_int (xdrs, &objp->fhs_status)) - return FALSE; - switch (objp->fhs_status) { -@@ -91,8 +83,6 @@ - bool_t - xdr_mountres3_ok (XDR *xdrs, mountres3_ok *objp) - { -- register int32_t *buf; -- - if (!xdr_fhandle3 (xdrs, &objp->fhandle)) - return FALSE; - if (!xdr_array (xdrs, (char **)&objp->auth_flavours.auth_flavours_val, (u_int *) &objp->auth_flavours.auth_flavours_len, ~0, -@@ -104,8 +94,6 @@ - bool_t - xdr_mountres3 (XDR *xdrs, mountres3 *objp) - { -- register int32_t *buf; -- - if (!xdr_mountstat3 (xdrs, &objp->fhs_status)) - return FALSE; - switch (objp->fhs_status) { -@@ -122,8 +110,6 @@ - bool_t - xdr_dirpath (XDR *xdrs, dirpath *objp) - { -- register int32_t *buf; -- - if (!xdr_string (xdrs, objp, MNTPATHLEN)) - return FALSE; - return TRUE; -@@ -132,8 +118,6 @@ - bool_t - xdr_name (XDR *xdrs, name *objp) - { -- register int32_t *buf; -- - if (!xdr_string (xdrs, objp, MNTNAMLEN)) - return FALSE; - return TRUE; -@@ -142,8 +126,6 @@ - bool_t - xdr_mountlist (XDR *xdrs, mountlist *objp) - { -- register int32_t *buf; -- - if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody)) - return FALSE; - return TRUE; -@@ -152,8 +134,6 @@ - bool_t - xdr_mountbody (XDR *xdrs, mountbody *objp) - { -- register int32_t *buf; -- - if (!xdr_name (xdrs, &objp->ml_hostname)) - return FALSE; - if (!xdr_dirpath (xdrs, &objp->ml_directory)) -@@ -166,8 +146,6 @@ - bool_t - xdr_groups (XDR *xdrs, groups *objp) - { -- register int32_t *buf; -- - if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode)) - return FALSE; - return TRUE; -@@ -176,8 +154,6 @@ - bool_t - xdr_groupnode (XDR *xdrs, groupnode *objp) - { -- register int32_t *buf; -- - if (!xdr_name (xdrs, &objp->gr_name)) - return FALSE; - if (!xdr_groups (xdrs, &objp->gr_next)) -@@ -188,8 +164,6 @@ - bool_t - xdr_exports (XDR *xdrs, exports *objp) - { -- register int32_t *buf; -- - if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode)) - return FALSE; - return TRUE; -@@ -198,8 +172,6 @@ - bool_t - xdr_exportnode (XDR *xdrs, exportnode *objp) - { -- register int32_t *buf; -- - if (!xdr_dirpath (xdrs, &objp->ex_dir)) - return FALSE; - if (!xdr_groups (xdrs, &objp->ex_groups)) -diff -ur watchdog-5.5.orig/src/pidfile.c watchdog-5.5.cleanup/src/pidfile.c ---- watchdog-5.5.orig/src/pidfile.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/pidfile.c 2009-03-13 10:30:08.000000000 +0000 -@@ -6,6 +6,10 @@ - - #include - #include -+#include -+#include -+#include -+ - #include "extern.h" - #include "watch_err.h" - -diff -ur watchdog-5.5.orig/src/shutdown.c watchdog-5.5.cleanup/src/shutdown.c ---- watchdog-5.5.orig/src/shutdown.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/shutdown.c 2009-03-13 10:35:53.000000000 +0000 -@@ -4,6 +4,9 @@ - #include "config.h" - #endif - -+#define _XOPEN_SOURCE 500 /* for getsid(2) */ -+#define _BSD_SOURCE /* for acct(2) */ -+ - #include - #include - #include -@@ -18,6 +21,10 @@ - #include - #include - #include -+#include -+#include -+#include -+#include /* for caddr_t */ - - #include "watch_err.h" - #include "extern.h" -@@ -320,6 +327,7 @@ - void do_shutdown(int errorcode) - { - int i = 0, fd; -+ size_t write_len; - char *seedbck = RANDOM_SEED; - - /* soft-boot the system */ -@@ -338,7 +346,7 @@ - * We cannot let the shell check, because a non-existant or - * non-executable sendmail binary means that the pipe is closed faster - * than we can write to it. */ -- if ((stat(PATH_SENDMAIL, &buf) != 0) || (buf.st_mode&S_IXUSR == 0)) -+ if ((stat(PATH_SENDMAIL, &buf) != 0) || ((buf.st_mode&S_IXUSR) == 0)) - #if USE_SYSLOG - syslog(LOG_ERR, "%s does not exist or is not executable (errno = %d)", PATH_SENDMAIL, errno); - #endif /* USE_SYSLOG */ -@@ -438,7 +446,7 @@ - wtmp.ut_pid = 0; - wtmp.ut_type = RUN_LVL; - wtmp.ut_time = t; -- write(fd, (char *) &wtmp, sizeof(wtmp)); -+ write_len = write(fd, (char *) &wtmp, sizeof(wtmp)); - close(fd); - } - -@@ -454,7 +462,7 @@ - char buf[512]; - - if (read(fd_seed, buf, 512) == 512) -- write(fd_bck, buf, 512); -+ write_len = write(fd_bck, buf, 512); - close(fd_bck); - } - close(fd_seed); -diff -ur watchdog-5.5.orig/src/temp.c watchdog-5.5.cleanup/src/temp.c ---- watchdog-5.5.orig/src/temp.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/temp.c 2009-03-13 10:36:04.000000000 +0000 -@@ -31,7 +31,7 @@ - int err = errno; - - #if USE_SYSLOG -- syslog(LOG_ERR, "read %s gave errno = %d = '%m'", err, tempname); -+ syslog(LOG_ERR, "read %s gave errno = %d = '%m'", tempname, err); - #else /* USE_SYSLOG */ - perror(progname); - #endif /* USE_SYSLOG */ -diff -ur watchdog-5.5.orig/src/test_binary.c watchdog-5.5.cleanup/src/test_binary.c ---- watchdog-5.5.orig/src/test_binary.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/test_binary.c 2009-03-13 10:36:58.000000000 +0000 -@@ -8,6 +8,8 @@ - #include - #include - #include -+#include -+ - #include "extern.h" - #include "watch_err.h" - -@@ -76,7 +78,7 @@ - res = check_processes(timeout); - if (res == ETOOLONG) { - #if USE_SYSLOG -- syslog(LOG_ERR, "test-binary %s exceeded time limit %d", tbinary, timeout); -+ syslog(LOG_ERR, "test-binary %s exceeded time limit %ld", tbinary, timeout); - #endif /* USE_SYSLOG */ - return res; - } -diff -ur watchdog-5.5.orig/src/watchdog.c watchdog-5.5.cleanup/src/watchdog.c ---- watchdog-5.5.orig/src/watchdog.c 2009-02-25 11:12:59.000000000 +0000 -+++ watchdog-5.5.cleanup/src/watchdog.c 2009-03-13 10:42:44.000000000 +0000 -@@ -23,6 +23,8 @@ - #include - #include - #include -+#include -+#include - #define __USE_GNU - #include - -@@ -619,7 +621,7 @@ - /* Log the starting message */ - openlog(progname, LOG_PID, LOG_DAEMON); - syslog(LOG_INFO, "starting daemon (%d.%d):", MAJOR_VERSION, MINOR_VERSION); -- syslog(LOG_INFO, "int=%ds realtime=%s sync=%s soft=%s mla=%d mem=%ld", -+ syslog(LOG_INFO, "int=%ds realtime=%s sync=%s soft=%s mla=%d mem=%d", - tint, - realtime ? "yes" : "no", - sync_it ? "yes" : "no", -@@ -650,7 +652,7 @@ - for (act = iface; act != NULL; act = act->next) - syslog(LOG_INFO, "interface: %s", act->name); - -- syslog(LOG_INFO, "test=%s(%d) repair=%s alive=%s heartbeat=%s temp=%s to=%s no_act=%s", -+ syslog(LOG_INFO, "test=%s(%ld) repair=%s alive=%s heartbeat=%s temp=%s to=%s no_act=%s", - (tbinary == NULL) ? "none" : tbinary, timeout, - (rbinary == NULL) ? "none" : rbinary, - (devname == NULL) ? "none" : devname, -@@ -692,7 +694,7 @@ - /* Allocate memory for keeping the timestamps in */ - nrts = 0; - lastts = 0; -- timestamps = (unsigned char *) calloc(hbstamps, TS_SIZE); -+ timestamps = (char *) calloc(hbstamps, TS_SIZE); - if ( timestamps == NULL ) { - #if USE_SYSLOG - syslog(LOG_ERR, "cannot allocate memory for timestamps (errno = %d = '%m')", errno); -@@ -707,7 +709,8 @@ - memcpy(timestamps + (TS_SIZE * lastts), rbuf, TS_SIZE); - if (nrts < hbstamps) - nrts++; -- lastts = ++lastts % hbstamps; -+ ++lastts; -+ lastts = lastts % hbstamps; - } - /* Write an indication that the watchdog has started to the heartbeat file */ - /* copy it to the buffer */ -@@ -717,7 +720,8 @@ - // success - if (nrts < hbstamps) - nrts++; -- lastts = ++lastts % hbstamps; -+ ++lastts; -+ lastts = lastts % hbstamps; - - } - } diff --git a/watchdog-5.9-cleanups.patch b/watchdog-5.9-cleanups.patch new file mode 100644 index 0000000..28bd75c --- /dev/null +++ b/watchdog-5.9-cleanups.patch @@ -0,0 +1,70 @@ +diff -ur watchdog-5.9.old/src/watchdog.c watchdog-5.9.cleanups/src/watchdog.c +--- watchdog-5.9.old/src/watchdog.c 2010-06-16 14:45:51.000000000 +0100 ++++ watchdog-5.9.cleanups/src/watchdog.c 2011-01-17 13:53:22.268899519 +0000 +@@ -638,7 +638,7 @@ + * if the system runs out of memory */ + filename_buf = (char*)malloc(max(strlen(logdir) + sizeof("/repair-bin.stdout") + 1, strlen("/proc//oom_adj") + sizeof(int) * CHAR_BIT * 10 / 3 + 1)); + if (!filename_buf) { +- error(progname); ++ perror(progname); + exit(1); + } + +@@ -713,7 +713,7 @@ + for (act = iface; act != NULL; act = act->next) + syslog(LOG_INFO, "interface: %s", act->name); + +- syslog(LOG_INFO, "test=%s(%ld) repair=%s(%d) alive=%s heartbeat=%s temp=%s to=%s no_act=%s", ++ syslog(LOG_INFO, "test=%s(%ld) repair=%s(%ld) alive=%s heartbeat=%s temp=%s to=%s no_act=%s", + (tbinary == NULL) ? "none" : tbinary, timeout, + (rbinary == NULL) ? "none" : rbinary, rtimeout, + (devname == NULL) ? "none" : devname, +@@ -947,4 +947,5 @@ + + terminate(); + /* not reached */ ++ exit (EXIT_SUCCESS); + } +diff -ur watchdog-5.9.old/src/wd_identify.c watchdog-5.9.cleanups/src/wd_identify.c +--- watchdog-5.9.old/src/wd_identify.c 2010-06-17 16:21:06.000000000 +0100 ++++ watchdog-5.9.cleanups/src/wd_identify.c 2011-01-17 13:44:52.016374800 +0000 +@@ -20,6 +20,8 @@ + #include + #include + #include ++#include ++#include + + #define DEVICE "watchdog-device" + +@@ -125,10 +127,7 @@ + + int main(int argc, char *const argv[]) + { +- FILE *fp; + char *configfile = CONFIG_FILENAME; +- char *filename_buf; +- int count = 0; + int c; + struct watchdog_info ident; + char *opts = "c:"; +diff -ur watchdog-5.9.old/src/wd_keepalive.c watchdog-5.9.cleanups/src/wd_keepalive.c +--- watchdog-5.9.old/src/wd_keepalive.c 2010-06-16 14:45:49.000000000 +0100 ++++ watchdog-5.9.cleanups/src/wd_keepalive.c 2011-01-17 13:43:38.829707725 +0000 +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -286,7 +287,7 @@ + * if the system runs out of memory */ + filename_buf = (char*)malloc(strlen("/proc//oom_adj") + sizeof(int) * CHAR_BIT * 10 / 3 + 1); + if (!filename_buf) { +- error(progname); ++ perror(progname); + exit(1); + } + diff --git a/watchdog-5.9-write-warn-unused-result.patch b/watchdog-5.9-write-warn-unused-result.patch new file mode 100644 index 0000000..5a8b528 --- /dev/null +++ b/watchdog-5.9-write-warn-unused-result.patch @@ -0,0 +1,28 @@ +--- watchdog-5.9.old/src/shutdown.c 2010-03-06 21:06:51.000000000 +0000 ++++ watchdog-5.9.cleanups/src/shutdown.c 2011-01-17 13:41:57.623877045 +0000 +@@ -336,6 +336,7 @@ + void do_shutdown(int errorcode) + { + int i = 0, fd; ++ size_t write_len; + char *seedbck = RANDOM_SEED; + + /* soft-boot the system */ +@@ -459,7 +460,7 @@ + wtmp.ut_pid = 0; + wtmp.ut_type = RUN_LVL; + wtmp.ut_time = t; +- write(fd, (char *) &wtmp, sizeof(wtmp)); ++ write_len = write(fd, (char *) &wtmp, sizeof(wtmp)); + close(fd); + } + +@@ -475,7 +476,7 @@ + char buf[512]; + + if (read(fd_seed, buf, 512) == 512) +- write(fd_bck, buf, 512); ++ write_len = write(fd_bck, buf, 512); + close(fd_bck); + } + close(fd_seed); diff --git a/watchdog.init b/watchdog.init index 7f32bb3..3c5cf6a 100644 --- a/watchdog.init +++ b/watchdog.init @@ -1,10 +1,13 @@ #! /bin/sh # +# watchdog - a watchdog daemon +# # chkconfig: - 27 46 -# description: A software watchdog +# 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 @@ -36,10 +39,10 @@ start() { daemon /usr/sbin/${prog} fi RETVAL=$? + echo [ $RETVAL -eq 0 ] && touch $lockfile [ $RETVAL -eq 0 ] && echo_success [ $RETVAL -ne 0 ] && echo_failure - echo return $RETVAL } @@ -73,7 +76,7 @@ case "$1" in ;; condrestart) if [ -f $lockfile ]; then - restart + restart fi ;; status) @@ -84,3 +87,5 @@ case "$1" in echo $"Usage: $0 {start|stop|restart|status|condrestart}" exit 1 esac + +exit $RETVAL diff --git a/watchdog.service b/watchdog.service new file mode 100644 index 0000000..4648eb6 --- /dev/null +++ b/watchdog.service @@ -0,0 +1,10 @@ +[Unit] +Description=software watchdog +After=syslog.target + +[Service] +Type=forking +ExecStart=/usr/sbin/watchdog + +[Install] +WantedBy=multi-user.target diff --git a/watchdog.spec b/watchdog.spec index 512e2b9..822ddbf 100644 --- a/watchdog.spec +++ b/watchdog.spec @@ -1,7 +1,7 @@ Summary: Software and/or Hardware watchdog daemon Name: watchdog -Version: 5.5 -Release: 7%{?dist} +Version: 5.9 +Release: 1%{?dist} License: GPL+ Group: System Environment/Daemons @@ -10,8 +10,14 @@ Source0: http://downloads.sourceforge.net/watchdog/watchdog-%{version}. Source1: watchdog.init Source2: README.watchdog.ipmi Source3: README.Fedora +Source4: watchdog.service -Patch0: %{name}-%{version}-cleanup.patch +# This was sent upstream as part of a large bundle of cleanups, but +# this part was not applied, so I assume they don't want it. +Patch0: watchdog-5.9-write-warn-unused-result.patch + +# Sent upstream on 2011-01-17. +Patch1: watchdog-5.9-cleanups.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -41,11 +47,12 @@ expiration) initiated by the BMC. %prep %setup -q -n %{name}-%{version} +%patch0 -p1 +%patch1 -p1 + cp %{SOURCE2} . cp %{SOURCE3} . -%patch0 -p1 -b .cleanup - mv README README.orig iconv -f ISO-8859-1 -t UTF-8 < README.orig > README @@ -61,6 +68,8 @@ install -d -m0755 ${RPM_BUILD_ROOT}%{_sysconfdir} make DESTDIR=${RPM_BUILD_ROOT} install install -Dp -m0644 %{name}.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/watchdog install -Dp -m0755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_initrddir}/watchdog +install -Dp -m0644 %{SOURCE4} ${RPM_BUILD_ROOT}/lib/systemd/system/watchdog.service + %clean rm -Rf ${RPM_BUILD_ROOT} @@ -92,13 +101,24 @@ fi %config(noreplace) %{_sysconfdir}/sysconfig/watchdog %{_sysconfdir}/rc.d/init.d/watchdog %{_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* +/lib/systemd/system/watchdog.service %changelog +* 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.