diff --git a/rt/rc.rt b/rt/rc.rt new file mode 100644 index 0000000000..b8cb9827fb --- /dev/null +++ b/rt/rc.rt @@ -0,0 +1,57 @@ +#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc +## +## rc.rt -- RT Administration Run-Commands +## + +%config + rt_enable="yes" + rt_log_files="@l_prefix@/var/rt/log/access.log" + rt_log_rotsteps="10" + rt_log_rotminsize="10M" + rt_log_rotcomplevel="9" + rt_log_rotprolog="true" + rt_log_rotepilog="true" + rt_err_files="@l_prefix@/var/rt/log/error.log" + rt_err_rotsteps="10" + rt_err_rotminsize="1M" + rt_err_rotcomplevel="9" + rt_err_rotprolog="true" + rt_err_rotepilog="true" + rt_apachectl=@l_prefix@/libexec/rt/tools/rtapachectl + rt_sessiondir=@l_pefix@/var/rt/mason-session + +%start -p 200 -u root + opServiceEnabled rt || exit 0 + ${rt_apachectl} start + +%stop -p 200 -u root + opServiceEnabled rt || exit 0 + ${rt_apachectl} stop + sleep 2 + +%restart -u root + opServiceEnabled rt || exit 0 + ${rt_apachectl} restart + +%daily -u root + opServiceEnabled rt || exit 0 + if [ ".$rt_log_files" != . ]; then + shtool rotate -f \ + -n${rt_log_rotsteps} -s${rt_log_rotminsize} -d \ + -z${rt_log_rotcomplevel} -o@l_musr@ -g@l_mgrp@ -m644 \ + -P "$rt_log_rotprolog" \ + -E "${rt_apachectl} restart; $rt_log_rotepilog" \ + $rt_log_files + fi + if [ ".$rt_err_files" != . ]; then + shtool rotate -f \ + -n${rt_err_rotsteps} -s${rt_err_rotminsize} -d \ + -z${rt_err_rotcomplevel} -o@l_musr@ -g@l_mgrp@ -m644 \ + -P "$rt_err_rotprolog" \ + -E "${rt_apachectl} restart; $rt_err_rotepilog" \ + $rt_err_files + fi + +%hourly -u @l_rusr@ + opServiceEnabled rt || exit 0 + find $rt_sessiondir -type f -amin +600 -exec rm '{}' \; diff --git a/rt/rt.spec b/rt/rt.spec index fec8bde47c..37744fc6e9 100644 --- a/rt/rt.spec +++ b/rt/rt.spec @@ -26,6 +26,8 @@ %define V_real 2-0-15 %define V_here 2.0.15 %define V_log_dispatch 2.01 +%define V_html_mason 1.18 +%define V_libapreq 1.0 # package information Name: rt @@ -37,21 +39,28 @@ Distribution: OpenPKG [JUNK] Group: Database License: GPL Version: %{V_here} -Release: 20030116 +Release: 20030124 # list of sources Source0: http://www.cpan.org/modules/by-module/Log/Log-Dispatch-%{V_log_dispatch}.tar.gz -Source1: http://www.fsck.com/pub/rt/release/rt-%{V_real}.tar.gz +Source1: http://www.cpan.org/modules/by-authors/id/J/JI/JIMW/libapreq-%{V_libapreq}.tar.gz +Source2: http://www.cpan.org/modules/by-module/HTML/HTML-Mason-%{V_html_mason}.tar.gz +Source3: http://www.fsck.com/pub/rt/release/rt-%{V_real}.tar.gz +Source4: rc.rt +Source5: rtsetup +Source6: rtapachectl # build information Prefix: %{l_prefix} BuildRoot: %{l_buildroot} -BuildPreReq: OpenPKG, openpkg >= 20020206, perl +BuildPreReq: OpenPKG, openpkg >= 20020206, perl, perl-openpkg BuildPreReq: perl-sys, perl-util, perl-ds, perl-text BuildPreReq: perl-dbi, perl-dbix, perl-mail, perl-www -PreReq: OpenPKG, openpkg >= 20020206, perl, MYSQL, apache +PreReq: OpenPKG, openpkg >= 20020206, perl, perl-openpkg, +PreReq: MYSQL, apache, apache::with_mod_perl = yes, perl-apache PreReq: perl-sys, perl-util, perl-ds, perl-text PreReq: perl-dbi, perl-dbix, perl-mail, perl-www +PreReq: perl-dbi::with_dbd_mysql = yes AutoReq: no AutoReqProv: no @@ -65,21 +74,22 @@ AutoReqProv: no %prep %setup -q -c %setup -q -T -D -a 1 + %setup -q -T -D -a 2 + %setup -q -T -D -a 3 %build rm -rf $RPM_BUILD_ROOT + + # perform common prolog operations + rt=%{l_prefix}/libexec/rt + %{l_prefix}/bin/perl-openpkg prolog + %{l_shtool} mkdir -f -p -m 755 ${RPM_BUILD_ROOT}$rt + perl="${RPM_BUILD_DIR}/perl" + echo "exec ${l_prefix}/bin/perl \\" >>$perl + echo " \"\$@\"" >>$perl + chmod a+x $perl + ( cd Log-Dispatch-%{V_log_dispatch} - - # perform common prolog operations - rt=%{l_prefix}/share/rt - %{l_prefix}/bin/perl-openpkg prolog - %{l_shtool} mkdir -f -p -m 755 ${RPM_BUILD_ROOT}$rt - perl="${RPM_BUILD_DIR}/perl" - echo "exec ${l_prefix}/bin/perl \\" >>$perl - echo " \"\$@\"" >>$perl - chmod a+x $perl - - # build and install individual modules perl_args="INSTALLSITELIB=${RPM_BUILD_ROOT}$rt" make=`%{l_prefix}/bin/rpm --eval '%{l_make} %{l_mflags}'` make_args="PERL=${perl} FULLPERL=${perl}" @@ -89,24 +99,51 @@ AutoReqProv: no $perl Makefile.PL ${1+"$@"} $perl_args Makefile.PL + $perl Makefile.PL ${1+"$@"} $perl_args Makefile.PL + $perl Makefile.PL ${1+"$@"} $perl_args +Options None +AllowOverride None +Order allow,deny +Allow from all + + + +PerlRequire @l_prefix@/cgi/rt/webmux.pl + + SetHandler perl-script + PerlHandler RT::Mason + + diff --git a/rt/rtapachectl b/rt/rtapachectl new file mode 100644 index 0000000000..5fbdcf7804 --- /dev/null +++ b/rt/rtapachectl @@ -0,0 +1,7 @@ +#!/bin/sh + +sed \ + -e "s;^\(PIDFILE=\).*;\1@l_prefix@/var/rt/run/apache.pid;" \ + -e "s;^\(HTTPD=\)\(.*\);\1\"\2 -f @l_prefix@/libexec/rt/rtapache.conf\";" \ + @l_prefix@/sbin/apachectl \ +| sh -s "$@" diff --git a/rt/rtsetup b/rt/rtsetup new file mode 100644 index 0000000000..8b957f8745 --- /dev/null +++ b/rt/rtsetup @@ -0,0 +1,63 @@ +#!/bin/sh + +RT=@l_prefix@/libexec/rt +PERL=@l_prefix@/bin/perl + +cd $RT || exit 1 + +$PERL -L@l_prefix@/etc/rt -Mconfig 'print " + $DatabaseType + $DatabaseHost + $DatabasePort + $DatabaseUser + $DatabasePassword + $DatabaseName' |\ + read DB_TYPE DB_HOST DB_PORT DB_USER DB_PASS DB_NAME || exit 1 + +DB_DBA=@rt_db_dba@ + +# +# initdb +# +case "$DB_TYPE" in + Pg) + $PERL tools/initdb $DB_TYPE $DB_HOME $DB_HOST $DB_PORT \ + $DB_DBA $DB_DATABASE create + $PERL tools/initdb $DB_TYPE $DB_HOME $DB_HOST $DB_PORT \ + $DB_DBA $DB_DATABASE insert + $PERL -p -i -e " s'!!DB_TYPE!!'"$(DB_TYPE)"'g;\ + s'!!DB_HOST!!'"$(DB_HOST)"'g;\ + s'!!DB_RT_PASS!!'"$(DB_RT_PASS)"'g;\ + s'!!DB_RT_HOST!!'"$(DB_RT_HOST)"'g;\ + s'!!DB_RT_USER!!'"$(DB_RT_USER)"'g;\ + s'!!DB_DATABASE!!'"$(DB_DATABASE)"'g;"\ + $RT/etc/acl.$DB_TYPE + tools/initacls.$DB_TYPE $DB_HOME $DB_HOST $DB_PORT \ + $DB_DBA "" $DB_DATABASE \ + $RT/etc/acl.$DB_TYPE + ;; + mysql) + $PERL tools/initdb $DB_TYPE $DB_HOME $DB_HOST $DB_PORT \ + $DB_DBA $DB_DATABASE create + $PERL -p -i -e " s'!!DB_TYPE!!'"$(DB_TYPE)"'g;\ + s'!!DB_HOST!!'"$(DB_HOST)"'g;\ + s'!!DB_RT_PASS!!'"$(DB_RT_PASS)"'g;\ + s'!!DB_RT_HOST!!'"$(DB_RT_HOST)"'g;\ + s'!!DB_RT_USER!!'"$(DB_RT_USER)"'g;\ + s'!!DB_DATABASE!!'"$(DB_DATABASE)"'g;"\ + $RT/etc/acl.$DB_TYPE + tools/initacls.$DB_TYPE $DB_HOME $DB_HOST $DB_PORT \ + $DB_DBA "" $DB_DATABASE \ + $RT/etc/acl.$DB_TYPE + $PERL tools/initdb $DB_TYPE $DB_HOME $DB_HOST $DB_PORT \ + $DB_RT_USER $DB_DATABASE insert + ;; + Oracle) + ;; + *) + echo "Unknown database type $DB_TYPE" + exit 1 + ;; +esac + +