nsd.spec 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. ##
  2. ## nsd.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # FIXME: rse: optional AXFR support via BIND8 named-xfer?
  26. # package information
  27. Name: nsd
  28. Summary: Name Server Daemon
  29. URL: http://www.nlnetlabs.nl/nsd/
  30. Vendor: NLNet Labs
  31. Packager: The OpenPKG Project
  32. Distribution: OpenPKG
  33. Class: PLUS
  34. Group: DNS
  35. License: GPL
  36. Version: 2.1.0
  37. Release: 20040514
  38. # package option
  39. %option with_fsl yes
  40. %option with_wrap no
  41. # list of sources
  42. Source0: http://www.nlnetlabs.nl/downloads/nsd/nsd-%{version}.tar.gz
  43. Source1: rc.nsd
  44. Source2: nsd.zones
  45. Source3: nsd.conf
  46. Source4: example.com
  47. Source5: fsl.nsd
  48. Patch0: nsd.patch
  49. # build information
  50. Prefix: %{l_prefix}
  51. BuildRoot: %{l_buildroot}
  52. BuildPreReq: OpenPKG, openpkg >= 20040130, make
  53. PreReq: OpenPKG, openpkg >= 20040130
  54. %if "%{with_fsl}" == "yes"
  55. BuildPreReq: fsl >= 1.3.0
  56. PreReq: fsl >= 1.3.0
  57. %endif
  58. %if "%{with_wrap}" == "yes"
  59. BuildPreReq: tcpwrappers
  60. PreReq: tcpwrappers
  61. %endif
  62. AutoReq: no
  63. AutoReqProv: no
  64. %description
  65. NSD is an authoritative only, high performance, simple name server.
  66. It is especially intended to be run as a root nameserver and
  67. actually is used for the Internet K-Root-Server driven by RIPE NCC.
  68. It supports BIND-style zone files, but pre-compiles the DNS RRs into
  69. packet format in a separate step.
  70. %track
  71. prog nsd = {
  72. version = %{version}
  73. url = http://www.nlnetlabs.nl/nsd/index.html
  74. regex = nsd-(\d+\.\d+\.\d+)\.tar\.gz
  75. }
  76. %prep
  77. %setup -q
  78. %patch -p0
  79. %build
  80. # configure programs
  81. export CC="%{l_cc}"
  82. export CFLAGS="%{l_cflags -O}"
  83. export CPPFLAGS="%{l_cppflags}"
  84. export LDFLAGS="%{l_ldflags}"
  85. export LIBS=""
  86. %if "%{with_wrap}" == "yes"
  87. LIBS="$LIBS -lwrap"
  88. %endif
  89. %if "%{with_fsl}" == "yes"
  90. LIBS="$LIBS %{l_fsl_ldflags} %{l_fsl_libs}"
  91. %endif
  92. ./configure \
  93. --prefix=%{l_prefix} \
  94. --with-configdir=%{l_prefix}/etc/nsd \
  95. --with-configfile=%{l_prefix}/etc/nsd/nsd.conf \
  96. --with-pidfile=%{l_prefix}/var/nsd/nsd.pid \
  97. --with-zonesdir=%{l_prefix}/etc/nsd \
  98. --with-zonesfile=%{l_prefix}/etc/nsd/nsd.zones \
  99. --with-dbfile=%{l_prefix}/var/nsd/nsd.db \
  100. --with-user="%{l_ruid}.%{l_rgid}" \
  101. --with-namedxfer=%{l_prefix}/libexec/bind/named-xfer \
  102. --enable-bind8-stats \
  103. --enable-dnssec \
  104. --disable-shared \
  105. --disable-ipv6 \
  106. %if "%{with_wrap}" == "yes"
  107. --with-libwrap=%{l_prefix} \
  108. %else
  109. --without-libwrap \
  110. %endif
  111. --disable-nls
  112. # build programs
  113. %{l_make} %{l_mflags -O}
  114. %install
  115. rm -rf $RPM_BUILD_ROOT
  116. # pre-create installation hierarchy
  117. %{l_shtool} mkdir -f -p -m 755 \
  118. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  119. $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.db \
  120. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  121. $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
  122. $RPM_BUILD_ROOT%{l_prefix}/var/nsd
  123. # perform default installation procedure
  124. %{l_make} %{l_mflags} install \
  125. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  126. exec_prefix=$RPM_BUILD_ROOT%{l_prefix} \
  127. configdir=$RPM_BUILD_ROOT%{l_prefix}/etc/nsd \
  128. configfile=$RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.conf \
  129. pidfile=$RPM_BUILD_ROOT%{l_prefix}/var/nsd/nsd.pid \
  130. zonesdir=$RPM_BUILD_ROOT%{l_prefix}/etc/nsd \
  131. zonesfile=$RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.zones \
  132. dbfile=$RPM_BUILD_ROOT%{l_prefix}/var/nsd/nsd.db
  133. # post-adjustments
  134. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.zones.sample
  135. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.conf.sample
  136. # install default configuration
  137. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  138. %{SOURCE nsd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/
  139. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  140. %{SOURCE nsd.zones} $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/
  141. %{l_shtool} install -c -m 644 \
  142. %{SOURCE example.com} $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.db/
  143. # install run-command script
  144. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  145. %{SOURCE rc.nsd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  146. # install OSSP fsl configuration
  147. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  148. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  149. %{SOURCE fsl.nsd} \
  150. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  151. # strip installation
  152. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  153. # determine installation files
  154. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  155. %{l_files_std} \
  156. '%not %dir %{l_prefix}/etc/fsl' \
  157. '%config %{l_prefix}/etc/fsl/fsl.nsd' \
  158. '%config %{l_prefix}/etc/nsd/*' \
  159. '%not %dir %{l_prefix}/etc/rc.d' \
  160. '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/nsd'
  161. %files -f files
  162. %clean
  163. rm -rf $RPM_BUILD_ROOT
  164. %post
  165. # update database in every case
  166. $RPM_INSTALL_PREFIX/sbin/nsdc rebuild
  167. # after upgrade, restart service
  168. [ $1 -eq 2 ] || exit 0
  169. eval `%{l_rc} nsd status 2>/dev/null`
  170. [ ".$nsd_active" = .yes ] && %{l_rc} nsd restart
  171. exit 0
  172. %preun
  173. # before erase, stop service and remove log files
  174. [ $1 -eq 0 ] || exit 0
  175. %{l_rc} nsd stop 2>/dev/null
  176. rm -f $RPM_INSTALL_PREFIX/var/nsd/*.log* >/dev/null 2>&1 || true
  177. exit 0