Subject: [alpine-devel] [PATCH] Initial APKBUILD for inetutils-syslogd

From: IT Offshore <[email-masked]>
Date: Sat, 2 Nov 2013 23:16:07 +0000

inetutils-syslogd into testing to provide logging to multiple different log files
rather than just /var/log/messages:

inetutils-syslogd.post-install = removes busybox syslog boot dependency & service
                                 & adds / starts inetutils-syslogd

inetutils-syslogd.post-deinstall = gives option to reinstate busybox syslog service

syslog.conf = settings to split log files
---
 testing/inetutils-syslogd/APKBUILD                 | 84 ++++++++++++++++++++++
 testing/inetutils-syslogd/inetutils-syslogd.confd  |  9 +++
 testing/inetutils-syslogd/inetutils-syslogd.initd  | 38 ++++++++++
 .../inetutils-syslogd.post-deinstall               | 16 +++++
 .../inetutils-syslogd.post-install                 | 11 +++
 testing/inetutils-syslogd/syslog.conf              |  7 ++
 6 files changed, 165 insertions(+)
 create mode 100644 testing/inetutils-syslogd/APKBUILD
 create mode 100644 testing/inetutils-syslogd/inetutils-syslogd.confd
 create mode 100644 testing/inetutils-syslogd/inetutils-syslogd.initd
 create mode 100644 testing/inetutils-syslogd/inetutils-syslogd.post-deinstall
 create mode 100644 testing/inetutils-syslogd/inetutils-syslogd.post-install
 create mode 100644 testing/inetutils-syslogd/syslog.conf

diff --git a/testing/inetutils-syslogd/APKBUILD b/testing/inetutils-syslogd/APKBUILD
new file mode 100644
index 0000000..685dadc
--- /dev/null
+++ b/testing/inetutils-syslogd/APKBUILD
@@ -0,0 +1,84 @@
+# Contributor: IT Offshore <[email-masked]>
+# Maintainer:
+pkgname=inetutils-syslogd
+_pkgname=inetutils
+pkgver=1.9.1
+pkgrel=0
+pkgdesc="A small syslogd for logging to multiple files"
+url="http://www.gnu.org/software/inetutils/"
+arch="all"
+license="GPL3"
+depends="readline ncurses"
+depends_dev=""
+makedepends="$depends_dev"
+install="$pkgname.post-install $pkgname.post-deinstall"
+subpackages="$pkgname-doc"
+source="http://ftp.gnu.org/gnu/inetutils/${_pkgname}-${pkgver}.tar.gz
+	inetutils-syslogd.initd
+	inetutils-syslogd.confd
+	syslog.conf
+	"
+
+_builddir="$srcdir"/$_pkgname-$pkgver
+
+build() {
+	cd "$_builddir"
+
+        ./configure \
+                --build=$CBUILD \
+                --host=$CHOST \
+                --prefix=/usr \
+		--libexec=/usr/sbin \
+                --sysconfdir=/etc \
+                --mandir=/usr/share/man \
+                --infodir=/usr/share/info \
+                --localstatedir=/var \
+		--without-wrap --without-pam \
+                --disable-ftp --disable-ftpd \
+      		--disable-telnet --disable-telnetd \
+         	--disable-talk --disable-talkd \
+         	--disable-rlogin --disable-rlogind \
+         	--disable-rsh --disable-rshd \
+	        --disable-rexec --disable-rexecd \
+        	--disable-rcp --disable-hostname \
+	        --disable-tftp --disable-tftpd \
+        	--disable-ping --disable-ping6 \
+	        --disable-logger --enable-syslogd \
+        	--disable-inetd --disable-whois \
+	        --disable-uucpd --disable-ifconfig --disable-traceroute \
+		|| return 1
+        make || return 1
+}
+
+check() {
+  cd "$srcdir/${_pkgname}-${pkgver}"
+  make check
+}
+
+package() {
+	cd "$_builddir"
+	make DESTDIR="${pkgdir}" install
+	#binary installed to /usr/sbin not bin
+	rm -rf $pkgdir/usr/bin
+
+	#install init script & config defaults
+        install -m755 -D "$srcdir"/$pkgname.initd \
+                "$pkgdir"/etc/init.d/$pkgname || return 1
+        install -m644 -D "$srcdir"/$pkgname.confd \
+                "$pkgdir"/etc/conf.d/$pkgname || return 1
+	install -m644 -D "$srcdir"/syslog.conf \
+                "$pkgdir"/etc/syslog.conf || return 1
+}
+
+md5sums="944f7196a2b3dba2d400e9088576000c  inetutils-1.9.1.tar.gz
+7d2493f77f73881ba9739bf8d9f26d2b  inetutils-syslogd.initd
+edf3f502d9f2bf49c5da8cb37a927d06  inetutils-syslogd.confd
+4bc7a98aeb3474c3629a36e0bba18cec  syslog.conf"
+sha256sums="02a9ebde8a198cb85f87545b9d88fb103a183958139864a85fe9e027ad79ff2b  inetutils-1.9.1.tar.gz
+6af455ba9487ae9013b776b9fc1d1149ba571bcee99331475e889842a9aeb415  inetutils-syslogd.initd
+86105f0a0105f50275f7381b5d7fe603b8d854a0e6753c2f06f6d0c234562948  inetutils-syslogd.confd
+d15f64699543cbaf048ee10499e301cf7a0bfb65eb26db8430f35c5004de405d  syslog.conf"
+sha512sums="69267bfa3cae34f6145caad668dc2e9385701fb52a144640e9893fa7f0b7694eacd1fe579de3fb7190e8485b26c00337ded136488694c399b0fc290f7eec303c  inetutils-1.9.1.tar.gz
+3b20fa8fa058b9e93213012730f18fbb481caeee4a731e61c4144a361400b949c6b1029a5badf16cd959266189dab710272feb7a25b181ef3b2c374a5a25c9a1  inetutils-syslogd.initd
+82968692b4fe79706aacaeb1021b343288dc4f1d86925481796dac1f743a8269976ce86bf446cd0c16d246b918e5822e312660b201407eb7031a17cb398c9513  inetutils-syslogd.confd
+0f32c73957e4c1829779a543ce7fbb3de0f17a4331b5f8de33d4c9c9fd5f58e47942d102e117fefe5392c07dd3c9e72d2717a1244e80f54ab7e61ec263340485  syslog.conf"
diff --git a/testing/inetutils-syslogd/inetutils-syslogd.confd b/testing/inetutils-syslogd/inetutils-syslogd.confd
new file mode 100644
index 0000000..dfcc1cb
--- /dev/null
+++ b/testing/inetutils-syslogd/inetutils-syslogd.confd
@@ -0,0 +1,9 @@
+#
+# inetutils syslogd defaults
+#
+
+# Internet connections are enabled if forwarding (which is the default).
+# Example option to add a socket for chroot jailed openvpn server
+#SYSLOGD_OPTS="--no-forward -a /etc/openvpn/jail/dev/log"
+
+SYSLOGD_OPTS="--no-forward"
diff --git a/testing/inetutils-syslogd/inetutils-syslogd.initd b/testing/inetutils-syslogd/inetutils-syslogd.initd
new file mode 100644
index 0000000..bf53c7b
--- /dev/null
+++ b/testing/inetutils-syslogd/inetutils-syslogd.initd
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+
+# This file is part of inetutils-syslogd
+# Created for Alpine Linux by IT Offshore <[email-masked]>
+
+name=syslogd
+daemon=/usr/sbin/$name
+config_file="/etc/syslog.conf"
+
+depend() {
+	need clock hostname localmount
+        provide logger
+}
+
+check_config() {
+        [ -f "$config_file" ] || error "$config_file is missing"
+}
+
+start_pre() {
+        check_config || return 1
+}
+
+start() {
+	ebegin "Starting ${name}"
+		start-stop-daemon --start --quiet \
+			--pidfile /var/run/${name}.pid \
+			--exec ${daemon} -- ${SYSLOGD_OPTS}
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping ${name}"
+		start-stop-daemon --stop --quiet \
+			--pidfile /var/run/$name.pid \
+			--exec ${daemon}
+	eend $?
+}
+
diff --git a/testing/inetutils-syslogd/inetutils-syslogd.post-deinstall b/testing/inetutils-syslogd/inetutils-syslogd.post-deinstall
new file mode 100644
index 0000000..e0af5f0
--- /dev/null
+++ b/testing/inetutils-syslogd/inetutils-syslogd.post-deinstall
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+print_info() {
+    echo -n -e '\e[1;36m'
+    echo -n $1
+    echo -e '\e[0m'
+}
+
+print_info "Would you like to re-enable BusyBox Syslog ? (enter or y to re-enable): "; read enable_syslog
+
+if [ -z "$enable_syslog" ] || [ "$enable_syslog" = "y" ] || [ "$enable_syslog" = "Y" ]; then
+   rc-update add syslog boot
+   rc-service syslog start
+   #removing any syslog also stops cron as it depends on logger
+   rc-service cron start
+fi
diff --git a/testing/inetutils-syslogd/inetutils-syslogd.post-install b/testing/inetutils-syslogd/inetutils-syslogd.post-install
new file mode 100644
index 0000000..d92a3c1
--- /dev/null
+++ b/testing/inetutils-syslogd/inetutils-syslogd.post-install
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# stop & remove busybox syslog service
+rc-update syslog stop
+rc-update del syslog boot
+# add & start inetutils-syslogd
+rc-update add inetutils-syslogd boot
+rc-service inetutils-syslogd start
+# stopping any syslog also stops cron which depends on logger
+rc-service cron start
+exit 0
diff --git a/testing/inetutils-syslogd/syslog.conf b/testing/inetutils-syslogd/syslog.conf
new file mode 100644
index 0000000..9f3b01f
--- /dev/null
+++ b/testing/inetutils-syslogd/syslog.conf
@@ -0,0 +1,7 @@
+# split syslog into different files
+*.*;mail.none;cron.none;auth.none;authpriv.none -/var/log/messages
+cron.* -/var/log/cron
+mail.* -/var/log/mail
+auth.* -/var/log/auth.log
+authpriv.* -/var/log/auth.log
+
-- 
1.8.4.2

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