OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 16-Apr-2007 22:28:53 Branch: HEAD Handle: 2007041621285201 Added files: openpkg-src/punbb punbb-apache.conf punbb-setup.sh punbb.patch punbb.spec rc.punbb Log: first cut for a PunBB package Summary: Revision Changes Path 1.1 +106 -0 openpkg-src/punbb/punbb-apache.conf 1.1 +30 -0 openpkg-src/punbb/punbb-setup.sh 1.1 +89 -0 openpkg-src/punbb/punbb.patch 1.1 +171 -0 openpkg-src/punbb/punbb.spec 1.1 +45 -0 openpkg-src/punbb/rc.punbb ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/punbb/punbb-apache.conf ============================================================================ $ cvs diff -u -r0 -r1.1 punbb-apache.conf --- /dev/null 2007-04-16 22:25:30 +0200 +++ punbb-apache.conf 2007-04-16 22:28:53 +0200 @@ -0,0 +1,106 @@ +## +## punbb-apache.conf -- PunBB Apache Custom Configuration +## + +ServerType standalone +ServerRoot @l_prefix@ +ServerAdmin root@@[EMAIL PROTECTED]@l_domainname@ +ServerName @[EMAIL PROTECTED]@l_domainname@ +ServerTokens Prod +User @l_rusr@ +Group @l_rgrp@ +Port 8080 +Listen 127.0.0.1:8080 + +# runtime files +PidFile @l_prefix@/var/punbb/run/apache.pid +ScoreBoardFile @l_prefix@/var/punbb/run/apache.sb +LockFile @l_prefix@/var/punbb/run/apache.lck + +# server behaviour +Timeout 300 +KeepAlive on +MaxKeepAliveRequests 100 +KeepAliveTimeout 15 +MinSpareServers 5 +MaxSpareServers 10 +StartServers 5 +MaxClients 15 +MaxRequestsPerChild 500 +HostnameLookups off +UseCanonicalName on + +# access logging +LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %b" common +LogFormat "%{Referer}i -> %U" referer +LogFormat "%{User-agent}i" agent +CustomLog @l_prefix@/var/punbb/log/apache.access.log common + +# error logging +LogLevel warn +ErrorLog @l_prefix@/var/punbb/log/apache.error.log +ServerSignature on + +# secure root directory +<Directory /> + Options FollowSymLinks + AllowOverride None +</Directory> + +# browser specifics +BrowserMatch "Mozilla/2" nokeepalive +BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 +BrowserMatch "RealPlayer 4\.0" force-response-1.0 +BrowserMatch "Java/1\.0" force-response-1.0 +BrowserMatch "JDK/1\.0" force-response-1.0 + +# SSL/TLS support +<IfModule mod_ssl.c> + SSLRandomSeed startup builtin + SSLRandomSeed connect builtin + SSLMutex sem + SSLSessionCache shmcb:@l_prefix@/var/punbb/run/apache.scache(512000) + SSLSessionCacheTimeout 300 + SSLLog @l_prefix@/var/punbb/log/apache.ssl.log + SSLLogLevel warn + SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL + SetEnvIf User-Agent ".*MSIE.*" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + <Files ~ "\.(cgi|shtml|phtml|php?)$"> + SSLOptions +StdEnvVars + </Files> + <Directory "@l_prefix@/cgi"> + SSLOptions +StdEnvVars + </Directory> +</IfModule> + +# configure PHP for phpBB +AddType application/x-httpd-php .php +php_admin_flag register_globals off +php_admin_flag safe_mode on +php_admin_flag safe_mode_gid on +php_admin_flag allow_url_fopen off +php_admin_flag display_errors off +php_admin_value log_errors on +php_admin_value max_execution_time 60 +php_admin_value max_input_time 60 +php_admin_value memory_limit 8M +php_admin_value post_max_size 8M +php_admin_value include_path .:@l_prefix@/lib/punbb:@l_prefix@/lib/php +php_admin_value safe_mode_include_dir @l_prefix@/lib/punbb + +# configure phpBB +RewriteEngine on +RewriteRule ^/$ /punbb/ [R,L] +Alias /punbb @l_prefix@/lib/punbb +DocumentRoot @l_prefix@/lib/punbb +DirectoryIndex index.php +<Directory "@l_prefix@/lib/punbb"> + Options Indexes ExecCGI FollowSymLinks + AllowOverride All + Order allow,deny + Allow from all +</Directory> + @@ . patch -p0 <<'@@ .' Index: openpkg-src/punbb/punbb-setup.sh ============================================================================ $ cvs diff -u -r0 -r1.1 punbb-setup.sh --- /dev/null 2007-04-16 22:25:30 +0200 +++ punbb-setup.sh 2007-04-16 22:28:53 +0200 @@ -0,0 +1,30 @@ +#!/bin/sh +## +## punbb-setup.sh -- PunBB RDBMS Setup Utility +## + +# determine database details +db_dir="@l_prefix@/var/punbb/db" +db_name="punbb" +db_user="punbb" +db_pass="punbb" +db_suser="postgresql" + +# dispatch operation +cmd="${1:-"install"}" +case "$cmd" in + install ) + ( echo "CREATE ROLE $db_user LOGIN ENCRYPTED PASSWORD '$db_pass' NOCREATEDB NOCREATEUSER;" + echo "CREATE TABLESPACE $db_name OWNER $db_user LOCATION '$db_dir';" + echo "CREATE DATABASE $db_name OWNER $db_user TABLESPACE $db_name;" + ) | @l_prefix@/bin/psql -U "$db_suser" -d template1 -f- + ;; + uninstall ) + ( echo "DROP DATABASE $db_name;" + echo "DROP TABLESPACE $db_name;" + echo "DROP ROLE $db_user;" + ) | @l_prefix@/bin/psql -U "$db_suser" -d template1 -f- + rm -rf @l_prefix@/var/punbb/db/* >/dev/null 2>&1 || true + ;; +esac + @@ . patch -p0 <<'@@ .' Index: openpkg-src/punbb/punbb.patch ============================================================================ $ cvs diff -u -r0 -r1.1 punbb.patch --- /dev/null 2007-04-16 22:25:30 +0200 +++ punbb.patch 2007-04-16 22:28:53 +0200 @@ -0,0 +1,89 @@ +Index: upload/include/dblayer/pgsql.php +--- upload/include/dblayer/pgsql.php.orig 2007-04-16 13:57:33 +0200 ++++ upload/include/dblayer/pgsql.php 2007-04-16 22:15:23 +0200 +@@ -146,6 +146,59 @@ + } + + ++ function query_build($query, $unbuffered = false) ++ { ++ $sql = ''; ++ ++ if (isset($query['SELECT'])) ++ { ++ $sql = 'SELECT '.$query['SELECT'].' FROM '.$this->prefix.$query['FROM']; ++ ++ if (isset($query['JOINS'])) ++ { ++ foreach ($query['JOINS'] as $cur_join) ++ $sql .= ' '.key($cur_join).' '.$this->prefix.current($cur_join).' ON '.$cur_join['ON']; ++ } ++ ++ if (!empty($query['WHERE'])) ++ $sql .= ' WHERE '.$query['WHERE']; ++ if (!empty($query['GROUP BY'])) ++ $sql .= ' GROUP BY '.$query['GROUP BY']; ++ if (!empty($query['HAVING'])) ++ $sql .= ' HAVING '.$query['HAVING']; ++ if (!empty($query['ORDER BY'])) ++ $sql .= ' ORDER BY '.$query['ORDER BY']; ++ if (!empty($query['LIMIT'])) ++ $sql .= ' LIMIT '.$query['LIMIT']; ++ } ++ else if (isset($query['INSERT'])) ++ { ++ $sql = 'INSERT INTO '.$this->prefix.$query['INTO']; ++ ++ if (!empty($query['INSERT'])) ++ $sql .= ' ('.$query['INSERT'].')'; ++ ++ $sql .= ' VALUES('.$query['VALUES'].')'; ++ } ++ else if (isset($query['UPDATE'])) ++ { ++ $sql = 'UPDATE '.$this->prefix.$query['UPDATE'].' SET '.$query['SET']; ++ ++ if (!empty($query['WHERE'])) ++ $sql .= ' WHERE '.$query['WHERE']; ++ } ++ else if (isset($query['DELETE'])) ++ { ++ $sql = 'DELETE FROM '.$this->prefix.$query['DELETE']; ++ ++ if (!empty($query['WHERE'])) ++ $sql .= ' WHERE '.$query['WHERE']; ++ } ++ ++ return $this->query($sql, $unbuffered); ++ } ++ ++ + function result($query_id = 0, $row = 0) + { + return ($query_id) ? @pg_fetch_result($query_id, $row, 0) : false; +Index: upload/install.php +--- upload/install.php.orig 2007-03-17 18:32:58 +0100 ++++ upload/install.php 2007-04-16 22:16:16 +0200 +@@ -175,7 +175,7 @@ + </div> + <p class="field required"> + <label for="req_db_name">Database name<em> * <span class="acchide">(Required)</span></em></label><br /> +- <span class="input"><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" /></span> ++ <span class="input"><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" value="punbb"/></span> + </p> + <div class="form-info"> + <h2 class="prefix"><span>Step 4: </span></h2> +@@ -183,11 +183,11 @@ + </div> + <p class="field"> + <label for="fld3">Database username</label><br /> +- <span class="input"><input id="fld3" type="text" name="db_username" size="30" maxlength="50" /></span> ++ <span class="input"><input id="fld3" type="text" name="db_username" size="30" maxlength="50" value="punbb"/></span> + </p> + <p class="field"> + <label for="fld4">Database password</label><br /> +- <span class="input"><input id="fld4" type="text" name="db_password" size="30" maxlength="50" /></span> ++ <span class="input"><input id="fld4" type="text" name="db_password" size="30" maxlength="50" value="punbb"/></span> + </p> + <div class="form-info"> + <h2 class="prefix"><span>Step 5: </span></h2> @@ . patch -p0 <<'@@ .' Index: openpkg-src/punbb/punbb.spec ============================================================================ $ cvs diff -u -r0 -r1.1 punbb.spec --- /dev/null 2007-04-16 22:25:30 +0200 +++ punbb.spec 2007-04-16 22:28:53 +0200 @@ -0,0 +1,171 @@ +## +## punbb.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> +## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> +## +## 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: punbb +Summary: Web Discussion Board +URL: http://www.punbb.org/ +Vendor: Rickard Andersson et al. +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: EVAL +Group: CMS +License: GPL +Version: 1.3snap20070416 +Release: 20070416 + +# list of sources +Source0: ftp://ftp.openpkg.org/sources/CPY/punbb/punbb-%{version}.tar.gz +Source1: punbb-apache.conf +Source2: punbb-setup.sh +Source3: rc.punbb +Patch0: punbb.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20060823 +PreReq: OpenPKG, openpkg >= 20060823 +PreReq: apache +PreReq: apache::with_mod_php = yes +PreReq: apache::with_mod_php_pgsql = yes +PreReq: apache::with_mod_php_zlib = yes +PreReq: apache::with_mod_php_pcre = yes +PreReq: apache::with_mod_php_xml = yes +PreReq: pcre, pcre::with_utf8 = yes +AutoReq: no +AutoReqProv: no + +%description + PunBB is a fast and lightweight PHP-powered discussion board. + Its primary goals are to be faster, smaller and less graphically + intensive as compared to other discussion boards. PunBB has fewer + features than many other discussion boards, but is generally faster + and outputs smaller, semantically correct XHTML-compliant pages. + +%track + prog punbb = { + version = %{version} + url = ftp://ftp.openpkg.org/sources/CPY/punbb/ + regex = punbb-(__VER__)\.tar\.gz + } + +%prep + %setup -q -n punbb + %patch -p0 + +%build + +%install + # create installation hierarchy + 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}/etc/punbb \ + $RPM_BUILD_ROOT%{l_prefix}/lib/punbb/runtime \ + $RPM_BUILD_ROOT%{l_prefix}/var/punbb/db \ + $RPM_BUILD_ROOT%{l_prefix}/var/punbb/log \ + $RPM_BUILD_ROOT%{l_prefix}/var/punbb/run + + # install main program files + %{l_shtool} subst %{l_value -s -a} \ + upload/install.php + find . -name ".svn" -type d -print | xargs rm -rf + cp -rp upload/* $RPM_BUILD_ROOT%{l_prefix}/lib/punbb/ + cp -p extras/.htaccess $RPM_BUILD_ROOT%{l_prefix}/lib/punbb/ + + # install setup script + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE punbb-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/punbb-setup + + # install run-command script + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + -e 's;@l_path@;%{l_build_path};' \ + %{SOURCE rc.punbb} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install Apache configuration + l_hostname=`%{l_shtool} echo -e %h` + l_domainname=`%{l_shtool} echo -e %d | cut -c2-` + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + -e "s;@l_hostname@;$l_hostname;g" \ + -e "s;@l_domainname@;$l_domainname;g" \ + %{SOURCE punbb-apache.conf} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/punbb/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/punbb/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/punbb' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/punbb/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/punbb/*/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/punbb/*/*/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/punbb' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/punbb/*' \ + '%dir %attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/punbb/db' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%post + if [ $1 -eq 1 ]; then + # display final hints on initial installation + ln -s ../install $RPM_INSTALL_PREFIX/lib/punbb/runtime/install + ( echo "To complete the PunBB installation:" + echo "1. start the PostgreSQL RDBMS:" + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start" + echo "2. create the PunBB database:" + echo " \$ $RPM_INSTALL_PREFIX/sbin/punbb-setup" + echo "3. start the PunBB Apache:" + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc punbb start" + echo "4. install the PunBB database by accessing the" + echo " following URL and proceeding through its menus:" + echo " http://localhost:8080/punbb/install.php" + echo "5. cleanup after installation to enable run-time:" + echo " \$ rm -f $RPM_INSTALL_PREFIX/lib/punbb/install.php" + ) | %{l_rpmtool} msg -b -t notice + elif [ $1 -eq 2 ]; then + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} punbb status 2>/dev/null` + [ ".$punbb_active" = .yes ] && %{l_rc} punbb restart + fi + exit 0 + +%preun + if [ $1 -eq 0 ]; then + # before erase, stop service + %{l_rc} punbb stop 2>/dev/null + + # remove run-time files + rm -f $RPM_INSTALL_PREFIX/var/punbb/db/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/punbb/db/*/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/punbb/run/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/punbb/log/* >/dev/null 2>&1 || true + fi + exit 0 + @@ . patch -p0 <<'@@ .' Index: openpkg-src/punbb/rc.punbb ============================================================================ $ cvs diff -u -r0 -r1.1 rc.punbb --- /dev/null 2007-04-16 22:25:30 +0200 +++ rc.punbb 2007-04-16 22:28:53 +0200 @@ -0,0 +1,45 @@ [EMAIL PROTECTED]@/bin/openpkg rc +## +## rc.punbb -- Run-Commands +## + +%config + punbb_enable="$openpkg_rc_def" + +%common + punbb_cfgfile="@l_prefix@/etc/punbb/punbb-apache.conf" + punbb_pidfile="@l_prefix@/var/punbb/run/apache.pid" + punbb_signal () { + [ -f $punbb_pidfile ] && kill -$1 `cat $punbb_pidfile` + } + +%status -u @l_susr@ -o + punbb_usable="no" + punbb_active="no" + @l_prefix@/sbin/apache -t -f $punbb_cfgfile 2>/dev/null && \ + punbb_usable="yes" + punbb_signal 0 && \ + punbb_active="yes" + echo "punbb_enable=\"$punbb_enable\"" + echo "punbb_usable=\"$punbb_usable\"" + echo "punbb_active=\"$punbb_active\"" + +%start -u @l_susr@ + rcService punbb enable yes || exit 0 + rcService punbb active yes && exit 0 + ( export PATH="@l_path@" + @l_prefix@/sbin/apache -f $punbb_cfgfile + ) || exit $? + +%stop -u @l_susr@ + rcService punbb enable yes || exit 0 + rcService punbb active no && exit 0 + punbb_signal TERM + sleep 2 + rm -f $punbb_pidfile >/dev/null 2>&1 || true + +%restart -u @l_susr@ + rcService punbb enable yes || exit 0 + rcService punbb active no && exit 0 + rc punbb stop start + @@ . ______________________________________________________________________ OpenPKG http://openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org