3 changed files with 125 additions and 3 deletions
@ -0,0 +1,54 @@ |
|||||||
|
#!@l_prefix@/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="myaddress@mailserver.net" |
||||||
|
ripe_dbase_gliblibdir="`@l_prefix@/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 |
||||||
|
|
||||||
@ -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 |
||||||
|
#@l_prefix@/libexec/ripe-dbase/make_db |
||||||
|
#@l_prefix@/libexec/ripe-dbase/make_mysql_user |
||||||
|
@l_prefix@/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 |
||||||
|
#@l_prefix@/bin/mysql --user=root --password=$password ripe <@l_prefix@/libexec/ripe-dbase/SQL/create.tables.sql |
||||||
|
|
||||||
|
# create a MySQL username/password for RIPE |
||||||
|
@l_prefix@/bin/mysql --user=root --password=$password mysql <<EOF |
||||||
|
GRANT ALL ON ripe.* TO ripe@localhost IDENTIFIED BY 'ripe'; |
||||||
|
FLUSH PRIVILEGES; |
||||||
|
EOF |
||||||
|
|
||||||
Loading…
Reference in new issue