diff options
author | lawrance <lawrance@FreeBSD.org> | 2005-11-11 23:13:45 +0800 |
---|---|---|
committer | lawrance <lawrance@FreeBSD.org> | 2005-11-11 23:13:45 +0800 |
commit | ae3be241e64570d6f31985674f1fbc8eded6f332 (patch) | |
tree | bb1a361d794ec370f04ad4ac71ee9c628964a0ea /sysutils | |
parent | c30cb8fd791bdc20c90df40158f1d55a1df1abdc (diff) | |
download | freebsd-ports-graphics-ae3be241e64570d6f31985674f1fbc8eded6f332.tar.gz freebsd-ports-graphics-ae3be241e64570d6f31985674f1fbc8eded6f332.tar.zst freebsd-ports-graphics-ae3be241e64570d6f31985674f1fbc8eded6f332.zip |
Add netdump-server 0.7.7, RedHat server part of netdump/netconsole
package for linux.
PR: ports/79049
Submitted by: Stanislav Sedov
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/Makefile | 1 | ||||
-rw-r--r-- | sysutils/netdump-server/Makefile | 68 | ||||
-rw-r--r-- | sysutils/netdump-server/distinfo | 3 | ||||
-rw-r--r-- | sysutils/netdump-server/files/netdump-server.sh.in | 54 | ||||
-rw-r--r-- | sysutils/netdump-server/files/netdump.conf.sample | 3 | ||||
-rw-r--r-- | sysutils/netdump-server/files/patch-Makefile | 12 | ||||
-rw-r--r-- | sysutils/netdump-server/files/patch-configuration.c | 87 | ||||
-rw-r--r-- | sysutils/netdump-server/files/patch-configuration.h | 10 | ||||
-rw-r--r-- | sysutils/netdump-server/files/patch-netdump-server.8 | 21 | ||||
-rw-r--r-- | sysutils/netdump-server/files/patch-netdumpclient.c | 21 | ||||
-rw-r--r-- | sysutils/netdump-server/files/patch-netdumpelf.h | 37 | ||||
-rw-r--r-- | sysutils/netdump-server/files/patch-server.c | 55 | ||||
-rw-r--r-- | sysutils/netdump-server/files/patch-server.h | 11 | ||||
-rw-r--r-- | sysutils/netdump-server/files/pkg-message.in | 17 | ||||
-rw-r--r-- | sysutils/netdump-server/pkg-descr | 7 | ||||
-rw-r--r-- | sysutils/netdump-server/pkg-plist | 18 |
16 files changed, 425 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile index 9eb222d20b7..3b76f5f2b75 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -327,6 +327,7 @@ SUBDIR += nagios-statd SUBDIR += nautilus-cd-burner SUBDIR += ndir + SUBDIR += netdump-server SUBDIR += newportsversioncheck SUBDIR += no-login SUBDIR += npadmin diff --git a/sysutils/netdump-server/Makefile b/sysutils/netdump-server/Makefile new file mode 100644 index 00000000000..c267da1f791 --- /dev/null +++ b/sysutils/netdump-server/Makefile @@ -0,0 +1,68 @@ +# New ports collection makefile for: netdump-server +# Date created: 20 Mar 2005 +# Whom: Stanislav Sedov +# +# $FreeBSD$ + +PORTNAME= netdump-server +PORTVERSION= 0.7.7 +CATEGORIES= sysutils net +MASTER_SITES= http://mbsd.msk.ru/dist/ +DISTNAME= netdump-${PORTVERSION} + +MAINTAINER= stas@core.310.ru +COMMENT= RedHat server part of netdump/netconsole package for linux + +LIB_DEPENDS= popt:${PORTSDIR}/devel/popt \ + glib:${PORTSDIR}/devel/glib20 +BUILD_DEPENDS= pkg-config:${PORTSDIR}/devel/pkgconfig + +PKGMESSAGE= ${WRKDIR}/pkg-message + +DOCSFILES= README README.client +MAN8= netdump.8 netdump-server.8 +NETDUMP_OWN?= netdump +NETDUMP_GRP?= operator + +USE_RC_SUBR= netdump-server.sh +PLIST_SUB+= NETDUMP_OWN=${NETDUMP_OWN} \ + NETDUMP_GRP=${NETDUMP_GRP} +SUB_FILES+= pkg-message +PKGMESSAGE= ${WRKDIR}/pkg-message + +PW?= /usr/sbin/pw + +do-install: + ${INSTALL_MAN} ${WRKSRC}/netdump-server.8 ${MANPREFIX}/man/man8 + ${INSTALL_MAN} ${WRKSRC}/netdump.8 ${MANPREFIX}/man/man8 + ${INSTALL_PROGRAM} ${WRKSRC}/netdump-server ${PREFIX}/bin + ${INSTALL_DATA} ${FILESDIR}/netdump.conf.sample ${PREFIX}/etc + ${MKDIR} ${EXAMPLESDIR} + + for filename in ${WRKSRC}/example_scripts/*; do \ + ${INSTALL_SCRIPT} $${filename} ${EXAMPLESDIR}; \ + done + +post-install: + +.if !defined(NOPORTDOCS) + @${MKDIR} ${DOCSDIR} +.for FILE in ${DOCSFILES} + @${INSTALL_DATA} ${WRKSRC}/${FILE} ${DOCSDIR} +.endfor +.endif + + ${PW} groupshow "${NETDUMP_GRP}" 2>/dev/null || \ + ${PW} groupadd -n "${NETDUMP_GRP}" + ${PW} usershow "${NETDUMP_OWN}" 2>/dev/null || \ + ${PW} useradd -n "${NETDUMP_OWN}" -g "${NETDUMP_GRP}" \ + -s /sbin/nologin -d /nonexistent \ + -c "Netdump-server pseudo user" + + ${MKDIR} /var/spool/netdump + ${CHOWN} "${NETDUMP_OWN}:${NETDUMP_GRP}" /var/spool/netdump + ${CHMOD} 700 /var/spool/netdump + + @${CAT} ${PKGMESSAGE} + +.include <bsd.port.mk> diff --git a/sysutils/netdump-server/distinfo b/sysutils/netdump-server/distinfo new file mode 100644 index 00000000000..b68060de783 --- /dev/null +++ b/sysutils/netdump-server/distinfo @@ -0,0 +1,3 @@ +MD5 (netdump-0.7.7.tar.gz) = 0b2b15cd95d2e64bac4ae5e05f49e82f +SHA256 (netdump-0.7.7.tar.gz) = a72969cbeb98fcba102a1cf0b2b96d68f1192695e3ccd232c5606ab2311aa37e +SIZE (netdump-0.7.7.tar.gz) = 39298 diff --git a/sysutils/netdump-server/files/netdump-server.sh.in b/sysutils/netdump-server/files/netdump-server.sh.in new file mode 100644 index 00000000000..82787e8e19c --- /dev/null +++ b/sysutils/netdump-server/files/netdump-server.sh.in @@ -0,0 +1,54 @@ +#!/bin/sh +# + +# PROVIDE: netdump_server +# REQUIRE: +# BEFORE: +# KEYWORD: FreeBSD shutdown + +# Add the following line to /etc/rc.conf to enable mpd: +# +#netdump_server_enable="YES" + +. %%RC_SUBR%% + +load_rc_config netdump_server + +netdump_server_enable=${netdump_server_enable-"NO"} +netdump_server_flags=${netdump_server_flags-"--daemon --secure 0"} + +name=netdump_server +rcvar=`set_rcvar` +command=%%PREFIX%%/bin/netdump-server +pidfile=/var/run/netdump-server.pid +start_cmd=start_cmd +stop_cmd=stop_cmd + +start_cmd() +{ + if [ -r ${pidfile} ]; then + echo "netdump_server already runned" + exit 1 + fi + + touch $pidfile + chown netdump $pidfile + + su -m netdump -c "${command} --pidfile ${pidfile} ${netdump_server_flags}" +} + +stop_cmd() +{ + if [ -r ${pidfile} ]; then + pid=`cat ${pidfile}` + kill -TERM ${pid} + wait_for_pids ${pid} + + rm -rf ${pidfile} + else + echo "netdump-server not runned" + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/sysutils/netdump-server/files/netdump.conf.sample b/sysutils/netdump-server/files/netdump.conf.sample new file mode 100644 index 00000000000..bb0ebacd7bb --- /dev/null +++ b/sysutils/netdump-server/files/netdump.conf.sample @@ -0,0 +1,3 @@ +daemon=true +secure=0 +dumpdirprefix="/var/spool/netdump" diff --git a/sysutils/netdump-server/files/patch-Makefile b/sysutils/netdump-server/files/patch-Makefile new file mode 100644 index 00000000000..31bcff5954f --- /dev/null +++ b/sysutils/netdump-server/files/patch-Makefile @@ -0,0 +1,12 @@ +--- Makefile.orig Tue Mar 1 20:33:03 2005 ++++ Makefile Sat Mar 19 16:53:49 2005 +@@ -1,7 +1,7 @@ + DEBUG_FLAGS=-Wall -g + +-CFLAGS=`glib-config --cflags` $(DEBUG_FLAGS) -D_FILE_OFFSET_BITS=64 +-LDFLAGS=`glib-config --libs` -lpopt ++CFLAGS += `pkg-config --cflags glib-2.0` $(DEBUG_FLAGS) -D_FILE_OFFSET_BITS=64 -I /usr/local/include ++LDFLAGS += `pkg-config --libs glib-2.0` -L/usr/local/lib -lpopt + + VERSION=$(shell awk '/Version:/ { print $$2 }' netdump.spec) + # Used to append this to CVSTAG: _$(subst .,-,$(RELEASE)), but now that diff --git a/sysutils/netdump-server/files/patch-configuration.c b/sysutils/netdump-server/files/patch-configuration.c new file mode 100644 index 00000000000..0f2b6bbd35c --- /dev/null +++ b/sysutils/netdump-server/files/patch-configuration.c @@ -0,0 +1,87 @@ +--- configuration.c.orig Sun Mar 20 11:17:08 2005 ++++ configuration.c Sun Mar 20 10:06:04 2005 +@@ -2,6 +2,7 @@ + #include <string.h> + #include <unistd.h> + #include <stdio.h> ++#include <stdlib.h> + #include <syslog.h> + #include <sys/types.h> + #include <sys/stat.h> +@@ -15,6 +16,8 @@ + + NetdumpConfiguration config; + ++char *netdump_dir_prefix = NETDUMP_DIR_PREFIX; ++ + enum ConfigType { + CONFIG_NONE, + CONFIG_BOOLEAN, +@@ -46,6 +49,7 @@ + { "max_concurrent_dumps", CONFIG_INT, CONFIG_OFFSET(max_concurrent_dumps), GINT_TO_POINTER (4) }, + { "daemon", CONFIG_BOOLEAN, CONFIG_OFFSET(daemon), GINT_TO_POINTER (0) }, + { "pidfile", CONFIG_STRING, CONFIG_OFFSET(pidfile), NULL }, ++ { "dumpdirprefix", CONFIG_STRING, CONFIG_OFFSET(dumpdirprefix), NETDUMP_DIR_PREFIX }, + { "secure", CONFIG_INT, CONFIG_OFFSET(secure), GINT_TO_POINTER (1) }, + { "space_check", CONFIG_INT, CONFIG_OFFSET(space_check), GINT_TO_POINTER (1) }, + }; +@@ -118,7 +122,20 @@ + *(guint16 *)ptr = GPOINTER_TO_INT (config_data[i].default_value); + break; + case CONFIG_STRING: +- *(gchar **)ptr = (gchar *)config_data[i].default_value; ++ if (config_data[i].default_value != NULL) { ++ *(char **)ptr = (char *)malloc(strlen(config_data[i].default_value) + 1); ++ if (*(char **)ptr != NULL) { ++ strncpy(*(char **)ptr, config_data[i].default_value, strlen(config_data[i].default_value)); ++ (*(char **)ptr)[strlen(config_data[i].default_value)] = '\0'; ++ } ++ else { ++ syslog(LOG_ERR, "Cannot malloc\n"); ++ exit(1); ++ } ++ } ++ else ++ ptr = (char *)NULL; ++ + break; + case CONFIG_NONE: + break; +@@ -181,7 +198,18 @@ + if (token != G_TOKEN_STRING) + return G_TOKEN_STRING; + +- *(char **)ptr = scanner->value.v_string; ++ if (*(char **)ptr != NULL) ++ free(*(char **)ptr); ++ *(char **)ptr = (char *)malloc(strlen(scanner->value.v_string) + 1); ++ if (*(char **)ptr != NULL) { ++ strncpy(*(char **)ptr, scanner->value.v_string, strlen(scanner->value.v_string)); ++ (*(char **)ptr)[strlen(scanner->value.v_string)] = '\0'; ++ } ++ else { ++ syslog(LOG_ERR, "Cannot malloc\n"); ++ exit(1); ++ } ++ + break; + case CONFIG_NONE: + break; +@@ -277,6 +305,8 @@ + "run in background as a daemon", NULL }, + { "pidfile", 'P', POPT_ARG_STRING, &config.pidfile, 0, + "file in which to store the pid", "path" }, ++ { "dumpdirprefix", 'D', POPT_ARG_STRING, &config.dumpdirprefix, 0, ++ "dir in which to store dumps", "/var/spool/netdump" }, + { "secure", 's', POPT_ARG_INT, &config.secure, 0, + "use ssh to send client identification", "1" }, + { "space_check", 'S', POPT_ARG_INT, &config.space_check, 0, +@@ -305,7 +335,7 @@ + /* Set the default values */ + config_set_defaults(); + +- config_load ("/etc/netdump.conf"); ++ config_load ("/usr/local/etc/netdump.conf"); + + optCon = poptGetContext("netdump-server", argc, (const char **)argv, + optionsTable, 0); diff --git a/sysutils/netdump-server/files/patch-configuration.h b/sysutils/netdump-server/files/patch-configuration.h new file mode 100644 index 00000000000..410016cb1d1 --- /dev/null +++ b/sysutils/netdump-server/files/patch-configuration.h @@ -0,0 +1,10 @@ +--- configuration.h.orig Sun Mar 20 11:17:12 2005 ++++ configuration.h Sun Mar 20 08:57:43 2005 +@@ -6,6 +6,7 @@ + int max_concurrent_dumps; + gboolean daemon; + char *pidfile; ++ char *dumpdirprefix; + int secure; + int space_check; + } NetdumpConfiguration; diff --git a/sysutils/netdump-server/files/patch-netdump-server.8 b/sysutils/netdump-server/files/patch-netdump-server.8 new file mode 100644 index 00000000000..2ea2853b585 --- /dev/null +++ b/sysutils/netdump-server/files/patch-netdump-server.8 @@ -0,0 +1,21 @@ +--- netdump-server.8.orig Sat Mar 19 16:56:34 2005 ++++ netdump-server.8 Sat Mar 19 16:58:00 2005 +@@ -50,6 +50,9 @@ + Store a pidfile. The default service uses /var/run/netdump-server.pid. + The default is not to write a pidfile. + .TP ++--dumpdirprefix \fIpath\fP ++The directory in which to save dumps. The default - /var/spool/netdump. ++.TP + --daemon + netdump-server should background itself and run as a daemon. + .TP +@@ -76,7 +79,7 @@ + /etc/netdump.conf + A configuration file read by netdump-server on startup. It is a + "key=value" style file. Currently it supports the options: +-port, max_concurrent_dumps, daemon and pidfile. ++port, max_concurrent_dumps, daemon, pidfile and dumpdirprefix. + .TP + /etc/init.d/netdump-server + An init script to start a default system installation of netdump-server. diff --git a/sysutils/netdump-server/files/patch-netdumpclient.c b/sysutils/netdump-server/files/patch-netdumpclient.c new file mode 100644 index 00000000000..5c5ed5e89aa --- /dev/null +++ b/sysutils/netdump-server/files/patch-netdumpclient.c @@ -0,0 +1,21 @@ +--- netdumpclient.c.orig Fri Sep 3 23:53:20 2004 ++++ netdumpclient.c Sat Mar 19 16:53:49 2005 +@@ -5,7 +5,8 @@ + #include <syslog.h> + #include <sys/types.h> + #include <sys/stat.h> +-#include <sys/vfs.h> ++#include <sys/param.h> ++#include <sys/mount.h> + #include <fcntl.h> + #include <unistd.h> + #include <stdlib.h> +@@ -898,7 +899,7 @@ + if (tried_once) + syslog (LOG_ERR, "No space for dump image, even after calling netdump-nospace"); + else +- syslog (LOG_ERR, "No space for dump image"); ++ syslog (LOG_ERR, "No space for dump image, avail = %lld, need = %lld\n", buf.f_bavail, memdump_size); + + status_request (client, TRUE); + g_free (file); diff --git a/sysutils/netdump-server/files/patch-netdumpelf.h b/sysutils/netdump-server/files/patch-netdumpelf.h new file mode 100644 index 00000000000..f2d8a84768d --- /dev/null +++ b/sysutils/netdump-server/files/patch-netdumpelf.h @@ -0,0 +1,37 @@ +--- netdumpelf.h.orig Fri Sep 3 23:53:20 2004 ++++ netdumpelf.h Sun Mar 20 12:49:10 2005 +@@ -1,7 +1,21 @@ + #include <sys/time.h> +-#include <linux/types.h> ++#include <sys/types.h> + #include <elf.h> + ++typedef __uint32_t __u32; ++typedef __uint64_t __u64; ++typedef __uint16_t __u16; ++typedef __uint8_t __u8; ++typedef uid_t __kernel_uid_t; ++typedef gid_t __kernel_gid_t; ++typedef Elf_Note Elf32_Nhdr; ++typedef Elf_Note Elf64_Nhdr; ++ ++#if __FreeBSD_version < 500000 ++#define ELFMAG "\177ELF" ++#define SELFMAG 4 ++#endif ++ + #ifndef NT_TASKSTRUCT + #define NT_TASKSTRUCT 4 + #endif +@@ -87,9 +101,9 @@ + #define CLIENT_BYTE_ORDER(client) \ + ((client->machine_type == EM_386 || \ + client->machine_type == EM_X86_64 || \ +- client->machine_type == EM_IA_64) ? __LITTLE_ENDIAN : __BIG_ENDIAN) ++ client->machine_type == EM_IA_64) ? LITTLE_ENDIAN : BIG_ENDIAN) + +-#define BYTE_SWAP_REQUIRED(client) (__BYTE_ORDER != CLIENT_BYTE_ORDER(client)) ++#define BYTE_SWAP_REQUIRED(client) (BYTE_ORDER != CLIENT_BYTE_ORDER(client)) + + typedef unsigned short u16; + diff --git a/sysutils/netdump-server/files/patch-server.c b/sysutils/netdump-server/files/patch-server.c new file mode 100644 index 00000000000..6b58e2f961f --- /dev/null +++ b/sysutils/netdump-server/files/patch-server.c @@ -0,0 +1,55 @@ +--- server.c.orig Sun Mar 20 11:17:45 2005 ++++ server.c Sun Mar 20 10:09:04 2005 +@@ -66,7 +66,7 @@ + dir = g_new (CrashDir, 1); + dir->time = now; + dir->path = g_strdup_printf ("%s/%d.%d.%d.%d-%s", +- NETDUMP_DIR_PREFIX, ++ config.dumpdirprefix, + (ip >> 24) & 0xff, + (ip >> 16) & 0xff, + (ip >> 8) & 0xff, +@@ -100,7 +100,7 @@ + char *cmdline; + int res = -1; + +- filename = g_strconcat (NETDUMP_DIR_PREFIX "/scripts/", ++ filename = g_strconcat (config.dumpdirprefix, "/scripts/", + script, + NULL); + +@@ -147,7 +147,7 @@ + } + + path = g_strdup_printf ("%s/magic/%d.%d.%d.%d", +- NETDUMP_DIR_PREFIX, ++ config.dumpdirprefix, + (ip >> 24) & 0xff, + (ip >> 16) & 0xff, + (ip >> 8) & 0xff, +@@ -373,10 +373,10 @@ + + openlog("netdump", LOG_PID, LOG_DAEMON); + +- if (chdir (NETDUMP_DIR_PREFIX) == -1) ++ if (chdir (config.dumpdirprefix) == -1) + { +- syslog (LOG_ERR, "can't cd to %s", NETDUMP_DIR_PREFIX); +- fprintf (stderr, "can't cd to %s", NETDUMP_DIR_PREFIX); ++ syslog (LOG_ERR, "can't cd to %s", config.dumpdirprefix); ++ fprintf (stderr, "can't cd to %s\n", config.dumpdirprefix); + exit (1); + } + +@@ -429,6 +429,11 @@ + + loop = g_main_new (TRUE); + g_main_run (loop); ++ ++ if (config.pidfile != NULL) ++ free(config.pidfile); ++ if (config.dumpdirprefix != NULL) ++ free(config.dumpdirprefix); + + return 0; + } diff --git a/sysutils/netdump-server/files/patch-server.h b/sysutils/netdump-server/files/patch-server.h new file mode 100644 index 00000000000..fb20386b773 --- /dev/null +++ b/sysutils/netdump-server/files/patch-server.h @@ -0,0 +1,11 @@ +--- server.h.orig Fri Sep 3 23:53:20 2004 ++++ server.h Sat Mar 19 16:53:49 2005 +@@ -7,7 +7,7 @@ + + #define NETDUMP_PORT 6666 + +-#define NETDUMP_DIR_PREFIX "/var/crash" ++#define NETDUMP_DIR_PREFIX "/var/spool/netdump" + + extern int master_socket; + diff --git a/sysutils/netdump-server/files/pkg-message.in b/sysutils/netdump-server/files/pkg-message.in new file mode 100644 index 00000000000..0ee6fc4f2b0 --- /dev/null +++ b/sysutils/netdump-server/files/pkg-message.in @@ -0,0 +1,17 @@ +============================================================================= + +This port installed sample config script '%%PREFIX%%/etc/netdump.conf.sample'. +Rename it to '%%PREFIX%%/etc/netdump.conf' and edit to suit your needs. + +Dumps will be stored in /var/spool/netdump. You can change it in config or +using runtime options. + +In order to enable logging add '!netdump' part to syslog.conf. + +If you want to use netdump-server in secure way set password for netdump +account and change 'secure' config option to 1. + +To run netdump-server from startup, add netdump_server_enable="YES" +in your /etc/rc.conf. + +============================================================================= diff --git a/sysutils/netdump-server/pkg-descr b/sysutils/netdump-server/pkg-descr new file mode 100644 index 00000000000..2c1202480cf --- /dev/null +++ b/sysutils/netdump-server/pkg-descr @@ -0,0 +1,7 @@ +Netdump-server listens on the network for connections from linux kernels +using the netconsole/netdump module. When such a machine crashes it +contacts the netdump-server on the specified ip/port. The server then +proceeds to log console messages, including the oops message, and a +kernel memory dump in a specified directory, and then reboots the machine. + +WWW: http://www.redhat.com diff --git a/sysutils/netdump-server/pkg-plist b/sysutils/netdump-server/pkg-plist new file mode 100644 index 00000000000..89fe9ea5b41 --- /dev/null +++ b/sysutils/netdump-server/pkg-plist @@ -0,0 +1,18 @@ +@comment $FreeBSD$ +@exec if ! pw groupshow %%NETDUMP_GRP%% 2>/dev/null; then pw groupadd -n %%NETDUMP_GRP%%; fi +@exec if ! pw usershow %%NETDUMP_OWN%% 2>/dev/null; then pw useradd -n %%NETDUMP_OWN%% -g %%NETDUMP_GRP%% -d /nonexistent -s /sbin/nologin -c "Netdump-server pseudo user"; fi +@exec mkdir -p /var/spool/netdump +@exec chown %%NETDUMP_OWN%%:%%NETDUMP_GRP%% /var/spool/netdump +@exec chmod 700 /var/spool/netdump +@unexec rmdir /var/spool/netdump 2>/dev/null || true +@unexec pw userdel %%NETDUMP_OWN%% +bin/netdump-server +etc/netdump.conf.sample +%%EXAMPLESDIR%%/netdump-crash +%%EXAMPLESDIR%%/netdump-nospace +%%EXAMPLESDIR%%/netdump-reboot +%%EXAMPLESDIR%%/netdump-start +%%PORTDOCS%%%%DOCSDIR%%/README +%%PORTDOCS%%%%DOCSDIR%%/README.client +%%PORTDOCS%%@dirrm %%DOCSDIR%% +@dirrm %%EXAMPLESDIR%% |