Mail archive
alpine-aports

[alpine-aports] [PATCH] main/nsd: new openrc-run'ed init-script. APKBUILD cleanups

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Sun, 20 Dec 2015 18:45:34 +0200

---
 main/nsd/APKBUILD        | 27 ++++++++++--------------
 main/nsd/nsd.initd       | 53 ++++++++++++------------------------------------
 main/nsd/nsd.pre-install |  2 +-
 3 files changed, 25 insertions(+), 57 deletions(-)
diff --git a/main/nsd/APKBUILD b/main/nsd/APKBUILD
index bd340a3..39d2656 100644
--- a/main/nsd/APKBUILD
+++ b/main/nsd/APKBUILD
_at_@ -1,9 +1,10 @@
+# Contributor: Valery Kartel <valery.kartel_at_gmail.com>
 # Contributor: Matt Smith <mcs_at_darkregion.net>
 # Contributor: Leonardo Arena <rnalrd_at_alpinelinux.org>
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
 pkgname=nsd
 pkgver=4.1.7
-pkgrel=0
+pkgrel=1
 pkgdesc="NSD is an authoritative only, high performance, simple and open source name server."
 url="http://www.nlnetlabs.nl/projects/nsd/"
 arch="all"
_at_@ -49,25 +50,19 @@ package() {
 	make DESTDIR="$pkgdir" install || return 1
 
 	install -m755 -D "$srcdir"/$pkgname.initd \
-		"$pkgdir"/etc/init.d/nsd || return 1
+		"$pkgdir"/etc/init.d/$pkgname || return 1
 
-	chown nsd.nsd "$pkgdir"/var/db/nsd || return 1
-	chown nsd.nsd "$pkgdir"/var/run/nsd || return 1
-}
+	install -d "$pkgdir"/usr/share/doc/$pkgname
+	cp -a "$_builddir"/doc/* "$_builddir"/contrib \
+		"$pkgdir"/usr/share/doc/$pkgname/
 
-doc() {
-	arch="noarch"
-	default_doc || return 1
-	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname || return 1
-	cp -a "$_builddir"/doc/* \
-		"$subpkgdir"/usr/share/doc/$pkgname/ || return 1
-	cp -a "$_builddir"/contrib/ \
-		"$subpkgdir"/usr/share/doc/$pkgname/ || return 1
+	chown nsd.nsd "$pkgdir"/var/db/nsd || return 1
+	rm -fr "$pkgdir"/var/run || return 1
 }
 
 md5sums="bedc9aa8fc235a0f082aad6e515b6127  nsd-4.1.7.tar.gz
-62301a021d2b2e1972625e56ea8138d1  nsd.initd"
+1ecd0e86dd3abd250df6a408a4e1cd6f  nsd.initd"
 sha256sums="7ba8beb29b495ab795e927d9aa82a5bb1b66296a78f61ed47d6ccfe59e9b1a8a  nsd-4.1.7.tar.gz
-8f9ca311a60e2a3db3fcc64b66cce2d6ff84b5600f47d5ece349d90926e90f27  nsd.initd"
+223dd84d552d26f1930ff60960df4ebd0d3820f0cde758ab46ad6c5502e2cb6b  nsd.initd"
 sha512sums="c2bdb03a09ac06d70feef2183e2d777777ba7830777bac67ab974016f52791ad7ed9227a37a31325f5e4ab4baeacc4cb562d5af4cd85e5b6ddc83422ae5d0df8  nsd-4.1.7.tar.gz
-402142ad1bb422a9a29ee8c7606bd513defa41563d47fb547812d4682862da5646022aa8c4577ed2d2a151388a12ec2f7b472e6a6091406859c0eb1f7f00c5b6  nsd.initd"
+0425f606bf102175adab6d198aeb692872576f9c0bfce11b9d9e4145595b4902e5ef3fe2c3ae5d832308f43282618494b8dd27eb76658e79df85cc7798008722  nsd.initd"
diff --git a/main/nsd/nsd.initd b/main/nsd/nsd.initd
index 6318204..9eab285 100644
--- a/main/nsd/nsd.initd
+++ b/main/nsd/nsd.initd
_at_@ -1,51 +1,24 @@
 #!/sbin/openrc-run
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-dns/nsd/files/nsd.initd,v 1.2 2013/04/03 19:10:39 wschlich Exp $
 
-name="NSD"
 description="NSD is an authoritative-only, high performance, open source name server"
-extra_commands="configtest"
-
-# these can be overridden in /etc/conf.d/nsd if necessary
-NSD_CONFIG="${NSD_CONFIG:-/etc/nsd/nsd.conf}"
-command="${NSD_BINARY:-/usr/sbin/nsd}"
-NSD_CHECKCONF="${NSD_CHECKCONF:-/usr/sbin/nsd-checkconf}"
-
-command_args="-c ${NSD_CONFIG}"
+checkconf=/usr/sbin/nsd-checkconf
+cfgfile=${NSD_CONFIG:-/etc/nsd/nsd.conf}
+pidfile=$($checkconf -o pidfile $cfgfile)
+pidfile=${pidfile:-/var/run/nsd/nsd.pid}
+command=/usr/sbin/nsd
+command_args=""
+required_files="$cfgfile"
 
 depend() {
 	need net
 	use logger
 }
 
-configtest() {
-	ebegin "Checking ${SVCNAME} configuration"
-	checkconfig
-	eend $?
-}
-
-checkconfig() {
-	if ! test -e "${NSD_CONFIG}"; then
-		eerror "You need to create an appropriate config file."
-		eerror "An example can be found in /etc/nsd/nsd.conf.sample"
-		return 1
-	elif ! "${NSD_CHECKCONF}" "${NSD_CONFIG}"; then
-		eerror "You have errors in your configfile (${NSD_CONFIG})"
-		return $?
-	fi
-	return 0
-}
-
 start_pre() {
-	checkconfig || return $?
-	pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}")
-	checkpath --directory --owner nsd:nsd "${pidfile%/*}"
-}
-
-
-stop_pre() {
-	checkconfig || return $?
-	pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}")
+	ebegin
+	checkpath --directory --owner nsd:nsd ${pidfile%/*}
+	$checkconf $cfgfile
+	[ "$cfgfile" = "/etc/nsd/nsd.conf" ] || command_args="$command_args -c $cfgfile"
+	[ "$pidfile" = "/var/run/nsd/nsd.pid" ] || command_args="$command_args -P $pidfile"
+	eend $?
 }
-
diff --git a/main/nsd/nsd.pre-install b/main/nsd/nsd.pre-install
index 57e4ad1..80edbd1 100644
--- a/main/nsd/nsd.pre-install
+++ b/main/nsd/nsd.pre-install
_at_@ -1,4 +1,4 @@
 #!/bin/sh
-addgroup nsd 2>/dev/null
+addgroup -S nsd 2>/dev/null
 adduser -G nsd -S -H -h /var/db/nsd -s /sbin/nologin nsd 2>/dev/null
 exit 0
-- 
2.6.4
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Sun Dec 20 2015 - 18:45:34 GMT