Subject: [alpine-aports] [PATCH v2] testing/metalog: new aport

From: Milan P. Stanić <[email-masked]>
Date: Sat, 2 Mar 2019 13:20:19 +0100

---
Changes v1 -> v2:
 - pidfile uses /run instead of /var/run
 - replace initd script with initd stolen from Gentoo
 testing/metalog/APKBUILD      | 53 +++++++++++++++++++++++++++++++++++
 testing/metalog/metalog.confd | 10 +++++++
 testing/metalog/metalog.initd | 28 ++++++++++++++++++
 3 files changed, 91 insertions(+)
 create mode 100644 testing/metalog/APKBUILD
 create mode 100644 testing/metalog/metalog.confd
 create mode 100644 testing/metalog/metalog.initd

diff --git a/testing/metalog/APKBUILD b/testing/metalog/APKBUILD
new file mode 100644
index 0000000000..b5c4e4689e
--- /dev/null
+++ b/testing/metalog/APKBUILD
@@ -0,0 +1,53 @@
+# Contributor: Milan P. Stanić <[email-masked]>
+# Maintainer: Milan P. Stanić <[email-masked]>
+pkgname=metalog
+pkgver=20181125
+pkgrel=0
+pkgdesc="small, simple to config, flexible syslogd/klogd daemon"
+url="https://github.com/hvisage/metalog"
+arch="all"
+license="GPL-2.0-only"
+depends=""
+makedepends="pcre-dev automake autoconf autoconf-archive"
+subpackages="$pkgname-doc $pkgname-openrc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/hvisage/metalog/archive/${pkgver}.tar.gz
+	metalog.initd
+	metalog.confd
+	"
+builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+	cd "$builddir"
+	./autogen.sh
+}
+
+build() {
+	cd "$builddir"
+	./configure \
+		--build=$CBUILD \
+		--host=$CHOST \
+		--prefix=/usr \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--localstatedir=/var
+	make
+}
+
+check() {
+	cd "$builddir"
+	make check
+}
+
+package() {
+	cd "$builddir"
+	make DESTDIR="$pkgdir" install
+
+	install -m755 -D "$srcdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname
+	install -m644 -D "$srcdir"/$pkgname.confd \
+		"$pkgdir"/etc/conf.d/$pkgname
+}
+
+sha512sums="8ab6713e158a50a330efd0f81764bb4e9be16da3194eea8043d3758474171841adbca86c735a387b87df7f69b1567d3fcf320fc5dfcd5b6ad88f7ce4c6622d58  metalog-20181125.tar.gz
+09d8ac585418c6a3dfccc9d0f1a050b5862924712d78dc44fce3cb497bb362afe0a556240b14cf957fcdf64d0d06f5b6a8df4372c69129b43dc3520ecd310344  metalog.initd
+1efbc74e23abef06bd62b35bb1f4166b86b5b4618d81e8eb085b4c9b45d0c4319b6db19a24648f7010400eed05c2486e16f16176a0e5435d7f263492934019c6  metalog.confd"
diff --git a/testing/metalog/metalog.confd b/testing/metalog/metalog.confd
new file mode 100644
index 0000000000..2f3630d03d
--- /dev/null
+++ b/testing/metalog/metalog.confd
@@ -0,0 +1,10 @@
+# Configuration file
+CONFIGFILE="/etc/metalog.conf"
+
+# PID file
+PIDFILE="/run/metalog.pid"
+
+# Options to metalog
+# "-B" start server in background/daemon mode
+# "-s" tells metalog to run in sync mode
+METALOG_OPTS="-B -s"
diff --git a/testing/metalog/metalog.initd b/testing/metalog/metalog.initd
new file mode 100644
index 0000000000..bb947bdadf
--- /dev/null
+++ b/testing/metalog/metalog.initd
@@ -0,0 +1,28 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+pidfile="${PIDFILE:-/run/metalog.pid}"
+command="/usr/sbin/metalog"
+command_args="--pidfile=${pidfile} --daemonize ${METALOG_OPTS}"
+
+extra_started_commands="buffer unbuffer"
+
+depend() {
+	need localmount
+	use clock hostname
+	after bootmisc
+	provide logger
+}
+
+buffer() {
+	ebegin "Enabling log buffering"
+	start-stop-daemon --exec "${command}" --signal USR2 --pidfile "${pidfile}"
+	eend ${?}
+}
+
+unbuffer() {
+	ebegin "Disabling log buffering"
+	start-stop-daemon --exec "${command}" --signal USR1 --pidfile "${pidfile}"
+	eend ${?}
+}
-- 
2.20.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---