diff --git a/app-admin/cancd/cancd-0.1.0-r3.ebuild b/app-admin/cancd/cancd-0.1.0-r4.ebuild similarity index 69% rename from app-admin/cancd/cancd-0.1.0-r3.ebuild rename to app-admin/cancd/cancd-0.1.0-r4.ebuild index 6ad37a6163ffc..d662129917517 100644 --- a/app-admin/cancd/cancd-0.1.0-r3.ebuild +++ b/app-admin/cancd/cancd-0.1.0-r4.ebuild @@ -1,11 +1,11 @@ # 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" @@ -14,9 +14,14 @@ SLOT="0" 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,,' \ @@ -27,11 +32,12 @@ src_prepare() { 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 } diff --git a/app-admin/cancd/files/cancd-0.1.0-build.patch b/app-admin/cancd/files/cancd-0.1.0-build-r1.patch similarity index 89% rename from app-admin/cancd/files/cancd-0.1.0-build.patch rename to app-admin/cancd/files/cancd-0.1.0-build-r1.patch index b1c99b1cd5652..19bc929b2bc09 100644 --- a/app-admin/cancd/files/cancd-0.1.0-build.patch +++ b/app-admin/cancd/files/cancd-0.1.0-build-r1.patch @@ -2,8 +2,8 @@ fix building with newer glibc http://bugs.gentoo.org/246734 ---- cancd.c -+++ cancd.c +--- a/cancd.c ++++ b/cancd.c @@ -36,6 +36,7 @@ #include #include diff --git a/app-admin/cancd/files/cancd-conf.d b/app-admin/cancd/files/cancd-conf.d deleted file mode 100644 index 7b4dd27383c01..0000000000000 --- a/app-admin/cancd/files/cancd-conf.d +++ /dev/null @@ -1,19 +0,0 @@ -#!/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" diff --git a/app-admin/cancd/files/cancd-conf.d-r1 b/app-admin/cancd/files/cancd-conf.d-r1 new file mode 100644 index 0000000000000..13322298f28b5 --- /dev/null +++ b/app-admin/cancd/files/cancd-conf.d-r1 @@ -0,0 +1,14 @@ +#!/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" diff --git a/app-admin/cancd/files/cancd-init.d b/app-admin/cancd/files/cancd-init.d deleted file mode 100644 index eb0d34e1a2eea..0000000000000 --- a/app-admin/cancd/files/cancd-init.d +++ /dev/null @@ -1,22 +0,0 @@ -#!/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 ${?} -} diff --git a/app-admin/cancd/files/cancd-init.d-r1 b/app-admin/cancd/files/cancd-init.d-r1 new file mode 100644 index 0000000000000..a2a96f1ce81c6 --- /dev/null +++ b/app-admin/cancd/files/cancd-init.d-r1 @@ -0,0 +1,22 @@ +#!/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}" +}