ripe-dbase.spec 10 KB

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