Commit 73383796 authored by Valery Kartel's avatar Valery Kartel Committed by Natanael Copa

main/nsd: new openrc-run'ed init-script. APKBUILD cleanups

parent a7cfdfd2
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Matt Smith <mcs@darkregion.net> # Contributor: Matt Smith <mcs@darkregion.net>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org> # Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org> # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=nsd pkgname=nsd
pkgver=4.1.7 pkgver=4.1.7
pkgrel=0 pkgrel=1
pkgdesc="NSD is an authoritative only, high performance, simple and open source name server." pkgdesc="NSD is an authoritative only, high performance, simple and open source name server."
url="http://www.nlnetlabs.nl/projects/nsd/" url="http://www.nlnetlabs.nl/projects/nsd/"
arch="all" arch="all"
...@@ -49,25 +50,19 @@ package() { ...@@ -49,25 +50,19 @@ package() {
make DESTDIR="$pkgdir" install || return 1 make DESTDIR="$pkgdir" install || return 1
install -m755 -D "$srcdir"/$pkgname.initd \ 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 install -d "$pkgdir"/usr/share/doc/$pkgname
chown nsd.nsd "$pkgdir"/var/run/nsd || return 1 cp -a "$_builddir"/doc/* "$_builddir"/contrib \
} "$pkgdir"/usr/share/doc/$pkgname/
doc() { chown nsd.nsd "$pkgdir"/var/db/nsd || return 1
arch="noarch" rm -fr "$pkgdir"/var/run || return 1
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
} }
md5sums="bedc9aa8fc235a0f082aad6e515b6127 nsd-4.1.7.tar.gz md5sums="bedc9aa8fc235a0f082aad6e515b6127 nsd-4.1.7.tar.gz
62301a021d2b2e1972625e56ea8138d1 nsd.initd" 1ecd0e86dd3abd250df6a408a4e1cd6f nsd.initd"
sha256sums="7ba8beb29b495ab795e927d9aa82a5bb1b66296a78f61ed47d6ccfe59e9b1a8a nsd-4.1.7.tar.gz sha256sums="7ba8beb29b495ab795e927d9aa82a5bb1b66296a78f61ed47d6ccfe59e9b1a8a nsd-4.1.7.tar.gz
8f9ca311a60e2a3db3fcc64b66cce2d6ff84b5600f47d5ece349d90926e90f27 nsd.initd" 223dd84d552d26f1930ff60960df4ebd0d3820f0cde758ab46ad6c5502e2cb6b nsd.initd"
sha512sums="c2bdb03a09ac06d70feef2183e2d777777ba7830777bac67ab974016f52791ad7ed9227a37a31325f5e4ab4baeacc4cb562d5af4cd85e5b6ddc83422ae5d0df8 nsd-4.1.7.tar.gz sha512sums="c2bdb03a09ac06d70feef2183e2d777777ba7830777bac67ab974016f52791ad7ed9227a37a31325f5e4ab4baeacc4cb562d5af4cd85e5b6ddc83422ae5d0df8 nsd-4.1.7.tar.gz
402142ad1bb422a9a29ee8c7606bd513defa41563d47fb547812d4682862da5646022aa8c4577ed2d2a151388a12ec2f7b472e6a6091406859c0eb1f7f00c5b6 nsd.initd" 0425f606bf102175adab6d198aeb692872576f9c0bfce11b9d9e4145595b4902e5ef3fe2c3ae5d832308f43282618494b8dd27eb76658e79df85cc7798008722 nsd.initd"
#!/sbin/openrc-run #!/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" description="NSD is an authoritative-only, high performance, open source name server"
extra_commands="configtest" checkconf=/usr/sbin/nsd-checkconf
cfgfile=${NSD_CONFIG:-/etc/nsd/nsd.conf}
# these can be overridden in /etc/conf.d/nsd if necessary pidfile=$($checkconf -o pidfile $cfgfile)
NSD_CONFIG="${NSD_CONFIG:-/etc/nsd/nsd.conf}" pidfile=${pidfile:-/var/run/nsd/nsd.pid}
command="${NSD_BINARY:-/usr/sbin/nsd}" command=/usr/sbin/nsd
NSD_CHECKCONF="${NSD_CHECKCONF:-/usr/sbin/nsd-checkconf}" command_args=""
required_files="$cfgfile"
command_args="-c ${NSD_CONFIG}"
depend() { depend() {
need net need net
use logger 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() { start_pre() {
checkconfig || return $? ebegin
pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}") checkpath --directory --owner nsd:nsd ${pidfile%/*}
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 $?
stop_pre() {
checkconfig || return $?
pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}")
} }
#!/bin/sh #!/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 adduser -G nsd -S -H -h /var/db/nsd -s /sbin/nologin nsd 2>/dev/null
exit 0 exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment