maradns.spec 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. ##
  2. ## maradns.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package version
  25. %define V_major 1.3
  26. %define V_minor 10
  27. # package information
  28. Name: maradns
  29. Summary: Authoritative & Caching DNS Server
  30. URL: http://www.maradns.org/
  31. Vendor: Sam Trenholme
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: EVAL
  35. Group: DNS
  36. License: MIT-style
  37. Version: %{V_major}.%{V_minor}
  38. Release: 20071127
  39. # package options
  40. %option with_authonly no
  41. # list of sources
  42. Source0: http://www.maradns.org/download/%{V_major}/%{version}/maradns-%{version}.tar.gz
  43. Source1: rc.maradns
  44. Source2: mararc
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc
  49. PreReq: OpenPKG, openpkg >= 20040130
  50. AutoReq: no
  51. AutoReqProv: no
  52. %description
  53. MaraDNS is a secure, full-featured and easy to use Domain Name
  54. Service (DNS) server supporting both the authoritative and recursive
  55. resolving and caching operations.
  56. %track
  57. prog maradns = {
  58. version = %{version}
  59. url = http://www.maradns.org/download.html
  60. regex = maradns-(__VER__)\.tar\.(gz|bz2)
  61. }
  62. %prep
  63. %setup -q
  64. %build
  65. # configure program
  66. %if "%{with_authonly}" == "yes"
  67. ./configure --authonly
  68. %else
  69. ./configure
  70. %endif
  71. # build program
  72. %{l_make} %{l_mflags}
  73. %install
  74. # create installation hierarchy
  75. rm -rf $RPM_BUILD_ROOT
  76. %{l_shtool} mkdir -f -p -m 755 \
  77. $RPM_BUILD_ROOT%{l_prefix}/bin \
  78. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  79. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  80. $RPM_BUILD_ROOT%{l_prefix}/etc/maradns \
  81. $RPM_BUILD_ROOT%{l_prefix}/var/maradns \
  82. $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
  83. $RPM_BUILD_ROOT%{l_prefix}/man/man5 \
  84. $RPM_BUILD_ROOT%{l_prefix}/man/man8
  85. # install program
  86. %{l_shtool} subst -e 's;RPM_BUILD_ROOT;PREFIX;g' build/install.sh
  87. export PREFIX=$RPM_BUILD_ROOT%{l_prefix}
  88. export LANGUAGE=en
  89. %{l_make} %{l_mflags} install
  90. # strip down installation
  91. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  92. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  93. rm -rf $RPM_BUILD_ROOT%{l_prefix}/doc
  94. rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/maradns/logger
  95. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/mararc
  96. # install default configuration
  97. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  98. %{SOURCE mararc} $RPM_BUILD_ROOT%{l_prefix}/etc/maradns/
  99. sed -e 's;net;com;' -e 's;NET;COM;' \
  100. <$RPM_BUILD_ROOT%{l_prefix}/etc/maradns/db.example.net \
  101. >$RPM_BUILD_ROOT%{l_prefix}/etc/maradns/db.example.com
  102. # install run-command script
  103. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  104. %{SOURCE rc.maradns} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  105. # determine installation files
  106. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  107. %{l_files_std} \
  108. '%config %{l_prefix}/etc/maradns/*' \
  109. '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/maradns'
  110. %files -f files
  111. %clean
  112. rm -rf $RPM_BUILD_ROOT
  113. %post
  114. # after upgrade, restart service
  115. [ $1 -eq 2 ] || exit 0
  116. eval `%{l_rc} maradns status 2>/dev/null`
  117. [ ".$maradns_active" = .yes ] && %{l_rc} maradns restart
  118. exit 0
  119. %preun
  120. # before erase, stop service and remove log files
  121. [ $1 -eq 0 ] || exit 0
  122. %{l_rc} maradns stop 2>/dev/null
  123. rm -f $RPM_INSTALL_PREFIX/var/maradns/* >/dev/null 2>&1 || true
  124. exit 0