commit: 1680b7c15e41b99f5282998254a0dc68718dbe57 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> AuthorDate: Mon Nov 18 11:45:06 2019 +0000 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> CommitDate: Mon Nov 18 11:51:50 2019 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1680b7c1
app-admin/sysklogd: Bump to version 2.0 Package-Manager: Portage-2.3.79, Repoman-2.3.18 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org> app-admin/sysklogd/Manifest | 1 + .../files/sysklogd-2.0-optional_logger.patch | 101 +++++++++++++++++++++ app-admin/sysklogd/files/sysklogd.rc8 | 82 +++++++++++++++++ app-admin/sysklogd/metadata.xml | 1 + app-admin/sysklogd/sysklogd-2.0.ebuild | 58 ++++++++++++ 5 files changed, 243 insertions(+) diff --git a/app-admin/sysklogd/Manifest b/app-admin/sysklogd/Manifest index dc3c1683a77..dadb261979f 100644 --- a/app-admin/sysklogd/Manifest +++ b/app-admin/sysklogd/Manifest @@ -1,2 +1,3 @@ DIST sysklogd-1.5.1.tar.gz 90011 BLAKE2B c40bd8d5769f7d3d4141d602c74ac41e05a140743d18c4923d9368da7ba193ccb89a6837173994f0b7a9c290cc23f64513040434d7ab8df81b5d09b73b0263ad SHA512 a72196a1a172d25be1c4791ef6256fe71fa2ba8c1383d230e646e93f8a65c3a57c535189726325da4c792fdb2e9cb119bba43c878816a8e78e78189fd32b12b7 +DIST sysklogd-2.0.tar.gz 465822 BLAKE2B 030ce2e65287d215d376937aec590715abcac06dffef735038c31ee102eb00d5c616bfd2f3d378e53ef6ae4aa062e9802aaaca84a6f5598b43da35ee722d37ac SHA512 25b55b8ea47280c11959e03d5a8c592e1b02764b4aeb722ef9782d84116475f1bbba96d6db8c291b694d99c7970e2e7615e7cd48b8fef6dff4f9ae825e18d030 DIST sysklogd_1.5-6.diff.gz 25677 BLAKE2B 3cb1f596490998b6002d4656a2321a500ce9941a37737c0b9d4702bbb87d7bc9ba21b68e06d175e3c1714a701adc6b3312e18a556ebc9ef395d8968762830cb5 SHA512 816961a835a43057569f62fd20d9f7b5e0bfcfcb173b68947457708504db3ce47e635956c8a9564f9bd577d8f3c49dfc725d321dfd3370b2de918363c30f838e diff --git a/app-admin/sysklogd/files/sysklogd-2.0-optional_logger.patch b/app-admin/sysklogd/files/sysklogd-2.0-optional_logger.patch new file mode 100644 index 00000000000..4e5580b0422 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd-2.0-optional_logger.patch @@ -0,0 +1,101 @@ +From 227008ec0f59eecf3a962ebd9fbc27a0e475a4df Mon Sep 17 00:00:00 2001 +From: Lars Wendler <polynomia...@gentoo.org> +Date: Mon, 18 Nov 2019 12:08:26 +0100 +Subject: [PATCH] build: make logger and its man page optional + +There are other packages that provide a logger program like util-linux +We should respekt that + +Signed-off-by: Lars Wendler <polynomia...@gentoo.org> +--- + configure.ac | 10 ++++++++++ + man/Makefile.am | 6 +++++- + src/Makefile.am | 8 +++++++- + 3 files changed, 22 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 37c0bd4..e7acad7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -65,6 +65,10 @@ AC_ARG_WITH(systemd, + [AS_HELP_STRING([--with-systemd=DIR], [Directory for systemd service files])],, + [with_systemd=auto]) + ++AC_ARG_WITH(logger, ++ AS_HELP_STRING([--without-logger], [Do not build/install logger binary and man page, default: enabled]), ++ [logger=$withval], [logger='yes']) ++ + AS_IF([test "x$klogd" != "xno"], + with_klogd="yes" + AC_DEFINE(KLOGD, 1, [Build with klogd, default: built-in /dev/kmsg support in syslogd]), +@@ -97,6 +101,12 @@ AS_IF([test "x$with_systemd" != "xno"], + [AC_SUBST([systemddir], [$with_systemd])]) + AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemd" != "xno"]) + ++AS_IF([test "x$logger" != "xno"], [ ++ with_logger="yes" ++ AC_DEFINE(LOGGER, 1, [Build with logger])], ++ with_logger="no") ++AM_CONDITIONAL([ENABLE_LOGGER], [test "x$with_logger" != "xno"]) ++ + # Expand $sbindir early, into $SBINDIR, for systemd unit file + # NOTE: This does *not* take prefix/exec_prefix override at "make + # install" into account, unfortunately. +diff --git a/man/Makefile.am b/man/Makefile.am +index 8ee7064..8ccad31 100644 +--- a/man/Makefile.am ++++ b/man/Makefile.am +@@ -1,4 +1,4 @@ +-dist_man1_MANS = logger.1 ++dist_man1_MANS = + dist_man3_MANS = syslogp.3 + dist_man5_MANS = syslog.conf.5 + dist_man8_MANS = syslogd.8 +@@ -6,3 +6,7 @@ dist_man8_MANS = syslogd.8 + if ENABLE_KLOGD + dist_man8_MANS += klogd.8 + endif ++ ++if ENABLE_LOGGER ++dist_man1_MANS += logger.1 ++endif +diff --git a/src/Makefile.am b/src/Makefile.am +index 85f747b..849e49b 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -16,7 +16,7 @@ + # with this program; if not, write to the Free Software Foundation, Inc., + # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +-bin_PROGRAMS = logger ++bin_PROGRAMS = + sbin_PROGRAMS = syslogd + lib_LTLIBRARIES = libsyslog.la + noinst_LTLIBRARIES = libcompat.la +@@ -25,6 +25,10 @@ if ENABLE_KLOGD + sbin_PROGRAMS += klogd + endif + ++if ENABLE_LOGGER ++bin_PROGRAMS += logger ++endif ++ + AM_CFLAGS = -W -Wall -Wextra + AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing + AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\" -DLOCALSTATEDIR=\"@localstatedir@\" +@@ -39,10 +43,12 @@ klogd_CPPFLAGS = $(AM_CPPFLAGS) + klogd_LDADD = $(LIBS) $(LIBOBJS) + klogd_LDADD += libsyslog.la + ++if ENABLE_LOGGER + logger_SOURCES = logger.c syslog.h + logger_CPPFLAGS = $(AM_CPPFLAGS) -D_XOPEN_SOURCE=600 + logger_LDADD = $(LIBS) $(LIBOBJS) + logger_LDADD += libsyslog.la ++endif + + # Convenience library for libsyslog instead of linking with $(LTLIBOBJS), + # which would pull in pidfile() and other (strong) symbols as well. +-- +2.24.0 + diff --git a/app-admin/sysklogd/files/sysklogd.rc8 b/app-admin/sysklogd/files/sysklogd.rc8 new file mode 100644 index 00000000000..6b411d55c98 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd.rc8 @@ -0,0 +1,82 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License, v2 or later + +extra_started_commands="reload" + +depend() { + need clock hostname + provide logger +} + +has_klogd() { + [ -x "/usr/sbin/klogd" ] +} + +start_daemon() { + local retval=0 + local daemon="$1" + local options="$2" + + [ -z "${daemon}" ] && return 1 + + ebegin "sysklogd -> start: ${daemon}" + start-stop-daemon --start --exec /usr/sbin/"${daemon}" \ + --pidfile /var/run/"${daemon}".pid -- ${options} + retval=$? + eend ${retval} "Failed to start ${daemon}" + + return ${retval} +} + +stop_daemon() { + local retval=0 + local daemon="$1" + + [ -z "${daemon}" ] && return 1 + + ebegin "sysklogd -> stop: ${daemon}" + # syslogd can be stubborn some times (--retry 15)... + start-stop-daemon --stop --retry 15 --quiet --pidfile /var/run/"${daemon}".pid + retval=$? + eend ${retval} "Failed to stop ${daemon}" + + return ${retval} +} + +start() { + start_daemon "syslogd" "${SYSLOGD}" || return 1 + + # klogd do not always start proper if started too early + sleep 1 + + if has_klogd && ! start_daemon "klogd" "${KLOGD}" ; then + stop_daemon "syslogd" + return 1 + fi + + return 0 +} + +stop() { + if has_klogd ; then + stop_daemon "klogd" || return 1 + fi + stop_daemon "syslogd" || return 1 + return 0 +} + +reload() { + local ret=0 + + ebegin "Reloading configuration" + + start-stop-daemon --signal HUP --pidfile /var/run/syslogd.pid + ret=$((${ret} + $?)) + if has_klogd ; then + start-stop-daemon --signal USR1 --pidfile /var/run/klogd.pid + ret=$((${ret} + $?)) + fi + + eend ${ret} +} diff --git a/app-admin/sysklogd/metadata.xml b/app-admin/sysklogd/metadata.xml index 094ccd37b3f..868e8ae726d 100644 --- a/app-admin/sysklogd/metadata.xml +++ b/app-admin/sysklogd/metadata.xml @@ -6,6 +6,7 @@ <name>Gentoo Base System</name> </maintainer> <use> + <flag name="klogd">Build and install (deprecated) kernel logging daemon</flag> <flag name="logrotate">use app-admin/logrotate for rotating logs rather than custom cron scripts</flag> </use> </pkgmetadata> diff --git a/app-admin/sysklogd/sysklogd-2.0.ebuild b/app-admin/sysklogd/sysklogd-2.0.ebuild new file mode 100644 index 00000000000..e3fa8796ba4 --- /dev/null +++ b/app-admin/sysklogd/sysklogd-2.0.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools flag-o-matic systemd toolchain-funcs + +DESCRIPTION="Standard log daemons" +HOMEPAGE="https://github.com/troglobit/sysklogd" +SRC_URI="https://github.com/troglobit/sysklogd/releases/download/v$(ver_cut 1-2)/${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="klogd logrotate systemd" +RESTRICT="test" + +DEPEND="" +RDEPEND="" + +DOCS=( ChangeLog.md README.md ) + +PATCHES=( + ${FILESDIR}/${PN}-2.0-optional_logger.patch +) + +pkg_setup() { + append-lfs-flags + tc-export CC +} + +src_prepare() { + default + eautoreconf +} + +src_configure() { + local myeconfargs=( + # we have logger from sys-apps/util-linux + #--without-logger + $(use_with klogd) + $(use_with systemd systemd $(systemd_get_systemunitdir)) + ) + econf "${myeconfargs[@]}" +} + +src_install() { + default + + insinto /etc + doins syslog.conf + keepdir /etc/syslog.d + + find "${ED}" -type f \( -name "*.a" -o -name "*.la" \) -delete || die + + newinitd "${FILESDIR}"/sysklogd.rc8 sysklogd + newconfd "${FILESDIR}"/sysklogd.confd sysklogd +}