nsd patch to support fedora rpm building
Paul Wouters
paul at xelerance.com
Wed Oct 5 05:23:53 UTC 2005
Hi,
Attached is a patch against nsd-2.3.1 that adds support for building
Fedora RPMS. It adds the directory packaging/fedora/ which contains the
spec file for building rpms and a nsd initscript for use on Fedora.
This was tested on Fedora Core 4 i386 and
x86_64. Source and binary rpms for FC4 are available at
ftp://ftp.xelerance.com/binaries/nsd/binaries/fedora/
You can add the repository for use with the Yum package manager by adding
the following in /etc/yum.conf or /etc/yum.repos.d/nsd.conf:
[nsd]
name=nsd - Fedora Core nsd packages
baseurl=ftp://ftp.xelerance.com/mirror/otr/binaries/fedora/$releasever/$basearch/
http://www.xelerance.com/mirror/otr/binaries/fedora/$releasever/$basearch/
enabled=1
# get the key for paul at cypherpunks.ca from a key server (eg pgpkeys.mit.edu)
# or: finger paul at xelerance.com > nsdkey ; rpm --import nsdkey
# and enable gpgcheck to verify the package
gpgcheck=0
All source and binary rpms have been signed with my key
(paul at xelerance.com), available on key servers and by using 'finger
paul at xelerance.com'.
One note to the current 'make install' target. I could not use it since
it does not support installing into a "dist" directory. It only installs
files in "prefix". This makes the target unusable for rpm building, and
I had to replicate the 'make install' targets manually within the spec file.
If this patch is applied to the tree, it also requires that the build process
for the official nsd releases change the Version: and Release: values in
packaging/fedora/nsd.spec. Version: should be the nsd version, and Release
should be set to 1.
The rpm has been made according to the Fedora Extra Package guidelines,
so it should not be too hard to get it included into fedora extras
Though it takes some time to register and get a hang of the Fedora
Extra build and submission system. If the NSD team has no objections
to me submitting and maintaining the rpms for nsd in Fedora Extra's,
I'm happy to do so. As of Fedora Core 4, yum has the "fedora extra"
repositories enabled per default, so any FC4 installation could then
simple run 'yum install nsd' to obtain nsd for their host.
Regards,
Paul Wouters
Xelerance Corp.
-------------- next part --------------
diff -r -N -c nsd-2.3.1/packaging/fedora/nsd.init nsd-2.3.1-new/packaging/fedora/nsd.init
*** nsd-2.3.1/packaging/fedora/nsd.init 1969-12-31 19:00:00.000000000 -0500
--- nsd-2.3.1-new/packaging/fedora/nsd.init 2005-10-05 08:40:28.000000000 -0400
***************
*** 0 ****
--- 1,94 ----
+ #!/bin/bash
+ #
+ # nsd: Starts the NSD Name Server Daemon
+ #
+ # chkconfig: - 11 89
+ # description: NSD is a complete implementation of an authoritative \
+ # DNS name server.
+ # processname: /usr/sbin/nsd
+ # config: /etc/nsd/nsdc.config
+ #
+ ### BEGIN INIT INFO
+ # Provides: nsd
+ # Required-Start: $syslog
+ # Default-Stop: 0 11 89
+ # Short-Description: Starts the NSD Name Server Daemon
+ # Description: NSD is a complete implementation of an authoritative \
+ # DNS name server.
+ ### END INIT INFO
+
+ # Sanity checks.
+ [ -f /etc/nsd/nsdc.conf ] || exit 0
+ [ -f /etc/nsd/nsd.zones ] || exit 0
+ [ -x /usr/sbin/nsd ] || exit 0
+
+ #extra verbosity
+ #ZONEC_VERBOSE=-v
+
+ OTHER_NSD_OPTS=""
+
+ # Source function library.
+ . /etc/init.d/functions
+
+ . /etc/sysconfig/network
+
+ # Check that networking is configured.
+ [ ${NETWORKING} = "no" ] && exit 0
+
+ start() {
+ /usr/sbin/nsdc rebuild >/dev/null
+ /usr/sbin/nsdc update >/dev/null
+ echo -n $"Starting nsd... "
+ nsd $OTHER_NSD_OPTS
+ RETVAL=$?
+ echo
+ /usr/sbin/nsdc notify
+ touch /var/lock/subsys/nsd
+ return $RETVAL
+ }
+
+ stop() {
+ echo -n $"Shutting down nsd services: "
+ killproc nsd
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ] ; then
+ rm -f /var/lock/subsys/nsd
+ rm -f /var/run/nsd.pid
+ fi
+ echo
+ return $RETVAL
+ }
+
+ restart() {
+ stop
+ start
+ }
+
+ RETVAL=0
+
+ # See how we were called.
+ case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ condrestart)
+ [ -f /var/lock/subsys/nsd ] && restart || :
+ ;;
+ status)
+ /usr/sbin/nsdc running
+ ;;
+ stats|reload|rebuild|running|update|notify)
+ /usr/sbin/nsdc $1
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|stats|notify|reload|rebuild|running|update}"
+ exit 1
+ esac
+
+ exit $?
diff -r -N -c nsd-2.3.1/packaging/fedora/nsd.spec nsd-2.3.1-new/packaging/fedora/nsd.spec
*** nsd-2.3.1/packaging/fedora/nsd.spec 1969-12-31 19:00:00.000000000 -0500
--- nsd-2.3.1-new/packaging/fedora/nsd.spec 2005-10-05 08:50:50.000000000 -0400
***************
*** 0 ****
--- 1,99 ----
+ Summary: NSD is a complete implementation of an authoritative DNS name server
+ Name: nsd
+ Version: 2.3.1
+ Release: 2
+ License: BSD-like
+ Url: http://open.nlnetlabs.nl/nsd/
+ Source: http://open.nlnetlabs.nl/downloads/%{name}-%{version}.tar.gz
+ Group: System Environment/Daemons
+ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+ #Requires:
+ BuildRequires: flex
+
+ %description
+ NSD is a complete implementation of an authoritative DNS name server.
+ For further information about what NSD is and what NSD is not please
+ consult the REQUIREMENTS document which is a part of this distribution
+ (thanks to Olaf).
+
+ %prep
+ rm -rf %{buildroot}
+ %setup -q
+
+ %configure --enable-bind8-stats --enable-plugins --enable-checking \
+ --enable-mmap --with-pidfile=/var/run/nsd.pid --with-ssl \
+ --with-user=nsd
+
+ %build
+ %{__make} %{?_smp_mflags}
+
+ %install
+ # Not using their 'make install' since it uses install-sh which does not
+ # get the correct install path within the RPM_BUILD_ROOT
+ #%{__make} install
+ install -d 0755 %{buildroot}/%{_sysconfdir}/nsd
+ install -d 0755 %{buildroot}/%{_sbindir}
+ install -d 0755 %{buildroot}/%{_mandir}/man8
+ install -d 0755 %{buildroot}/%{_initrddir}
+
+ install -m 0644 nsdc.conf.sample %{buildroot}/%{_sysconfdir}/nsd/nsdc.conf
+ install -m 0644 nsd.zones.sample %{buildroot}/%{_sysconfdir}/nsd/nsd.zones
+ install -m 0755 packaging/fedora/nsd.init %{buildroot}/%{_initrddir}/nsd
+
+ install -m 0755 nsd zonec nsd-notify nsd-xfer %{buildroot}/%{_sbindir}
+ install -m 0755 nsdc.sh %{buildroot}/%{_sbindir}/nsdc
+ install -m 0644 *.8 %{buildroot}/%{_mandir}/man8
+
+ %clean
+ rm -rf ${RPM_BUILD_ROOT}
+
+ %files
+ %defattr(-,root,root)
+ %doc README LICENSE NSD-DATABASE DIFFERENCES dbaccess.c TODO RELNOTES REQUIREMENTS
+ %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsdc.conf
+ %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsd.zones
+ %attr(0755,root,root) %{_initrddir}/%{name}
+ %{_sbindir}/*
+ %doc %{_mandir}/*/*
+
+ %pre
+ if getent passwd nsd >/dev/null 2>&1 ; then : ; else /usr/sbin/useradd -d /etc/nsd -r -s /sbin/nologin nsd >/dev/null 2>&1 || exit 1 ; fi
+ if [ $1 = 2 -a -f /var/run/%{name}.pid ]; then
+ /sbin/service %{name} stop
+ fi
+ # "Everyone is doing it, so why can't we?"
+ exit 0
+
+ %post
+ if [ $1 -eq 1 ];
+ then
+ /sbin/chkconfig --level 345 %{name} on
+ fi
+ /sbin/chkconfig %{name} && /sbin/service %{name} start > /dev/null 2>&1
+ # "Everyone is doing it, so why can't we?"
+ exit 0;
+
+ %preun
+ if [ -f /var/run/%{name}.pid ]
+ then
+ /sbin/service %{name} stop > /dev/null 2>&1
+ fi
+ if [ $1 -eq 0 ]
+ then
+ /sbin/chkconfig --del %{name} > /dev/null 2>&1
+ fi
+ # "Everyone is doing it, so why can't we?"
+ exit 0
+
+ %postun
+ # It shouldn't be needed, there must a bug somewhere
+ /usr/bin/killall -TERM nsd > /dev/null 2>&1
+ # "Everyone is doing it, so why can't we?"
+ exit 0
+
+ %changelog
+ * Wed Oct 5 2005 Paul Wouters <paul at xelerance.com> - 2.3.1-2
+ - Changed spec file to reflect inclusion in the tree in the directory
+ packaging instead of as external source patches.
+ * Tue Oct 4 2005 Paul Wouters <paul at xelerance.com> - 2.3.1-1
+ - Initial version
More information about the nsd-users
mailing list