From 4dcba67cefea09f162beb5239816657396d10a97 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 18 Jun 2005 04:48:54 +0000 Subject: Add init.d script by Pedro Algarvio #96324 and some custom patches to bind daemon to loopback/write pid file. (Portage version: 2.0.51.22-r1) --- sys-apps/xmbmon/files/digest-xmbmon-2.0.5-r1 | 2 ++ sys-apps/xmbmon/files/mbmon.confd | 11 +++++++ sys-apps/xmbmon/files/mbmon.rc | 20 ++++++++++++ sys-apps/xmbmon/files/xmbmon-2.0.5-loopback.patch | 40 +++++++++++++++++++++++ sys-apps/xmbmon/files/xmbmon-2.0.5-pid.patch | 31 ++++++++++++++++++ 5 files changed, 104 insertions(+) create mode 100644 sys-apps/xmbmon/files/digest-xmbmon-2.0.5-r1 create mode 100644 sys-apps/xmbmon/files/mbmon.confd create mode 100644 sys-apps/xmbmon/files/mbmon.rc create mode 100644 sys-apps/xmbmon/files/xmbmon-2.0.5-loopback.patch create mode 100644 sys-apps/xmbmon/files/xmbmon-2.0.5-pid.patch (limited to 'sys-apps/xmbmon/files') diff --git a/sys-apps/xmbmon/files/digest-xmbmon-2.0.5-r1 b/sys-apps/xmbmon/files/digest-xmbmon-2.0.5-r1 new file mode 100644 index 000000000000..d931610527c2 --- /dev/null +++ b/sys-apps/xmbmon/files/digest-xmbmon-2.0.5-r1 @@ -0,0 +1,2 @@ +MD5 ab6614c785f5b653fcc69fb9c02058f0 xmbmon205.tar.gz 142987 +MD5 cab271a816ed2aeb3f898f2dee493456 xmbmon205_fflush.patch 242 diff --git a/sys-apps/xmbmon/files/mbmon.confd b/sys-apps/xmbmon/files/mbmon.confd new file mode 100644 index 000000000000..807821b9b397 --- /dev/null +++ b/sys-apps/xmbmon/files/mbmon.confd @@ -0,0 +1,11 @@ +# /etc/conf.d/mbmon +# $Header: /var/cvsroot/gentoo-x86/sys-apps/xmbmon/files/mbmon.confd,v 1.1 2005/06/18 04:48:54 vapier Exp $ + +# Port to listen on. + +MBMON_PORT="12912" + +# These are default options to use with gkrellm2. +# See the mbmon(1) manpage for more info. + +MBMON_OPTS="-l" diff --git a/sys-apps/xmbmon/files/mbmon.rc b/sys-apps/xmbmon/files/mbmon.rc new file mode 100644 index 000000000000..06b22a9871fb --- /dev/null +++ b/sys-apps/xmbmon/files/mbmon.rc @@ -0,0 +1,20 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/xmbmon/files/mbmon.rc,v 1.1 2005/06/18 04:48:54 vapier Exp $ + +start() { + einfo "Start Mother Board Monitor" + mbmon \ + -P ${MBMON_PORT} \ + ${MBMON_OPTS} + eend $? +} + +stop() { + einfo "Stop Mother Board Monitor" + start-stop-daemon --stop --pidfile /var/run/mbmon.pid + local ret=$? + rm -f /var/run/mbmon.pid + eend ${ret} +} diff --git a/sys-apps/xmbmon/files/xmbmon-2.0.5-loopback.patch b/sys-apps/xmbmon/files/xmbmon-2.0.5-loopback.patch new file mode 100644 index 000000000000..5a28b52f9ea2 --- /dev/null +++ b/sys-apps/xmbmon/files/xmbmon-2.0.5-loopback.patch @@ -0,0 +1,40 @@ +Listen on loopback only with the -l option + +patch by Mike Frysinger + +--- mbmon.c ++++ mbmon.c +@@ -41,4 +41,5 @@ + static const char *MyName = "mbmon"; + int port = 0; ++uint32_t listen_addr = INADDR_ANY; + + int usage(void) +@@ -61,4 +62,5 @@ + " -c count: repeat times and exit\n" + " -P port: run in daemon mode, using given port for clients\n" ++" -l: listen on local interface only\n" + " -T|F [1-7]: print Temperature|Fanspeed according to following styles\n" + " style1: data1\\n\n" +@@ -318,5 +320,5 @@ + while ((ch = getopt(argc,argv,"VSIAfdDYe:p:s:c:T:F:tunNirh")) != -1) { + #else +- while ((ch = getopt(argc,argv,"VSIAfdDYe:p:c:T:F:tunNirhP:")) != -1) { ++ while ((ch = getopt(argc,argv,"VSIAfdDYe:p:c:T:F:tunNirhlP:")) != -1) { + #endif + switch(ch) { +@@ -371,4 +373,7 @@ + probe_request = optarg; + break; ++ case 'l': ++ listen_addr = INADDR_LOOPBACK; ++ break; + case 'P': + port = atoi (optarg); +@@ -458,5 +463,5 @@ + server.sin_family = AF_INET; + server.sin_port = htons (port); +- server.sin_addr.s_addr = INADDR_ANY; ++ server.sin_addr.s_addr = htonl(listen_addr); + if (bind (fd, (struct sockaddr *) &server, sizeof (server)) < 0) { + perror("bind"); diff --git a/sys-apps/xmbmon/files/xmbmon-2.0.5-pid.patch b/sys-apps/xmbmon/files/xmbmon-2.0.5-pid.patch new file mode 100644 index 000000000000..aecb5e7a9b7c --- /dev/null +++ b/sys-apps/xmbmon/files/xmbmon-2.0.5-pid.patch @@ -0,0 +1,31 @@ +Write a pid when we daemonize + +patch by Mike Frysinger + +--- mbmon.c ++++ mbmon.c +@@ -229,4 +229,5 @@ + static void daemonize() + { ++ pid_t pid; + int fd; + struct sigaction sa_ign, sa_save; +@@ -247,5 +248,5 @@ + sigaction(SIGHUP, &sa_ign, &sa_save); + +- switch (fork()) { ++ switch ((pid=fork())) { + case 0: + break; +@@ -259,4 +260,11 @@ + + default: ++ { ++ FILE *f = fopen("/var/run/mbmon.pid", "w"); ++ if (f != NULL) { ++ fprintf(f, "%i", pid); ++ fclose(f); ++ } ++ } + exit(0); + /* NOTREACHED */ -- cgit v1.2.3-65-gdbad