## ## ripe-dbase.spec -- OpenPKG RPM Package Specification ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. ## Copyright (c) 2000-2006 Ralf S. Engelschall ## ## Permission to use, copy, modify, and distribute this software for ## any purpose with or without fee is hereby granted, provided that ## the above copyright notice and this permission notice appear in all ## copies. ## ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ## SUCH DAMAGE. ## # package information Name: ripe-dbase Summary: RIPE NCC Whois Server URL: http://www.ripe.net/ripencc/pub-services/db/ Vendor: RIPE NCC Packager: OpenPKG Distribution: OpenPKG Class: EVAL Group: WHOIS License: RIPE NCC Version: 3.2.0 Release: 20060923 # package options %option with_extobjs no # list of sources Source0: ftp://ftp.ripe.net/ripe/dbase/software/ripe-dbase-%{version}.tar.gz Source1: ripe-dbase-setup.sh Source2: ripe-dbase-modify.sh Source3: rc.ripe-dbase Source4: rc.ripe-dbase.extobjs Source5: rc.ripe-filter Source6: whois_filt.pl Source7: whois_filt.config Patch0: ripe-dbase.patch Patch1: ripe-dbase.patch.extobjs # build information Prefix: %{l_prefix} BuildRoot: %{l_buildroot} BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc PreReq: OpenPKG, openpkg >= 20060823 BuildPreReq: gnupg, glib, glib::with_threads = yes, mysql PreReq: gnupg, glib, glib::with_threads = yes, mysql BuildPreReq: libxml, libxslt, imap, zlib, openssl PreReq: libxml, libxslt, imap, zlib, openssl %if "%{with_extobjs}" == "yes" BuildPreReq: JDK PreReq: ripe-asused, perl-net %endif AutoReq: no AutoReqProv: no %description RIPE-dbase is the official RIPE NCC's Whois Database Server software. The RIPE Whois Database contains information about IP address space allocations and assignments, routing policies, and reverse delegations in the RIPE NCC Service region. %track prog ripe-dbase = { version = %{version} url = ftp://ftp.ripe.net/ripe/dbase/software/ regex = ripe-dbase-(__VER__)\.tar\.gz } %prep %setup -q cp -f defs/variants/RIPE/*.xml defs/ cp -f defs/variants/RIPE/*.h defs/ cp -f defs/variants/RIPE/Makefile.syntax defs/ cp -f defs/variants/RIPE/*.def include/ %patch -p0 %if "%{with_extobjs}" == "yes" %patch -p0 -P 1 %endif %{l_shtool} subst \ -e 's;@topdir@/conf;@confdir@;g' \ -e 's;sendmail -fmy-dbm -t;sendmail -t;g' \ -e 's;^RIPADMIN sqlhost,3306,dbuser,dbpsw,RIPADMIN;RIPADMIN localhost,3306,root,pwd,RIPADMIN;' \ -e 's;^UPDSOURCE SAMPLE sqlhost,3306,dbuser,dbpsw,SAMPLEDB whois.mydb.net,43001,43004;UPDSOURCE RIPE localhost,3306,root,pwd,RIPEDB localhost,43001,43004;' \ conf/rip.config.sample.in %{l_shtool} subst \ -e 's;^\(DATABASE.*\)SAMPLEDB;\1RIPEDB;' \ -e 's;^\(SOURCE.*\)SAMPLE;\1RIPE;' \ -e 's;^\(database.*\)SAMPLEDB;\1RIPEDB;' \ -e 's;^\(host:.*\)sqlhost;\1localhost;' \ -e 's;^\(user:.*\)dbuser;\1root;' \ -e 's;^\(password:.*\)dbpsw;\1pwd;' \ conf/sources.config.sample %{l_shtool} subst \ -e 's;sample.db.gz;ripe.db.gz;' \ bin/load/make_db.in %{l_shtool} subst \ -e 's;-I/usr/include/openssl;%{l_cppflags openssl .};' \ configure %build CC="%{l_cc}" \ CFLAGS="%{l_cflags -O}" \ CPPFLAGS="%{l_cppflags}" \ LDFLAGS="%{l_ldflags}" \ LIBS="-lssl -lcrypto" \ ./configure \ --prefix=%{l_prefix} \ --with-glibconfig=%{l_prefix}/bin/glib-config \ --with-mysql=%{l_prefix} \ --with-mysqlinc=%{l_prefix}/include/mysql \ --with-mysqllib=%{l_prefix}/lib/mysql \ --with-mysqlbin=%{l_prefix}/bin \ --with-xsltconfig=%{l_prefix}/bin/xslt-config \ --with-xmlconfig=%{l_prefix}/bin/xml2-config \ --with-cclientinc=%{l_prefix}/include/imap \ --with-cclientlib=%{l_prefix}/lib \ --with-gpgcmd=%{l_prefix}/bin/gpg %if "%{with_extobjs}" == "yes" ( cd defs %{l_make} %{l_mflags} JAVAC="%{l_prefix}/bin/javac -classpath xalan/xerces.jar:." ) || exit $? %endif %{l_make} %{l_mflags} %install rm -rf $RPM_BUILD_ROOT %{l_shtool} mkdir -f -p -m 755 \ $RPM_BUILD_ROOT%{l_prefix}/sbin \ $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ $RPM_BUILD_ROOT%{l_prefix}/var/ripe-dbase/tmp/load/RIPE %{l_shtool} subst \ -e "s;^\\([^=]* *= *\\)%{l_prefix};\\1$RPM_BUILD_ROOT%{l_prefix};" \ Makefile %{l_shtool} subst \ -e 's;^\(err_log=.*/\)bin\(/.*\);\1var/ripe-dbase/log\2;' \ utils/whoisd_start %{l_make} %{l_mflags} install INSTALL="%{l_shtool} install -c" strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true %{l_shtool} install -c -m 755 %{l_value -s -a} \ %{SOURCE rc.ripe-dbase} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ %{l_shtool} install -c -m 755 %{l_value -s -a} \ %{SOURCE ripe-dbase-setup.sh} \ $RPM_BUILD_ROOT%{l_prefix}/sbin/ripe-dbase-setup %if "%{with_extobjs}" == "yes" %{l_shtool} install -c -m 755 %{l_value -s -a} \ %{SOURCE ripe-dbase-modify.sh} \ $RPM_BUILD_ROOT%{l_prefix}/sbin/ripe-dbase-modify l_hostname=`%{l_shtool} echo -e %h%d` %{l_shtool} install -c -m 755 %{l_value -s -a} \ -e "s;@l_hostname@;$l_hostname;g" \ %{SOURCE whois_filt.pl} \ $RPM_BUILD_ROOT%{l_prefix}/bin/whois_filt %{l_shtool} install -c -m 644 %{l_value -s -a} \ %{SOURCE whois_filt.config} \ $RPM_BUILD_ROOT%{l_prefix}/etc/ripe-dbase/ %{l_shtool} install -c -m 755 %{l_value -s -a} \ %{SOURCE rc.ripe-dbase.extobjs} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.ripe-dbase %{l_shtool} install -c -m 755 %{l_value -s -a} \ %{SOURCE rc.ripe-filter} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ %endif %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ %{l_files_std} \ '%config %{l_prefix}/etc/ripe-dbase/*' \ '%config %attr(0775,%{l_musr},%{l_mgrp}) %{l_prefix}/var/ripe-dbase/tmp' \ '%config %attr(0775,%{l_musr},%{l_mgrp}) %{l_prefix}/var/ripe-dbase/log/upd' \ '%config %attr(0775,%{l_musr},%{l_mgrp}) %{l_prefix}/var/ripe-dbase/log/forw' \ '%config %attr(0775,%{l_musr},%{l_mgrp}) %{l_prefix}/var/ripe-dbase/log/ack' %files -f files %clean rm -rf $RPM_BUILD_ROOT %post if [ $1 -eq 1 ]; then # display final hints on initial installation ( echo "1. To complete this installation of the RIPE Whois server," echo " please change all 'pwd' text in the following files:" echo " \$ $RPM_INSTALL_PREFIX/etc/ripe-dbase/rip.config.sample" echo " \$ $RPM_INSTALL_PREFIX/etc/ripe-dbase/sources.config.sample" echo " The text should match the MySQL password stored in:" echo " \$ $RPM_INSTALL_PREFIX/etc/mysql/my.pwd" echo "" echo "2. Now start the MySQL server:" echo " \$ $RPM_INSTALL_PREFIX/etc/rc mysql start" echo "" echo "Choose to either use the WHOIS server with (3a) no initial data," echo "or (3b) the full contents of the current RIPE database snapshot." echo "" echo "3a. To begin using the WHOIS server with an empty RIPE database, run:" echo " \$ $RPM_INSTALL_PREFIX/sbin/ripe-dbase-setup" echo "" echo "3b. To begin using the WHOIS server with actual RIPE data, do the" echo " following. This step may take ten (!) hours due to downloading" echo " ripe.db.gz (~60 Mb) and make_db data importing:" echo " \$ cd $RPM_INSTALL_PREFIX/var/ripe-dbase/tmp/load/RIPE" echo " \$ ftp ftp.ripe.net:ripe/dbase" echo " \$ mget RIPE.CURRENTSERIAL ripe.db.gz" echo " \$ quit" echo " \$ $RPM_INSTALL_PREFIX/libexec/ripe-dbase/make_db \\" echo " -c $RPM_INSTALL_PREFIX/etc/ripe-dbase/rip.config.sample \\" echo " -s RIPE -1" echo "" %if "%{with_extobjs}" == "yes" echo "4. Modify the native RIPE datastructures to accommodate the" echo " extra objects (which you selected by using with_extobjs):" echo " \$ $RPM_INSTALL_PREFIX/sbin/ripe-dbase-modify" echo "" echo "5. Finally start the WHOIS server by running:" echo " \$ $RPM_INSTALL_PREFIX/etc/rc ripe-dbase start" %else echo "4. Finally start the WHOIS server by running:" echo " \$ $RPM_INSTALL_PREFIX/etc/rc ripe-dbase start" %endif ) | %{l_rpmtool} msg -b -t notice fi if [ $1 -eq 2 ]; then # after upgrade, restart service eval `%{l_rc} ripe-dbase status 2>/dev/null` [ ".$ripe_dbase_active" = .yes ] && %{l_rc} ripe-dbase restart %if "%{with_extobjs}" == "yes" eval `%{l_rc} ripe-filter status 2>/dev/null` [ ".$ripe_filter_active" = .yes ] && %{l_rc} ripe-filter restart %endif fi exit 0 %preun if [ $1 -eq 0 ]; then # before erase, stop service and remove log files %{l_rc} ripe-dbase stop 2>/dev/null %if "%{with_extobjs}" == "yes" %{l_rc} ripe-filter stop 2>/dev/null %endif rm -rf $RPM_INSTALL_PREFIX/var/ripe-dbase/log/* >/dev/null 2>&1 || true fi exit 0