Gentoo Archives: gentoo-commits

From: "Diego Petteno (flameeyes)" <flameeyes@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-libs/freeipmi/files: bmc-watchdog.initd.2 ipmidetectd.initd.2 freeipmi-1.0.6-bmc-watchdog-pidfile.patch
Date: Wed, 07 Sep 2011 06:20:57
Message-Id: 20110907062045.E01FB20051@flycatcher.gentoo.org
1 flameeyes 11/09/07 06:20:45
2
3 Added: bmc-watchdog.initd.2 ipmidetectd.initd.2
4 freeipmi-1.0.6-bmc-watchdog-pidfile.patch
5 Log:
6 Bump with a patch that allows bmc-watchdog to behave and the init script to work correctly in Gentoo for the first time.
7
8 (Portage version: 2.2.0_alpha53/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.1 sys-libs/freeipmi/files/bmc-watchdog.initd.2
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/freeipmi/files/bmc-watchdog.initd.2?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/freeipmi/files/bmc-watchdog.initd.2?rev=1.1&content-type=text/plain
15
16 Index: bmc-watchdog.initd.2
17 ===================================================================
18 #!/sbin/runscript
19 # Copyright 1999-2011 Gentoo Foundation
20 # Distributed under the terms of the GNU General Public License v2
21 # $Header: /var/cvsroot/gentoo-x86/sys-libs/freeipmi/files/bmc-watchdog.initd.2,v 1.1 2011/09/07 06:20:45 flameeyes Exp $
22
23 extra_commands="condrestart"
24
25 PIDFILE=/var/run/$SVCNAME.pid
26
27 start() {
28 rm -f $PIDFILE
29
30 ebegin "Starting $SVCNAME"
31 start-stop-daemon \
32 --start --exec /usr/sbin/$SVCNAME \
33 --pidfile $PIDFILE -- ${OPTIONS}
34 eend $?
35 }
36
37 stop() {
38 ebegin "Stopping $SVCNAME"
39 start-stop-daemon \
40 --stop \
41 --pidfile $PIDFILE
42 eend $?
43 rm -f $PIDFILE
44 }
45
46 condrestart() {
47 service_started && restart
48 }
49
50
51
52 1.1 sys-libs/freeipmi/files/ipmidetectd.initd.2
53
54 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/freeipmi/files/ipmidetectd.initd.2?rev=1.1&view=markup
55 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/freeipmi/files/ipmidetectd.initd.2?rev=1.1&content-type=text/plain
56
57 Index: ipmidetectd.initd.2
58 ===================================================================
59 #!/sbin/runscript
60 # Copyright 1999-2011 Gentoo Foundation
61 # Distributed under the terms of the GNU General Public License v2
62 # $Header: /var/cvsroot/gentoo-x86/sys-libs/freeipmi/files/ipmidetectd.initd.2,v 1.1 2011/09/07 06:20:45 flameeyes Exp $
63
64 PIDFILE=/var/run/$SVCNAME.pid
65
66 start() {
67 rm -f $PIDFILE
68
69 ebegin "Starting $SVCNAME"
70 start-stop-daemon --background --make-pidfile \
71 --start --exec /usr/sbin/$SVCNAME \
72 --pidfile $PIDFILE
73 eend $?
74 }
75
76 stop() {
77 ebegin "Stopping $SVCNAME"
78 start-stop-daemon \
79 --stop \
80 --pidfile $PIDFILE
81 eend $?
82 rm -f $PIDFILE
83 }
84
85
86
87 1.1 sys-libs/freeipmi/files/freeipmi-1.0.6-bmc-watchdog-pidfile.patch
88
89 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/freeipmi/files/freeipmi-1.0.6-bmc-watchdog-pidfile.patch?rev=1.1&view=markup
90 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/freeipmi/files/freeipmi-1.0.6-bmc-watchdog-pidfile.patch?rev=1.1&content-type=text/plain
91
92 Index: freeipmi-1.0.6-bmc-watchdog-pidfile.patch
93 ===================================================================
94 diff --git a/bmc-watchdog/src/Makefile.am b/bmc-watchdog/src/Makefile.am
95 index 04c01e2..38d2f7f 100644
96 --- a/bmc-watchdog/src/Makefile.am
97 +++ b/bmc-watchdog/src/Makefile.am
98 @@ -10,7 +10,8 @@ AM_CPPFLAGS = \
99 -I$(top_srcdir)/common/src/portability \
100 -I$(top_srcdir)/libfreeipmi/include \
101 -D_GNU_SOURCE \
102 - -D_REENTRANT
103 + -D_REENTRANT \
104 + -DLOCALSTATEDIR='"$(localstatedir)"'
105
106 sbin_PROGRAMS = bmc-watchdog
107
108 diff --git a/bmc-watchdog/src/bmc-watchdog.c b/bmc-watchdog/src/bmc-watchdog.c
109 index 566ee65..403bc0a 100644
110 --- a/bmc-watchdog/src/bmc-watchdog.c
111 +++ b/bmc-watchdog/src/bmc-watchdog.c
112 @@ -1677,6 +1677,10 @@ _daemon_init ()
113 {
114 unsigned int i;
115 pid_t pid;
116 + FILE *pidfile;
117 +
118 + if ( (pidfile = fopen(LOCALSTATEDIR "/run/bmc-watchdog.pid", "w")) == NULL )
119 + _err_exit ("fopen: %s", strerror (errno));
120
121 if ((pid = fork ()) < 0)
122 _err_exit ("fork: %s", strerror (errno));
123 @@ -1690,8 +1694,13 @@ _daemon_init ()
124
125 if ((pid = fork ()) < 0)
126 _err_exit ("fork: %s", strerror (errno));
127 - if (pid)
128 + if (pid) {
129 + /* write the 2nd child PID to the pidfile */
130 + fprintf(pidfile, "%u\n", pid);
131 + fclose(pidfile);
132 +
133 exit (0); /* 1st child terminates */
134 + }
135
136 if (chdir ("/") < 0)
137 _err_exit ("chdir: %s", strerror (errno));