nsd.spec 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. ##
  2. ## nsd.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2012 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.2.10
  34. Release: 20120217
  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. BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc
  47. PreReq: OpenPKG, openpkg >= 20100101
  48. BuildPreReq: openssl
  49. PreReq: openssl
  50. %if "%{with_fsl}" == "yes"
  51. BuildPreReq: fsl
  52. PreReq: fsl
  53. %endif
  54. %description
  55. NSD is an authoritative only, high performance, simple name server.
  56. It is especially intended to be run as a root nameserver and
  57. actually is used for the Internet K-Root-Server driven by RIPE NCC.
  58. It supports BIND-style zone files, but pre-compiles the DNS RRs into
  59. packet format in a separate step.
  60. %track
  61. prog nsd = {
  62. version = %{version}
  63. url = http://www.nlnetlabs.nl/nsd/index.html
  64. regex = nsd-(\d+\.\d+\.\d+)\.tar\.gz
  65. }
  66. %prep
  67. %setup -q
  68. %patch -p0
  69. %build
  70. # configure programs
  71. CC="%{l_cc}" \
  72. CFLAGS="%{l_cflags -O}" \
  73. CPPFLAGS="%{l_cppflags}" \
  74. LDFLAGS="%{l_ldflags}" \
  75. LIBS="%{l_fsl_ldflags} %{l_fsl_libs}" \
  76. ./configure \
  77. --prefix=%{l_prefix} \
  78. --mandir=%{l_prefix}/man \
  79. --with-configdir=%{l_prefix}/etc/nsd \
  80. --with-configfile=%{l_prefix}/etc/nsd/nsd.conf \
  81. --with-pidfile=%{l_prefix}/var/nsd/nsd.pid \
  82. --with-zonesdir=%{l_prefix}/etc/nsd \
  83. --with-zonesfile=%{l_prefix}/etc/nsd/nsd.zones \
  84. --with-dbfile=%{l_prefix}/var/nsd/nsd.db \
  85. --with-user="%{l_ruid}.%{l_rgid}" \
  86. --enable-bind8-stats \
  87. --enable-dnssec \
  88. --with-ssl=%{l_prefix} \
  89. --disable-shared \
  90. --disable-ipv6 \
  91. --disable-nls
  92. # build programs
  93. %{l_make} %{l_mflags -O}
  94. %install
  95. # pre-create installation hierarchy
  96. %{l_shtool} mkdir -f -p -m 755 \
  97. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  98. $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.db \
  99. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  100. $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
  101. $RPM_BUILD_ROOT%{l_prefix}/var/nsd
  102. # perform default installation procedure
  103. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  104. # post-adjustments
  105. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.zones.sample
  106. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.conf.sample
  107. # install default configuration
  108. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  109. %{SOURCE nsd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/
  110. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  111. %{SOURCE nsd.zones} $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/
  112. %{l_shtool} install -c -m 644 \
  113. %{SOURCE example.com} $RPM_BUILD_ROOT%{l_prefix}/etc/nsd/nsd.db/
  114. # install run-command script
  115. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  116. %{SOURCE rc.nsd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  117. # install OSSP fsl configuration
  118. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  119. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  120. %{SOURCE fsl.nsd} \
  121. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  122. # strip installation
  123. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  124. # determine installation files
  125. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  126. %{l_files_std} \
  127. '%config %{l_prefix}/etc/fsl/fsl.nsd' \
  128. '%config %{l_prefix}/etc/nsd/*' \
  129. '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/nsd'
  130. %files -f files
  131. %clean
  132. %post
  133. # update database in every case
  134. $RPM_INSTALL_PREFIX/sbin/nsdc rebuild
  135. # after upgrade, restart service
  136. [ $1 -eq 2 ] || exit 0
  137. eval `%{l_rc} nsd status 2>/dev/null`
  138. [ ".$nsd_active" = .yes ] && %{l_rc} nsd restart
  139. exit 0
  140. %preun
  141. # before erase, stop service and remove log files
  142. [ $1 -eq 0 ] || exit 0
  143. %{l_rc} nsd stop 2>/dev/null
  144. rm -f $RPM_INSTALL_PREFIX/var/nsd/*.log* >/dev/null 2>&1 || true
  145. exit 0