# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-EAPI=5
+EAPI=6
-inherit eutils
+inherit user
-DESCRIPTION="the CA NetConsole Daemon receives output from the Linux netconsole driver"
+DESCRIPTION="CA NetConsole Daemon receives 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"
KEYWORDS="~amd64 ~x86"
IUSE=""
+PATCHES=(
+ "${FILESDIR}/${P}-build-r1.patch"
+ "${FILESDIR}/${P}-c-cleanup.patch"
+)
+
src_prepare() {
- epatch "${FILESDIR}"/${P}-build.patch #246734
- epatch "${FILESDIR}"/${P}-c-cleanup.patch
+ default
+
# slight makefile cleanup
sed -i \
-e '/^CFLAGS/s,-g,,' \
src_install() {
dosbin cancd
- newinitd "${FILESDIR}"/cancd-init.d cancd
- newconfd "${FILESDIR}"/cancd-conf.d cancd
+ newinitd "${FILESDIR}"/cancd-init.d-r1 cancd
+ newconfd "${FILESDIR}"/cancd-conf.d-r1 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
+}
+
+pkg_preinst() {
+ enewuser cancd
}
http://bugs.gentoo.org/246734
---- cancd.c
-+++ cancd.c
+--- a/cancd.c
++++ b/cancd.c
@@ -36,6 +36,7 @@
#include <libgen.h>
#include <getopt.h>
+++ /dev/null
-#!/sbin/openrc-run
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# 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"
--- /dev/null
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# port to listen on
+CANCD_PORT=6667
+
+# directory to output to
+CANCD_LOG_DIR=/var/log/cancd
+
+# one file per minute, one dir per host/date
+#CANCD_LOG_FORMAT="%Q/%Y-%m-%d/%H:%M.log"
+# one file per day, one dir per host
+CANCD_LOG_FORMAT="%Q/%Y-%m-%d.log"
+++ /dev/null
-#!/sbin/openrc-run
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-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 ${?}
-}
--- /dev/null
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/usr/sbin/cancd"
+command_args="-p ${CANCD_PORT}
+ -l ${CANCD_LOG_DIR}
+ -o ${CANCD_LOG_FORMAT}"
+command_user="cancd"
+
+# cancd daemonizes itself, but doesn't write a PID file and doesn't
+# have an option to run in the foreground. So the best we can do
+# is try to match the process name when stopping it.
+procname="cancd"
+
+depend() {
+ need net
+}
+
+start_pre() {
+ checkpath --directory --owner cancd --mode 0700 "${CANCD_LOG_DIR}"
+}