ripe-dbase.spec 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. ##
  2. ## ripe-dbase.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 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: debug whois database data initial loading from RIPE NCC
  26. # FIXME: rse: whois database data periodic updating from RIPE NCC
  27. # package information
  28. Name: ripe-dbase
  29. Summary: RIPE NCC Whois Server
  30. URL: http://www.ripe.net/ripencc/pub-services/db/
  31. Vendor: RIPE NCC
  32. Packager: The OpenPKG Project
  33. Distribution: OpenPKG [JUNK]
  34. Group: Database
  35. License: RIPE NCC
  36. Version: 3.2.0
  37. Release: 20031219
  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: rc.ripe-dbase
  42. Patch0: ripe-dbase.patch
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20030103, make, gcc
  47. PreReq: OpenPKG, openpkg >= 20030103
  48. BuildPreReq: gnupg, glib, glib::with_threads = yes, mysql
  49. BuildPreReq: libxml, libxslt, imap, zlib, openssl
  50. PreReq: gnupg, glib, glib::with_threads = yes, mysql
  51. PreReq: libxml, libxslt, imap, zlib, openssl
  52. AutoReq: no
  53. AutoReqProv: no
  54. %description
  55. RIPE-dbase is the official RIPE NCC's Whois Database Server software.
  56. The RIPE Whois Database contains information about IP address space
  57. allocations and assignments, routing policies, and reverse delegations
  58. in the RIPE NCC Service region.
  59. %prep
  60. %setup -q
  61. %patch -p0
  62. %{l_shtool} subst \
  63. -e 's;^RIPADMIN sqlhost,3306,dbuser,dbpsw,RIPADMIN;RIPADMIN localhost,3306,root,pwd,RIPADMIN;' \
  64. -e 's;^UPDSOURCE SAMPLE sqlhost,3306,dbuser,dbpsw,SAMPLEDB whois.mydb.net,43001,43004;UPDSOURCE SAMPLE localhost,3306,root,pwd,RIPEDB whois.mydb.net,43001,43004;' \
  65. conf/rip.config.sample.in
  66. %{l_shtool} subst \
  67. -e 's;^\(DATABASE.*\)SAMPLEDB;\1RIPEDB;' \
  68. -e 's;^\(database.*\)SAMPLEDB;\1RIPEDB;' \
  69. -e 's;^\(host:.*\)sqlhost;\1localhost;' \
  70. -e 's;^\(user:.*\)dbuser;\1root;' \
  71. -e 's;^\(password:.*\)dbpsw;\1pwd;' \
  72. conf/sources.config.sample
  73. %build
  74. CC="%{l_cc}" \
  75. CFLAGS="%{l_cflags -O}" \
  76. CPPFLAGS="%{l_cppflags}" \
  77. LDFLAGS="%{l_ldflags}" \
  78. LIBS="-lssl -lcrypto" \
  79. ./configure \
  80. --prefix=%{l_prefix} \
  81. --with-glibconfig=%{l_prefix}/bin/glib-config \
  82. --with-mysql=%{l_prefix} \
  83. --with-mysqlinc=%{l_prefix}/include/mysql \
  84. --with-mysqllib=%{l_prefix}/lib/mysql \
  85. --with-mysqlbin=%{l_prefix}/bin \
  86. --with-xsltconfig=%{l_prefix}/bin/xslt-config \
  87. --with-xmlconfig=%{l_prefix}/bin/xml2-config \
  88. --with-cclientinc=%{l_prefix}/include/imap \
  89. --with-cclientlib=%{l_prefix}/lib \
  90. --with-gpgcmd=%{l_prefix}/bin/gpg
  91. %{l_make} %{l_mflags}
  92. %install
  93. rm -rf $RPM_BUILD_ROOT
  94. %{l_shtool} mkdir -f -p -m 755 \
  95. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  96. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  97. $RPM_BUILD_ROOT%{l_prefix}/var/ripe-dbase/tmp/load/RIPE
  98. %{l_shtool} subst \
  99. -e "s;^\\([^=]* *= *\\)%{l_prefix};\\1$RPM_BUILD_ROOT%{l_prefix};" \
  100. Makefile
  101. %{l_shtool} subst \
  102. -e 's;^\(err_log=.*/\)bin\(/.*\);\1var/ripe-dbase/log\2;' \
  103. utils/whoisd_start
  104. %{l_make} %{l_mflags} install INSTALL="%{l_shtool} install -c"
  105. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  106. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  107. %{SOURCE rc.ripe-dbase} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  108. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  109. %{SOURCE ripe-dbase-setup.sh} \
  110. $RPM_BUILD_ROOT%{l_prefix}/sbin/ripe-dbase-setup
  111. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  112. %files -f files
  113. %clean
  114. rm -rf $RPM_BUILD_ROOT
  115. %post
  116. if [ $1 -eq 1 ]; then
  117. # display final hints on initial installation
  118. ( echo "1. To complete this installation of the RIPE Whois server,"
  119. echo " please start MySQL and initialize the database like this:"
  120. echo " \$ $RPM_INSTALL_PREFIX/etc/rc mysql start"
  121. echo " \$ $RPM_INSTALL_PREFIX/sbin/ripe-dbase-setup"
  122. echo ""
  123. echo "2. Although the RIPE Whois server is ready to run, it has no"
  124. echo " data to serve yet. As an optional step, download this data"
  125. echo " from RIPE and integrate it into the database:"
  126. echo " \$ cd $RPM_INSTALL_PREFIX/var/ripe-dbase/tmp/load/RIPE"
  127. echo " \$ ftp ftp.ripe.net"
  128. echo " \$ get ripe/dbase/ripe.db.gz"
  129. echo " \$ get ripe/dbase/RIPE.CURRENTSERIAL"
  130. echo " \$ quit
  131. echo " \$ gzip -d ripe.db.gz"
  132. echo " \$ $RPM_INSTALL_PREFIX/libexec/ripe-dbase/make_db \\"
  133. echo " -c $RPM_INSTALL_PREFIX/etc/ripe-dbase/rip.config.sample \\"
  134. echo " -s $RPM_INSTALL_PREFIX/var/ripe-dbase/tmp/load/RIPE/ripe.db -1"
  135. echo ""
  136. echo "3. Start the server by running:"
  137. echo " \$ $RPM_INSTALL_PREFIX/etc/rc ripe-dbase start"
  138. ) | %{l_rpmtool} msg -b -t notice
  139. fi
  140. if [ $1 -eq 2 ]; then
  141. # after upgrade, restart service
  142. eval `%{l_rc} ripe-dbase status 2>/dev/null`
  143. [ ".$ripe-dbase_active" = .yes ] && %{l_rc} ripe-dbase restart
  144. fi
  145. exit 0
  146. %preun
  147. if [ $1 -eq 0 ]; then
  148. # before erase, stop service and remove log files
  149. %{l_rc} ripe-dbase stop 2>/dev/null
  150. rm -f $RPM_INSTALL_PREFIX/var/ripe-dbase/log/* >/dev/null 2>&1 || true
  151. fi
  152. exit 0