[Unbound-users] Release of unbound 0.11

Jaap Akkerhuis jaap at NLnetLabs.nl
Thu Apr 24 15:01:11 UTC 2008


Hi,

    P.S. Unbound works on Linux, *BSD, Solaris and more, but it may be fun
    to know that the FreeBSD ports collection has an unbound package in
    preparation, it should be available soon.

Actually, I hacked a port together which I plan to submit to the
FreeBSD ports colection. In case people want to try it out, here
is what I have. I'm interested in any feedback people might have.

	jaap


----
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	unbound
#	unbound/Makefile
#	unbound/pkg-message
#	unbound/pkg-install
#	unbound/pkg-descr
#	unbound/pkg-deinstall
#	unbound/distinfo
#	unbound/files
#	unbound/files/unbound.in
#
echo c - unbound
mkdir -p unbound > /dev/null 2>&1
echo x - unbound/Makefile
sed 's/^X//' >unbound/Makefile << 'END-of-unbound/Makefile'
X# New ports collection makefile for: unbound
X# Date created:        24 April 2008
X# Whom:                Jaap Akkerhuis <jaap at NLnetLabs.nl>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	unbound
XPORTVERSION=	0.11
XCATEGORIES=	dns
XMASTER_SITES=	http://unbound.net/downloads/
X
XMAINTAINER=	jaap at NLnetLabs.nl
XCOMMENT=	Unbound is a validating, recursive, and caching DNS resolver
X
XMAN1=		unbound-host.1
XMAN3=		libunbound.3
XMAN5=		unbound.conf.5
XMAN8=		unbound.8 unbound-checkconf.8
X
XMANCOMPRESSED=	no
X
XWRKSRC=	${WRKDIR}/${PORTNAME}-${PORTVERSION}
XUSE_GMAKE=	yes
XHAS_CONFIGURE=	yes
XCONFIGURE_ARGS=	--prefix=${PREFIX} --mandir=${PREFIX}/man
X
XUSE_RC_SUBR=	${PORTNAME}
X
Xpre-install:
X	@PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL
X
Xpost-install:
X	@${CAT} ${PKGMESSAGE} | ${SED} s,%%PREFIX%%,${PREFIX},
X	@${PREFIX}/sbin/unbound-checkconf
X
XPLIST_FILES=	sbin/unbound \
X		sbin/unbound-checkconf \
X		sbin/unbound-host \
X		lib/libunbound.la \
X		lib/libunbound.so \
X		lib/libunbound.a \
X		include/unbound.h
X
XPLIST_DIRS=	etc/unbound
X
X.include <bsd.port.mk>
END-of-unbound/Makefile
echo x - unbound/pkg-message
sed 's/^X//' >unbound/pkg-message << 'END-of-unbound/pkg-message'
X*********************************************************************
X*
X*	To have syslog work properly you should add to syslogd the arguments:
X*		 "-l %%PREFIX%%/etc/unbound/var/run/log"
X*	(without the quotes) and restart syslogd
X*
X*********************************************************************
END-of-unbound/pkg-message
echo x - unbound/pkg-install
sed 's/^X//' >unbound/pkg-install << 'END-of-unbound/pkg-install'
X#! /bin/sh
X#
X# create account, group, etc.
X# shamelessly stolen from /usr/ports/sysutil/munin-main/pkg-install
X#
X
Xask() {
X    local question default answer
X
X    question=$1
X    default=$2
X    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
X        read -p "${question} [${default}]? " answer
X    fi
X    if [ x${answer} = x ]; then
X        answer=${default}
X    fi
X    echo ${answer}
X}
X
Xyesno() {
X    local dflt question answer
X
X    question=$1
X    dflt=$2
X    while :; do
X        answer=$(ask "${question}" "${dflt}")
X        case "${answer}" in
X        [Yy]*)          return 0;;
X        [Nn]*)          return 1;;
X        esac
X        echo "Please answer yes or no."
X    done
X}
X
Xmake_account() {
X    local u g gcos
X
X    u=$1
X    g=$2
X    gcos=$3
X
X    if pw group show "${g}" >/dev/null 2>&1; then
X	echo "You already have a group \"${g}\", so I will use it."
X    else
X	echo "You need a group \"${g}\"."
X	if which -s pw && yesno "Would you like me to create it" y; then
X	    pw groupadd ${g} || exit
X	    echo "Done."
X	else
X	    echo "Please create it, and try again."
X	    if ! /usr/sbin/pw user show ${u} >/dev/null 2>/dev/null; then
X		echo "While you're at it, please create a user \"${u}\" too,"
X		echo "with a default group of \"${g}\"."
X	    fi
X	    exit 1
X	fi
X    fi
X    
X    if pw user show "${u}" >/dev/null 2>&1; then
X	echo "You already have a user \"${u}\", so I will use it."
X    else
X	echo "You need a user \"${u}\"."
X	if which -s pw && yesno "Would you like me to create it" y; then
X	    pw useradd ${u} -g ${g} -h - \
X		-s /usr/sbin/nologin -c "${gcos}" || exit
X	    echo "Done."
X	else
X	    echo "Please create it, and try again."
X	    exit 1
X	fi
X    fi
X}
X
X########################################################################
X
Xcase $2 in
X    PRE-INSTALL)
X	make_account unbound unbound "Unbound owner"
X	;;      
Xesac
END-of-unbound/pkg-install
echo x - unbound/pkg-descr
sed 's/^X//' >unbound/pkg-descr << 'END-of-unbound/pkg-descr'
XUnbound is a validating, recursive, and caching DNS resolver.
X
XThe C implementation of Unbound is developed and maintained by NLnet
XLabs. It is based on ideas and algorithms taken from a java prototype
Xdeveloped by Verisign labs, Nominet, Kirei and ep.net.
X
XUnbound is designed as a set of modular components, so that also
XDNSSEC (secure DNS) validation and stub-resolvers (that do not run
Xas a server, but are linked into an application) are easily possible.
X
XThe source code is under a BSD License.
X
XWWW: http://unbound.net/
END-of-unbound/pkg-descr
echo x - unbound/pkg-deinstall
sed 's/^X//' >unbound/pkg-deinstall << 'END-of-unbound/pkg-deinstall'
X#! /bin/sh
X#
X# create account, group, etc.
X# shamelessly stolen from /usr/ports/sysutil/munin-main/pkg-install
X#
X
X# Don not blindly remove account, we might be
X# updating existing system (and configuration)
X
Xask() {
X    local question default answer
X
X    question=$1
X    default=$2
X    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
X	read -p "${question} [${default}]? " answer
X    fi
X    if [ x${answer} = x ]; then
X	answer=${default}
X    fi
X    echo ${answer}
X}
X
Xyesno() {
X    local dflt question answer
X
X    question=$1
X    dflt=$2
X    while :; do
X	answer=$(ask "${question}" "${dflt}")
X	case "${answer}" in
X	[Yy]*)		return 0;;
X	[Nn]*)		return 1;;
X	esac
X	echo "Please answer yes or no."
X    done
X}
X
Xdelete_account() {
X    local u g home
X
X    u=$1
X    g=$2
X    if pw group show ${g} > /dev/null 2>&1; then
X	if yesno "Do you want me to remove group \"${g}\"" n; then
X	    pw group del -n ${g}
X	    echo "Done."
X	else
X	    GID=`pw group show ${g} | awk -F: '{ print $3 }'`
X	fi
X    fi
X    if pw user show ${u} > /dev/null 2>&1; then
X	if yesno "Do you want me to remove user \"${u}\"" n; then
X	    eval home=~${u}
X	    pw user del -n ${u} -r
X	    echo "Done."
X	    if [ -d "${home}" ]; then
X		echo "Please remember to remove the home directory \"${home}\""
X	    fi
X
X	    # pw user del may have removed the group, too.
X	    # Put it back if the admin asked us to retain it.
X	    if [ -n "$GID" ]; then
X		pw group show ${g} > /dev/null 2>&1
X		if [ $? -ne 0 ]; then
X		    pw group add ${g}
X		fi
X	    fi
X	fi
X    fi
X}
X
X#######################################################################
X
Xcase $2 in
X    POST-DEINSTALL)
X	delete_account unbound unbound
X	;;
Xesac
END-of-unbound/pkg-deinstall
echo x - unbound/distinfo
sed 's/^X//' >unbound/distinfo << 'END-of-unbound/distinfo'
XMD5 (unbound-0.11.tar.gz) = 2d698050a9ffd492b0abd37b5000680f
XSHA256 (unbound-0.11.tar.gz) = f6c44ccae56398273c1f03485f2e2b8e4b612663d501d89c82c8cf9f23422d9f
XSIZE (unbound-0.11.tar.gz) = 3543955
END-of-unbound/distinfo
echo c - unbound/files
mkdir -p unbound/files > /dev/null 2>&1
echo x - unbound/files/unbound.in
sed 's/^X//' >unbound/files/unbound.in << 'END-of-unbound/files/unbound.in'
X#!/bin/sh
X
X# PROVIDE: unbound
X# REQUIRE: SERVERS
X# BEFORE: DAEMON
X# KEYWORD: shutdown
X
Xprefix=%%PREFIX%%
X
X# Set unbound_enable="YES" in one of these files:
X#       /etc/rc.conf
X#       /etc/rc.conf.local
X#       /etc/rc.conf.d/unbound
X#
X# DO NOT CHANGE THESE DEFAULT VALUES HERE
X#
X
X. %%RC_SUBR%%
X
Xname="unbound"
Xrcvar=`set_rcvar`
X
X# %%PREFIX%%
X: unbound_enable=${unbound_enable:="NO"}
X
Xcommand="%%PREFIX%%/sbin/unbound"
X
Xstart_precmd="unbound_start"
Xstop_postcmd="unbound_stop"
Xextra_commands="reload"
X
X: ${unbound_dir:="%%PREFIX%%/etc/unbound/"}
Xpidfile="${unbound_dir}/unbound.pid"
X
Xunbound_start()
X{
X	/bin/test -d "${unbound_dir}" || /bin/mkdir "${unbound_dir}"
X	/sbin/umount "${unbound_dir}/dev" 2>/dev/null
X
X	/usr/sbin/mtree -deU -p "${unbound_dir}" <<EOF
X
X		/set type=dir uname=root gname=wheel mode=0755
X		. uname=unbound mode=755
X			dev
X			..
X			etc
X			..
X			var
X				run
X				..
X			..
X		..
XEOF
X
X	if ! /sbin/mount -t devfs dev "${unbound_dir}/dev"; then
X		echo "Mounting devfs on ${unbound_dir}/dev failed..."
X		exit 1
X	fi
X
X	/sbin/devfs -m "${unbound_dir}/dev" rule apply hide
X	/sbin/devfs -m "${unbound_dir}/dev" rule apply path null unhide
X	/sbin/devfs -m "${unbound_dir}/dev" rule apply path random unhide
X
X	for i in /etc/localtime /etc/resolv.conf; do
X		j="${unbound_dir}${i}"
X		if /bin/test -r "$i" && ! /usr/bin/cmp -s "$i" "$j"; then
X			/usr/bin/install -m 444 -o root -g wheel -p "$i" "$j"
X		fi
X	done
X}
X
Xunbound_stop()
X{
X	/sbin/umount "${unbound_dir}/dev"
X}
X
Xload_rc_config $name
Xrun_rc_command "$1"
END-of-unbound/files/unbound.in
exit





More information about the Unbound-users mailing list