commit:     c9aa851c802c02cb922d616ad1b5e32c8efa67af
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 17 23:33:46 2017 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sun Dec 17 23:33:46 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9aa851c

app-admin/cancd: modernize the service script and ebuild.

This commit creates a new revision (-r4) that replaces the earlier
unstable -r3. The ebuild itself includes an update to EAPI=6 and the
associated simplifications, as well as the addition of a new user
named "cancd" that is used by the init script.

The service script was completely rewritten and simplified, and now
uses more modern features of OpenRC. The original motivation for
that was bug 603208.

This is a non-maintainer commit, but robbat2 (the maintainer on file)
recently made a post to gentoo-dev, "Packages up for grabs: robbat2
edition," stating that this package was up for grabs.

Closes: https://bugs.gentoo.org/603208
Package-Manager: Portage-2.3.13, Repoman-2.3.3

 ...cancd-0.1.0-r3.ebuild => cancd-0.1.0-r4.ebuild} | 26 +++++++++++++---------
 ....1.0-build.patch => cancd-0.1.0-build-r1.patch} |  4 ++--
 app-admin/cancd/files/cancd-conf.d                 | 19 ----------------
 app-admin/cancd/files/cancd-conf.d-r1              | 14 ++++++++++++
 app-admin/cancd/files/cancd-init.d                 | 22 ------------------
 app-admin/cancd/files/cancd-init.d-r1              | 22 ++++++++++++++++++
 6 files changed, 54 insertions(+), 53 deletions(-)

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 6ad37a6163f..d6621299175 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 b1c99b1cd56..19bc929b2bc 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 <libgen.h>
  #include <getopt.h>

diff --git a/app-admin/cancd/files/cancd-conf.d 
b/app-admin/cancd/files/cancd-conf.d
deleted file mode 100644
index 7b4dd27383c..00000000000
--- 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 00000000000..13322298f28
--- /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 eb0d34e1a2e..00000000000
--- 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 00000000000..a2a96f1ce81
--- /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}"
+}

Reply via email to