bind.spec 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. ##
  2. ## bind.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.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. # package versions
  26. %define V_bind 9.2.2
  27. %define V_dlz 0.3.0
  28. # package information
  29. Name: bind
  30. Summary: Berkeley Internet Name Domain (BIND)
  31. URL: http://www.isc.org/products/BIND/
  32. Vendor: Internet Software Foundation
  33. Packager: The OpenPKG Project
  34. Distribution: OpenPKG [BASE]
  35. Group: DNS
  36. License: ISC
  37. Version: %{V_bind}
  38. Release: 20030404
  39. # package options
  40. %option with_dlz_mysql no
  41. %option with_dlz_postgres no
  42. %option with_dlz_filesystem no
  43. %option with_dlz_stub no
  44. # aggregate option
  45. %if "%{with_dlz_mysql}" == "yes" || "%{with_dlz_postgres}" == "yes" || "%{with_dlz_filesystem}" == "yes" || "%{with_dlz_stub}" == "yes"
  46. %define with_dlz yes
  47. %else
  48. %define with_dlz no
  49. %endif
  50. # list of sources
  51. Source0: ftp://ftp.isc.org/isc/bind9/%{version}/bind-%{V_bind}.tar.gz
  52. Source2: db.root
  53. Source3: db.root.sh
  54. Source4: db.localhost
  55. Source5: db.localhost.ipv4
  56. Source6: db.localhost.ipv6
  57. Source7: named.conf
  58. Source8: rndc.conf
  59. Source9: rc.bind
  60. Source10: http://osdn.dl.sourceforge.net/bind-dlz/DLZ-%{V_dlz}.tar.gz
  61. Patch0: bind.patch
  62. # build information
  63. Prefix: %{l_prefix}
  64. BuildRoot: %{l_buildroot}
  65. BuildPreReq: OpenPKG, openpkg >= 20021002, make, openssl
  66. PreReq: OpenPKG, openpkg >= 20021002
  67. %if "%{with_dlz_mysql}" == "yes"
  68. BuildPreReq: MYSQL
  69. PreReq: MYSQL
  70. %endif
  71. %if "%{with_dlz_postgres}" == "yes"
  72. BuildPreReq: postgresql
  73. PreReq: postgresql
  74. %endif
  75. AutoReq: no
  76. AutoReqProv: no
  77. Provides: DNS
  78. Conflicts: bind8, powerdns
  79. %description
  80. Berkeley Internet Name Domain (BIND) is an implementation of
  81. the Domain Name System (DNS) protocols and provides an openly
  82. redistributable reference implementation of the major components
  83. of the Domain Name System, including a Domain Name System server
  84. (named)
  85. %prep
  86. %setup -q
  87. %if "%{with_dlz}" == "yes"
  88. %setup -q -T -D -a 10
  89. %patch0 -p0
  90. %{l_patch} -p1 <dlz.patch
  91. %endif
  92. %build
  93. CC="%{l_cc}" \
  94. CFLAGS="%{l_cflags -O}" \
  95. ./configure \
  96. --prefix=%{l_prefix} \
  97. --sysconfdir=%{l_prefix}/etc/bind \
  98. --localstatedir=%{l_prefix}/var/bind \
  99. %if "%{with_dlz_mysql}" == "yes"
  100. --with-dlz-mysql="%{l_prefix}" \
  101. %else
  102. --with-dlz-mysql=no \
  103. %endif
  104. %if "%{with_dlz_postgres}" == "yes"
  105. --with-dlz-postgres="%{l_prefix}" \
  106. %else
  107. --with-dlz-postgres=no \
  108. %endif
  109. %if "%{with_dlz_filesystem}" == "yes"
  110. --with-dlz-filesystem=yes \
  111. %else
  112. --with-dlz-filesystem=no \
  113. %endif
  114. %if "%{with_dlz_stub}" == "yes"
  115. --with-dlz-filesystem=yes \
  116. %else
  117. --with-dlz-filesystem=no \
  118. %endif
  119. --with-openssl=%{l_prefix} \
  120. --with-libtool \
  121. --without-libbind \
  122. --disable-threads \
  123. --disable-shared \
  124. --disable-nls
  125. %{l_make} %{l_mflags}
  126. %install
  127. rm -rf $RPM_BUILD_ROOT
  128. # perform standard install procedure
  129. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  130. # strip down installation
  131. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  132. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  133. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/isc-config.sh
  134. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
  135. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
  136. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  137. # install BIND9 ARM
  138. %{l_shtool} mkdir -f -p -m 755 \
  139. $RPM_BUILD_ROOT%{l_prefix}/share/bind/
  140. %{l_shtool} install -c -m 644 \
  141. doc/arm/*.html $RPM_BUILD_ROOT%{l_prefix}/share/bind/
  142. # install run-command script
  143. %{l_shtool} mkdir -f -p -m 755 \
  144. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  145. %{l_shtool} install -c -m 755 \
  146. -e 's;@l_prefix@;%{l_prefix};g' \
  147. -e 's;@l_susr@;%{l_susr};g' \
  148. -e 's;@l_musr@;%{l_musr};g' \
  149. -e 's;@l_mgrp@;%{l_mgrp};g' \
  150. %{SOURCE rc.bind} \
  151. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  152. # install a reasonable default configuration
  153. %{l_shtool} mkdir -f -p -m 755 \
  154. $RPM_BUILD_ROOT%{l_prefix}/etc/bind
  155. %{l_shtool} install -c -m 644 -e 's;@l_prefix@;%{l_prefix};g' \
  156. %{SOURCE named.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/bind/
  157. %{l_shtool} install -c -m 644 -e 's;@l_prefix@;%{l_prefix};g' \
  158. %{SOURCE rndc.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/bind/
  159. %{l_shtool} mkdir -f -p -m 755 \
  160. $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db
  161. %{l_shtool} install -c -m 644 \
  162. %{SOURCE db.localhost} \
  163. %{SOURCE db.localhost.ipv4} \
  164. %{SOURCE db.localhost.ipv6} \
  165. %{SOURCE db.root} \
  166. %{SOURCE db.root.sh} \
  167. $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db/
  168. # create an empty var directory
  169. %{l_shtool} mkdir -f -p -m 755 \
  170. $RPM_BUILD_ROOT%{l_prefix}/var/bind
  171. # determine the installed files
  172. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  173. %{l_files_std} \
  174. '%config %{l_prefix}/etc/bind/*.conf' \
  175. '%config %{l_prefix}/etc/bind/named.db/*' \
  176. '%dir %attr(-,root,%{l_mgrp}) %{l_prefix}/var/bind'
  177. %files -f files
  178. %clean
  179. rm -rf $RPM_BUILD_ROOT
  180. %post
  181. if [ $1 -eq 1 ]; then
  182. # generate local rndc key
  183. ( echo "Generating RSA key for RNDC operation in $RPM_INSTALL_PREFIX/etc/bind/rndc.key."
  184. echo "Please be patient, this takes a non-deterministic amount of time."
  185. ) | %{l_rpmtool} msg -b -t notice
  186. $RPM_INSTALL_PREFIX/sbin/rndc-confgen -a
  187. chown %{l_musr}:%{l_mgrp} $RPM_INSTALL_PREFIX/etc/bind/rndc.key
  188. elif [ $1 -gt 1 ]; then
  189. # reload daemon
  190. $RPM_INSTALL_PREFIX/sbin/rndc reload >/dev/null 2>&1 || true
  191. fi
  192. %preun
  193. if [ $1 -eq 0 ]; then
  194. # stop daemon
  195. $RPM_INSTALL_PREFIX/sbin/rndc stop >/dev/null 2>&1 || true
  196. # remove dynamically generated files
  197. rm -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key
  198. rm -f $RPM_INSTALL_PREFIX/var/bind/*
  199. fi