OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael Schloh
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src Date: 05-Dec-2003 18:07:09
Branch: HEAD Handle: 2003120517070800
Added files:
openpkg-src/ripe-dbase rc.ripe-dbase ripe-dbase-setup.sh
Modified files:
openpkg-src/ripe-dbase ripe-dbase.spec
Log:
add run commands, add database setup script, improve description,
other text, and install logic, and add post and pre install logic
Summary:
Revision Changes Path
1.1 +54 -0 openpkg-src/ripe-dbase/rc.ripe-dbase
1.1 +25 -0 openpkg-src/ripe-dbase/ripe-dbase-setup.sh
1.3 +46 -3 openpkg-src/ripe-dbase/ripe-dbase.spec
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/ripe-dbase/rc.ripe-dbase
============================================================================
$ cvs diff -u -r0 -r1.1 rc.ripe-dbase
--- /dev/null 2003-12-05 18:07:08.000000000 +0100
+++ rc.ripe-dbase 2003-12-05 18:07:08.000000000 +0100
@@ -0,0 +1,54 @@
[EMAIL PROTECTED]@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+## rc.ripe-dbase -- Run-Commands
+##
+
+%config
+ ripe_dbase_enable="$openpkg_rc_def"
+
+%common
+ ripe_dbase_pidfile="@l_prefix@/var/ripe-dbase/whois_rip.pid"
+ ripe_dbase_cfgfile="rip.config.sample"
+ ripe_dbase_basedir="@l_prefix@"
+ ripe_dbase_crashes=10
+ ripe_dbase_notify="[EMAIL PROTECTED]"
+ ripe_dbase_gliblibdir="[EMAIL PROTECTED]@/bin/glib-config --prefix`/lib"
+ ripe_dbase_mysqllibdir="@l_prefix@/lib/mysql"
+ ripe_dbase_librarypath="$ripe_dbase_mysqllibdir:$ripe_dbase_gliblibdir"
+ ripe_dbase_signal () {
+ [ -f $ripe_dbase_pidfile ] && kill -$1 `cat $ripe_dbase_pidfile`
+ }
+
+%status -u @l_susr@ -o
+ ripe_dbase_usable="unknown"
+ ripe_dbase_active="no"
+ rcService ripe_dbase enable yes && \
+ ripe_dbase_signal 0 && ripe_dbase_active="yes"
+ echo "ripe_dbase_enable=\"$ripe_dbase_enable\""
+ echo "ripe_dbase_usable=\"$ripe_dbase_usable\""
+ echo "ripe_dbase_active=\"$ripe_dbase_active\""
+
+%start -u @l_susr@
+ rcService ripe_dbase enable yes || exit 0
+ rcService ripe_dbase active yes && exit 0
+ @l_prefix@/bin/whoisd_start \
+ --config=${ripe_dbase_cfgfile} --pid-file=${ripe_dbase_pidfile} \
+ --basedir=${ripe_dbase_basedir} --crashes=${ripe_dbase_crashes} \
+ --notify=${ripe_dbase_notify} --library_path=${ripe_dbase_librarypath} &
+
+%stop -u @l_susr@
+ rcService ripe_dbase enable yes || exit 0
+ rcService ripe_dbase active no && exit 0
+ ripe_dbase_signal TERM
+ sleep 2
+
+%restart -u @l_susr@
+ rcService ripe_dbase enable yes || exit 0
+ rcService ripe_dbase active no && exit 0
+ rc ripe-dbase stop start
+
+%reload -u @l_susr@
+ rcService ripe_dbase enable yes || exit 0
+ rcService ripe_dbase active no && exit 0
+ ripe_dbase_signal HUP
+
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/ripe-dbase/ripe-dbase-setup.sh
============================================================================
$ cvs diff -u -r0 -r1.1 ripe-dbase-setup.sh
--- /dev/null 2003-12-05 18:07:08.000000000 +0100
+++ ripe-dbase-setup.sh 2003-12-05 18:07:08.000000000 +0100
@@ -0,0 +1,25 @@
+#!/bin/sh
+##
+## ripedb-setup
+##
+
+# determine MySQL root password
+password=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\
+ sed -e 's;^password[^=]*= *;;' -e 's; *$;;'`
+
+# create the MySQL database for RIPE
+# FIXME: possible reuse scripts from original distribution
[EMAIL PROTECTED]@/libexec/ripe-dbase/make_db
[EMAIL PROTECTED]@/libexec/ripe-dbase/make_mysql_user
[EMAIL PROTECTED]@/bin/mysqladmin --user=root --password=$password create ripe
+
+# FIXME: probably suck RIPE objects vie FTP or their special protocol here
+## create the default RIPE database schema
[EMAIL PROTECTED]@/bin/mysql --user=root --password=$password ripe
<@l_prefix@/libexec/ripe-dbase/SQL/create.tables.sql
+
+# create a MySQL username/password for RIPE
[EMAIL PROTECTED]@/bin/mysql --user=root --password=$password mysql <<EOF
+GRANT ALL ON ripe.* TO [EMAIL PROTECTED] IDENTIFIED BY 'ripe';
+FLUSH PRIVILEGES;
+EOF
+
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/ripe-dbase/ripe-dbase.spec
============================================================================
$ cvs diff -u -r1.2 -r1.3 ripe-dbase.spec
--- openpkg-src/ripe-dbase/ripe-dbase.spec 5 Dec 2003 11:56:27 -0000 1.2
+++ openpkg-src/ripe-dbase/ripe-dbase.spec 5 Dec 2003 17:07:08 -0000 1.3
@@ -23,8 +23,8 @@
## SUCH DAMAGE.
##
-# FIXME: rse: run-command script has to be added
-# FIXME: rse: mysql database initialization has to be added via ripe-dbase-setup
similar to "rt-setup" and "cacti-setup"
+# FIXME: rse: run-command script must be debugged
+# FIXME: rse: mysql database initialization must be debugged
# FIXME: rse: whois database data initial loading from RIPE NCC ftp service
snapshots?
# FIXME: rse: whois database data periodic updating from RIPE NCC
@@ -42,6 +42,8 @@
# 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
@@ -57,7 +59,10 @@
AutoReqProv: no
%description
- RIPE-dbase is the official RIPE NCC's WHOIS Database Server software.
+ 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
@@ -85,15 +90,53 @@
%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
%{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. After initializing the database, 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
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]