nsd.spec 5.6 KB

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