ripe-dbase.spec 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. ##
  2. ## ripe-dbase.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: whois database data periodic updating from RIPE NCC (NRTM)
  26. # package information
  27. Name: ripe-dbase
  28. Summary: RIPE NCC Whois Server
  29. URL: http://www.ripe.net/ripencc/pub-services/db/
  30. Vendor: RIPE NCC
  31. Packager: The OpenPKG Project
  32. Distribution: OpenPKG
  33. Class: JUNK
  34. Group: Database
  35. License: RIPE NCC
  36. Version: 3.2.0
  37. Release: 20040318
  38. # package options
  39. %option with_extobjs no
  40. # list of sources
  41. Source0: ftp://ftp.ripe.net/ripe/dbase/software/ripe-dbase-%{version}.tar.gz
  42. Source1: ripe-dbase-setup.sh
  43. Source2: ripe-dbase-modify.sh
  44. Source3: rc.ripe-dbase
  45. Patch0: ripe-dbase.patch
  46. Patch1: ripe-dbase.patch.extobjs
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20040130, make, gcc
  51. PreReq: OpenPKG, openpkg >= 20040130
  52. BuildPreReq: gnupg, glib, glib::with_threads = yes, mysql3
  53. PreReq: gnupg, glib, glib::with_threads = yes, mysql3
  54. BuildPreReq: libxml, libxslt, imap, zlib, openssl
  55. PreReq: libxml, libxslt, imap, zlib, openssl
  56. AutoReq: no
  57. AutoReqProv: no
  58. %description
  59. RIPE-dbase is the official RIPE NCC's Whois Database Server software.
  60. The RIPE Whois Database contains information about IP address space
  61. allocations and assignments, routing policies, and reverse delegations
  62. in the RIPE NCC Service region.
  63. %track
  64. prog ripe-dbase = {
  65. version = %{version}
  66. url = ftp://ftp.ripe.net/ripe/dbase/software/
  67. regex = ripe-dbase-(__VER__)\.tar\.gz
  68. }
  69. %prep
  70. %setup -q
  71. cp -f defs/variants/RIPE/*.xml defs/
  72. cp -f defs/variants/RIPE/*.h defs/
  73. cp -f defs/variants/RIPE/Makefile.syntax defs/
  74. cp -f defs/variants/RIPE/*.def include/
  75. %patch -p0
  76. %if "%{with_extobjs}" == "yes"
  77. %patch -p0 -P 1
  78. %endif
  79. %{l_shtool} subst \
  80. -e 's;@topdir@/conf;@confdir@;g' \
  81. -e 's;sendmail -fmy-dbm -t;sendmail -t;g' \
  82. -e 's;^RIPADMIN sqlhost,3306,dbuser,dbpsw,RIPADMIN;RIPADMIN localhost,3306,root,pwd,RIPADMIN;' \
  83. -e 's;^UPDSOURCE SAMPLE sqlhost,3306,dbuser,dbpsw,SAMPLEDB whois.mydb.net,43001,43004;UPDSOURCE RIPE localhost,3306,root,pwd,RIPEDB localhost,43001,43004;' \
  84. conf/rip.config.sample.in
  85. %{l_shtool} subst \
  86. -e 's;^\(DATABASE.*\)SAMPLEDB;\1RIPEDB;' \
  87. -e 's;^\(SOURCE.*\)SAMPLE;\1RIPE;' \
  88. -e 's;^\(database.*\)SAMPLEDB;\1RIPEDB;' \
  89. -e 's;^\(host:.*\)sqlhost;\1localhost;' \
  90. -e 's;^\(user:.*\)dbuser;\1root;' \
  91. -e 's;^\(password:.*\)dbpsw;\1pwd;' \
  92. conf/sources.config.sample
  93. %{l_shtool} subst \
  94. -e 's;sample.db.gz;ripe.db.gz;' \
  95. bin/load/make_db.in
  96. %build
  97. CC="%{l_cc}" \
  98. CFLAGS="%{l_cflags -O}" \
  99. CPPFLAGS="%{l_cppflags}" \
  100. LDFLAGS="%{l_ldflags}" \
  101. LIBS="-lssl -lcrypto" \
  102. ./configure \
  103. --prefix=%{l_prefix} \
  104. --with-glibconfig=%{l_prefix}/bin/glib-config \
  105. --with-mysql=%{l_prefix} \
  106. --with-mysqlinc=%{l_prefix}/include/mysql \
  107. --with-mysqllib=%{l_prefix}/lib/mysql \
  108. --with-mysqlbin=%{l_prefix}/bin \
  109. --with-xsltconfig=%{l_prefix}/bin/xslt-config \
  110. --with-xmlconfig=%{l_prefix}/bin/xml2-config \
  111. --with-cclientinc=%{l_prefix}/include/imap \
  112. --with-cclientlib=%{l_prefix}/lib \
  113. --with-gpgcmd=%{l_prefix}/bin/gpg
  114. %{l_make} %{l_mflags}
  115. %install
  116. rm -rf $RPM_BUILD_ROOT
  117. %{l_shtool} mkdir -f -p -m 755 \
  118. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  119. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  120. $RPM_BUILD_ROOT%{l_prefix}/var/ripe-dbase/tmp/load/RIPE
  121. %{l_shtool} subst \
  122. -e "s;^\\([^=]* *= *\\)%{l_prefix};\\1$RPM_BUILD_ROOT%{l_prefix};" \
  123. Makefile
  124. %{l_shtool} subst \
  125. -e 's;^\(err_log=.*/\)bin\(/.*\);\1var/ripe-dbase/log\2;' \
  126. utils/whoisd_start
  127. %{l_make} %{l_mflags} install INSTALL="%{l_shtool} install -c"
  128. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  129. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  130. %{SOURCE rc.ripe-dbase} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  131. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  132. %{SOURCE ripe-dbase-setup.sh} \
  133. $RPM_BUILD_ROOT%{l_prefix}/sbin/ripe-dbase-setup
  134. %if "%{with_extobjs}" == "yes"
  135. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  136. %{SOURCE ripe-dbase-modify.sh} \
  137. $RPM_BUILD_ROOT%{l_prefix}/sbin/ripe-dbase-modify
  138. %endif
  139. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  140. %{l_files_std} \
  141. '%config %{l_prefix}/etc/ripe-dbase/*' \
  142. '%config %attr(0775,%{l_musr},%{l_mgrp}) %{l_prefix}/var/ripe-dbase/tmp' \
  143. '%config %attr(0775,%{l_musr},%{l_mgrp}) %{l_prefix}/var/ripe-dbase/log/upd' \
  144. '%config %attr(0775,%{l_musr},%{l_mgrp}) %{l_prefix}/var/ripe-dbase/log/forw' \
  145. '%config %attr(0775,%{l_musr},%{l_mgrp}) %{l_prefix}/var/ripe-dbase/log/ack'
  146. %files -f files
  147. %clean
  148. rm -rf $RPM_BUILD_ROOT
  149. %post
  150. if [ $1 -eq 1 ]; then
  151. # display final hints on initial installation
  152. ( echo "1. To complete this installation of the RIPE Whois server,"
  153. echo " please change all 'pwd' text in the following files:"
  154. echo " \$ $RPM_INSTALL_PREFIX/etc/ripe-dbase/rip.config.sample"
  155. echo " \$ $RPM_INSTALL_PREFIX/etc/ripe-dbase/sources.config.sample"
  156. echo " The text should match the MySQL password stored in:"
  157. echo " \$ $RPM_INSTALL_PREFIX/etc/mysql/my.pwd"
  158. echo ""
  159. echo "2. Now start the MySQL server:"
  160. echo " \$ $RPM_INSTALL_PREFIX/etc/rc mysql start"
  161. echo ""
  162. echo "Choose to either use the WHOIS server with (3a) no initial data,"
  163. echo "or (3b) the full contents of the current RIPE database snapshot."
  164. echo ""
  165. echo "3a. To begin using the WHOIS server with an empty RIPE database, run:"
  166. echo " \$ $RPM_INSTALL_PREFIX/sbin/ripe-dbase-setup"
  167. echo ""
  168. echo "3b. To begin using the WHOIS server with actual RIPE data, do the"
  169. echo " following. This step may take ten (!) hours due to downloading"
  170. echo " ripe.db.gz (~60 Mb) and make_db data importing:"
  171. echo " \$ cd $RPM_INSTALL_PREFIX/var/ripe-dbase/tmp/load/RIPE"
  172. echo " \$ ftp ftp.ripe.net:ripe/dbase"
  173. echo " \$ mget RIPE.CURRENTSERIAL ripe.db.gz"
  174. echo " \$ quit"
  175. echo " \$ $RPM_INSTALL_PREFIX/libexec/ripe-dbase/make_db \\"
  176. echo " -c $RPM_INSTALL_PREFIX/etc/ripe-dbase/rip.config.sample \\"
  177. echo " -s RIPE -1"
  178. echo ""
  179. %if "%{with_extobjs}" == "yes"
  180. echo "4. Modify the native RIPE datastructures to accommodate the"
  181. echo " extra objects (which you selected by using with_extobjs):"
  182. echo " \$ $RPM_INSTALL_PREFIX/sbin/ripe-dbase-modify"
  183. echo ""
  184. echo "5. Finally start the WHOIS server by running:"
  185. echo " \$ $RPM_INSTALL_PREFIX/etc/rc ripe-dbase start"
  186. %else
  187. echo "4. Finally start the WHOIS server by running:"
  188. echo " \$ $RPM_INSTALL_PREFIX/etc/rc ripe-dbase start"
  189. %endif
  190. ) | %{l_rpmtool} msg -b -t notice
  191. fi
  192. if [ $1 -eq 2 ]; then
  193. # after upgrade, restart service
  194. eval `%{l_rc} ripe-dbase status 2>/dev/null`
  195. [ ".$ripe-dbase_active" = .yes ] && %{l_rc} ripe-dbase restart
  196. fi
  197. exit 0
  198. %preun
  199. if [ $1 -eq 0 ]; then
  200. # before erase, stop service and remove log files
  201. %{l_rc} ripe-dbase stop 2>/dev/null
  202. rm -f $RPM_INSTALL_PREFIX/var/ripe-dbase/log/* >/dev/null 2>&1 || true
  203. fi
  204. exit 0