diff options
Diffstat (limited to 'app-admin/cancd')
-rw-r--r-- | app-admin/cancd/Manifest | 1 | ||||
-rw-r--r-- | app-admin/cancd/cancd-0.1.0-r3.ebuild | 38 | ||||
-rw-r--r-- | app-admin/cancd/files/cancd-0.1.0-build.patch | 14 | ||||
-rw-r--r-- | app-admin/cancd/files/cancd-0.1.0-c-cleanup.patch | 65 | ||||
-rw-r--r-- | app-admin/cancd/files/cancd-conf.d | 20 | ||||
-rw-r--r-- | app-admin/cancd/files/cancd-init.d | 23 | ||||
-rw-r--r-- | app-admin/cancd/files/netconsole-conf.d | 28 | ||||
-rw-r--r-- | app-admin/cancd/files/netconsole-init.d | 68 | ||||
-rw-r--r-- | app-admin/cancd/metadata.xml | 8 |
9 files changed, 265 insertions, 0 deletions
diff --git a/app-admin/cancd/Manifest b/app-admin/cancd/Manifest new file mode 100644 index 00000000000..cd6ebdfb995 --- /dev/null +++ b/app-admin/cancd/Manifest @@ -0,0 +1 @@ +DIST cancd-0.1.0.tar.gz 7634 SHA256 aea21e3eadee64d2b76591d272dcd03c566215b2320d7fef5cfe0937c3ef0315 SHA512 9b01ed3ea1e27276799d657572645a7b40da9cf80910a73e2de9d733e8f3cfa374e29764b1e5853d7fb5a6835edda3103a1a6d31fd699010f98318631e62c5fb WHIRLPOOL 84e1b6461bc5ae40b01c71112fed9999e590a7cbed54da6850131bd475eafb6ab7830a418a6fc46bf217645ed73aec080af6d4117a9ea97f1b48dad92cc93caf diff --git a/app-admin/cancd/cancd-0.1.0-r3.ebuild b/app-admin/cancd/cancd-0.1.0-r3.ebuild new file mode 100644 index 00000000000..dce28970573 --- /dev/null +++ b/app-admin/cancd/cancd-0.1.0-r3.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit eutils + +DESCRIPTION="the CA NetConsole Daemon, a daemon to receive output from the Linux netconsole driver" +HOMEPAGE="http://oss.oracle.com/projects/cancd/" +SRC_URI="http://oss.oracle.com/projects/cancd/dist/files/source/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +src_prepare() { + epatch "${FILESDIR}"/${P}-build.patch #246734 + epatch "${FILESDIR}"/${P}-c-cleanup.patch + # slight makefile cleanup + sed -i \ + -e '/^CFLAGS/s,-g,,' \ + -e '/^CFLAGS/s,-O2,-Wall -W -Wextra -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wredundant-decls -Wunreachable-code -Wlong-long,' \ + -e '/rm cancd cancd.o/s,rm,rm -f,' \ + Makefile || die +} + +src_install() { + dosbin cancd + newinitd "${FILESDIR}"/cancd-init.d cancd + newconfd "${FILESDIR}"/cancd-conf.d cancd + newinitd "${FILESDIR}"/netconsole-init.d netconsole + newconfd "${FILESDIR}"/netconsole-conf.d netconsole + keepdir /var/crash + fowners adm:nobody /var/crash + fperms 700 /var/crash +} diff --git a/app-admin/cancd/files/cancd-0.1.0-build.patch b/app-admin/cancd/files/cancd-0.1.0-build.patch new file mode 100644 index 00000000000..b1c99b1cd56 --- /dev/null +++ b/app-admin/cancd/files/cancd-0.1.0-build.patch @@ -0,0 +1,14 @@ +fix building with newer glibc + +http://bugs.gentoo.org/246734 + +--- cancd.c ++++ cancd.c +@@ -36,6 +36,7 @@ + #include <libgen.h> + #include <getopt.h> + #include <stdarg.h> ++#include <limits.h> + #include <sys/socket.h> + #include <arpa/inet.h> + #include <netinet/in.h> diff --git a/app-admin/cancd/files/cancd-0.1.0-c-cleanup.patch b/app-admin/cancd/files/cancd-0.1.0-c-cleanup.patch new file mode 100644 index 00000000000..47defb3e43b --- /dev/null +++ b/app-admin/cancd/files/cancd-0.1.0-c-cleanup.patch @@ -0,0 +1,65 @@ +diff -Nuar --exclude '*~' --exclude '*.orig' --exclude Makefile cancd-0.1.0/cancd.c cancd-0.1.0.new/cancd.c +--- cancd-0.1.0/cancd.c 2005-08-18 11:47:48.000000000 -0700 ++++ cancd-0.1.0.new/cancd.c 2006-03-17 17:09:46.402025517 -0800 +@@ -199,7 +199,7 @@ + char *path; + }; + +-static int make_tree(const char *path, int mode) ++static int make_tree(const char *path, mode_t mode) + { + struct stat stat_buf; + char *ptr, *tmp; +@@ -319,7 +319,7 @@ + static int open_socket() + { + int rc; +- struct sockaddr_in servaddr = {0, }; ++ struct sockaddr_in servaddr; + + sock_fd = socket(PF_INET, SOCK_DGRAM, 0); + if (sock_fd < 0) +@@ -438,7 +438,7 @@ + int rc; + static int block = 1; + +- rc = recvfrom(sock_fd, buf, bufsize, 0, ++ rc = recvfrom(fd, buf, bufsize, 0, + (struct sockaddr *)from, fromlen); + if (rc < 0) + { +@@ -569,7 +569,7 @@ + + static int valid_format() + { +- struct in_addr addr = {0, }; ++ struct in_addr addr; + char *name; + int rc; + +@@ -599,9 +599,11 @@ + exit(rc); + } + ++/* + extern char *optarg; + extern int optopt; + extern int opterr; ++*/ + static int parse_options(int argc, char *argv[]) + { + int c; +@@ -641,11 +643,11 @@ + optarg); + print_usage(-EINVAL); + } +- log_prefix = optarg; ++ log_prefix = strdup(optarg); + break; + + case 'o': +- log_format = optarg; ++ log_format = strdup(optarg); + if (!log_format || !*log_format || !valid_format()) + { + fprintf(stderr, diff --git a/app-admin/cancd/files/cancd-conf.d b/app-admin/cancd/files/cancd-conf.d new file mode 100644 index 00000000000..8a46f420e42 --- /dev/null +++ b/app-admin/cancd/files/cancd-conf.d @@ -0,0 +1,20 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# user to run as, root strongly discouraged +# user should have /bin/false for a shell +# but file access into /var +CHUID='adm:nobody' + +# port to listen on +CANCD_PORT=6667 + +# directory to output to +CRASH_DIR=/var/crash + +# one file per minute, one dir per host/date +#CRASH_FORMAT="%Q/%Y-%m-%d/%H:%M.log" +# one file per day, one dir per host +CRASH_FORMAT="%Q/%Y-%m-%d.log" diff --git a/app-admin/cancd/files/cancd-init.d b/app-admin/cancd/files/cancd-init.d new file mode 100644 index 00000000000..8031ca00ec3 --- /dev/null +++ b/app-admin/cancd/files/cancd-init.d @@ -0,0 +1,23 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + need net +} + +start() { + mkdir -p ${CRASH_DIR} + chown ${CHUID} ${CRASH_DIR} + chmod 700 ${CRASH_DIR} + ebegin "Starting cancd" + start-stop-daemon --start --quiet --user ${CHUID} --exec /usr/sbin/cancd -- -p ${CANCD_PORT} -l "${CRASH_DIR}" -o "${CRASH_FORMAT}" + eend ${?} +} + +stop() { + ebegin "Stopping cancd" + start-stop-daemon --stop --quiet --exec /usr/sbin/cancd + eend ${?} +} diff --git a/app-admin/cancd/files/netconsole-conf.d b/app-admin/cancd/files/netconsole-conf.d new file mode 100644 index 00000000000..9db98b781e3 --- /dev/null +++ b/app-admin/cancd/files/netconsole-conf.d @@ -0,0 +1,28 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# required! +TGT_IP='' + +DEVICE=eth0 + +SRC_IP='' +# will default to first address on $DEVICE +# must be specified if the device does not have an IP at init time +SRC_PORT=6665 # default + +# note that cancd daemon uses 6667 as default +# but netconsole.txt says 6666 is the default +TGT_PORT=6667 + +# if you want to broadcast, specify 'broadcast' here. +# it's a security hole on an untrusted network. +TGT_MAC='' + +LOGLEVEL='1' +# LOGLEVEL are the kernel console logging levels +# [0..7] = EMERG,ALERT,CRIT,ERR,WARNING,NOTICE,INFO,DEBUG +# 1 means only kernel panics are reported (default) +# this affects all console logging +# see syslog(2) for more info diff --git a/app-admin/cancd/files/netconsole-init.d b/app-admin/cancd/files/netconsole-init.d new file mode 100644 index 00000000000..e94aeab468d --- /dev/null +++ b/app-admin/cancd/files/netconsole-init.d @@ -0,0 +1,68 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + need net +} + +start() { + checkconfig || return 1 + if [ -z "${TGT_MAC}" ]; then + LC_ALL=C /bin/ping -nq -c 3 "${TGT_IP}" -I "${DEVICE}" 1>/dev/null 2>/dev/null + ret=$? + # ping worked, try arp + if [ $ret -eq 0 ]; then + TGT_MAC="$(LC_ALL=C arp -an -i ${DEVICE} ${TGT_IP} |egrep -v 'incomplete|no match' | awk '{print $4}')" + fi + elif [ "${TGT_MAC}" == "broadcast" ]; then + TGT_MAC='' + fi + ebegin "Starting netconsole ${SRC_IP}:${SRC_PORT}(${DEVICE}) -> ${TGT_IP}:${TGT_PORT} ${TGT_MAC}" + # else we use the MAC that we are given + modprobe netconsole netconsole=${SRC_PORT}@${SRC_IP}/${DEVICE},${TGT_PORT}@${TGT_IP}/${TGT_MAC} + ret=$? + [ $ret -eq 0 ] && dmesg -n ${LOGLEVEL} + eend $ret +} + +stop() { + ebegin "Stopping netconsole" + modprobe -r netconsole + eend $? +} + +checkconfig() { + # kernel uses 15 internally + if [ "$LOGLEVEL" -lt 0 -o "${LOGLEVEL}" -gt 15 ]; then + eerror "Invalid kernel console loglevel." + return 1 + fi + + if [ "$SRC_PORT" -le 0 ]; then + eerror "Invalid source port." + return 1 + fi + + LC_ALL=C ifconfig "${DEVICE}" 1>/dev/null 2>/dev/null + ret=$? + + if [ -z "${DEVICE}" -o "${ret}" -gt 0 ]; then + eerror "Source device invalid." + return 1 + fi + + if [ "$TGT_PORT" -le 0 ]; then + eerror "Invalid target port." + return 1 + fi + + if [ -z "$TGT_IP" ]; then + eerror "Unspecified target address." + return 1 + fi + + return 0 +} +# vim: ts=4 sw=4 sts=4: diff --git a/app-admin/cancd/metadata.xml b/app-admin/cancd/metadata.xml new file mode 100644 index 00000000000..a732fd8b2f0 --- /dev/null +++ b/app-admin/cancd/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer> + <email>robbat2@gentoo.org</email> + <name>Robin H. Johnson</name> + </maintainer> +</pkgmetadata> |