ripe-dbase.spec 10 KB

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