ripe-dbase.spec 8.1 KB

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