##
## ripe-dbase.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2003 The OpenPKG Project
## Copyright (c) 2000-2003 Ralf S. Engelschall
## Copyright (c) 2000-2003 Cable & Wireless
##
## 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.
##
# FIXME: rse: debug whois database data initial loading from RIPE NCC
# FIXME: rse: whois database data periodic updating from RIPE NCC
# package information
Name: ripe-dbase
Summary: RIPE NCC Whois Server
URL: http://www.ripe.net/ripencc/pub-services/db/
Vendor: RIPE NCC
Packager: The OpenPKG Project
Distribution: OpenPKG [JUNK]
Group: Database
License: RIPE NCC
Version: 3.2.0
Release: 20031219
# list of sources
Source0: ftp://ftp.ripe.net/ripe/dbase/software/ripe-dbase-%{version}.tar.gz
Source1: ripe-dbase-setup.sh
Source2: rc.ripe-dbase
Patch0: ripe-dbase.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20030103, make, gcc
PreReq: OpenPKG, openpkg >= 20030103
BuildPreReq: gnupg, glib, glib::with_threads = yes, mysql
BuildPreReq: libxml, libxslt, imap, zlib, openssl
PreReq: gnupg, glib, glib::with_threads = yes, mysql
PreReq: libxml, libxslt, imap, zlib, openssl
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.
%prep
%setup -q
%patch -p0
%{l_shtool} subst \
-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 SAMPLE localhost,3306,root,pwd,RIPEDB whois.mydb.net,43001,43004;' \
conf/rip.config.sample.in
%{l_shtool} subst \
-e 's;^\(DATABASE.*\)SAMPLEDB;\1RIPEDB;' \
-e 's;^\(database.*\)SAMPLEDB;\1RIPEDB;' \
-e 's;^\(host:.*\)sqlhost;\1localhost;' \
-e 's;^\(user:.*\)dbuser;\1root;' \
-e 's;^\(password:.*\)dbpsw;\1pwd;' \
conf/sources.config.sample
%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
%{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
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
%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 start MySQL and initialize the database like this:"
echo " \$ $RPM_INSTALL_PREFIX/etc/rc mysql start"
echo " \$ $RPM_INSTALL_PREFIX/sbin/ripe-dbase-setup"
echo ""
echo "2. Although the RIPE Whois server is ready to run, it has no"
echo " data to serve yet. As an optional step, download this data"
echo " from RIPE and integrate it into the database:"
echo " \$ cd $RPM_INSTALL_PREFIX/var/ripe-dbase/tmp/load/RIPE"
echo " \$ ftp ftp.ripe.net"
echo " \$ get ripe/dbase/ripe.db.gz"
echo " \$ get ripe/dbase/RIPE.CURRENTSERIAL"
echo " \$ quit
echo " \$ gzip -d ripe.db.gz"
echo " \$ $RPM_INSTALL_PREFIX/libexec/ripe-dbase/make_db \\"
echo " -c $RPM_INSTALL_PREFIX/etc/ripe-dbase/rip.config.sample \\"
echo " -s $RPM_INSTALL_PREFIX/var/ripe-dbase/tmp/load/RIPE/ripe.db -1"
echo ""
echo "3. Start the server by running:"
echo " \$ $RPM_INSTALL_PREFIX/etc/rc ripe-dbase start"
) | %{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
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
rm -f $RPM_INSTALL_PREFIX/var/ripe-dbase/log/* >/dev/null 2>&1 || true
fi
exit 0