OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: r...@openpkg.org Module: openpkg-src Date: 11-Jul-2009 20:28:41 Branch: HEAD Handle: 2009071119284100 Added files: openpkg-src/davical davical-apache.conf davical-config.php davical-setup.sh davical.patch davical.spec rc.davical Log: initial packaging of DAViCal Summary: Revision Changes Path 1.1 +71 -0 openpkg-src/davical/davical-apache.conf 1.1 +20 -0 openpkg-src/davical/davical-config.php 1.1 +64 -0 openpkg-src/davical/davical-setup.sh 1.1 +23 -0 openpkg-src/davical/davical.patch 1.1 +164 -0 openpkg-src/davical/davical.spec 1.1 +39 -0 openpkg-src/davical/rc.davical ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/davical/davical-apache.conf ============================================================================ $ cvs diff -u -r0 -r1.1 davical-apache.conf --- /dev/null 2009-07-11 20:28:36 +0200 +++ davical-apache.conf 2009-07-11 20:28:41 +0200 @@ -0,0 +1,71 @@ +## +## davical-apache.conf -- DAViCal Apache Custom Configuration +## + +ServerRoot @l_prefix@ +ServerAdmin root@@l_hostn...@.@l_domainname@ +ServerName @l_hostn...@.@l_domainname@ +ServerTokens Prod +User @l_rusr@ +Group @l_rgrp@ +Listen 127.0.0.1:8080 + +# runtime files +PidFile @l_prefix@/var/davical/run/apache.pid +ScoreBoardFile @l_prefix@/var/davical/run/apache.sb +LockFile @l_prefix@/var/davical/run/apache.lck + +# include apache-php +Include @l_prefix@/etc/apache/apache.d/apache-php.conf + +# 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/davical/log/apache.access.log common + +# error logging +LogLevel warn +ErrorLog @l_prefix@/var/davical/log/apache.error.log +ServerSignature on + +# secure root directory +<Directory /> + Options FollowSymLinks + AllowOverride None +</Directory> + +# configure PHP +AddType application/x-httpd-php .php +php_admin_flag magic_quotes_gpc on +php_admin_flag register_globals on +php_admin_flag register_argc_argv off +php_admin_flag safe_mode on + +# configure DAViCal +php_value include_path @l_prefix@/lib/davical/davical/inc:@l_prefix@/lib/davical/awl/inc +php_value error_reporting "E_ALL & ~E_NOTICE" +php_value default_charset "utf-8" +DocumentRoot @l_prefix@/lib/davical/davical/htdocs +DirectoryIndex index.php +<Directory @l_prefix@/lib/davical/davical/htdocs> + Options None + AllowOverride None + Order allow,deny + Allow from all +</Directory> + @@ . patch -p0 <<'@@ .' Index: openpkg-src/davical/davical-config.php ============================================================================ $ cvs diff -u -r0 -r1.1 davical-config.php --- /dev/null 2009-07-11 20:28:36 +0200 +++ davical-config.php 2009-07-11 20:28:41 +0200 @@ -0,0 +1,20 @@ +<?php +## +## davical.php -- DAViCal server configuration +## + +$c->system_name = "DAViCal CalDAV Server"; +$c->domain_name = "calendar.example.com"; +$c->admin_email = 'hostmas...@example.com'; + +$c->pg_connect[] = "dbname=davical user=davical port=5433 host=localhost password=davical"; + +$c->home_calendar_name = 'home'; +$c->hide_TODO = true; +$c->readonly_webdav_collections = true; +$c->enable_row_linking = true; +$c->collections_always_exist = true; +$c->default_relationships = array(); +$c->default_locale = 'en_US.UTF-8'; +$c->allow_get_email_visibility = false; + @@ . patch -p0 <<'@@ .' Index: openpkg-src/davical/davical-setup.sh ============================================================================ $ cvs diff -u -r0 -r1.1 davical-setup.sh --- /dev/null 2009-07-11 20:28:36 +0200 +++ davical-setup.sh 2009-07-11 20:28:41 +0200 @@ -0,0 +1,64 @@ +#!/bin/sh +## +## davical-setup +## + +# command line argument sanity check +prg="$0" +if [ $# -eq 0 ]; then + echo "$prg:ERROR: invalid command line" 1>&2 + echo "$prg:USAGE: $prg install" 1>&2 + echo "$prg:USAGE: $prg uninstall" 1>&2 + echo "$prg:USAGE: $prg edit" 1>&2 + exit 1 +fi + +# database configuration +db_dir="@l_prefix@/var/davical/db" +db_name="davical" +db_user="davical" +db_pass="davical" +db_sname=`grep "^superuser_database" @l_prefix@/var/postgresql/db/pg_superuser.conf |\ + sed -e 's;^ *superuser_database="\(.*\)".*;\1;'` +db_suser=`grep "^superuser_username" @l_prefix@/var/postgresql/db/pg_superuser.conf |\ + sed -e 's;^ *superuser_username="\(.*\)".*;\1;'` +db_spass=`grep "^superuser_password" @l_prefix@/var/postgresql/db/pg_superuser.conf |\ + sed -e 's;^ *superuser_password="\(.*\)".*;\1;'` + +# dispatch operation +cmd="${1:-"install"}" +shift +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 ENCODING 'UTF8';" + ) | PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d "$db_sname" -f- + PGPASSWORD="$db_pass" @l_prefix@/bin/psql -q -U "$db_user" -d "$db_name" \ + -c "CREATE LANGUAGE plpgsql;" + PGPASSWORD="$db_pass" @l_prefix@/bin/psql -q -U "$db_user" -d "$db_name" -A -t \ + -f "@l_prefix@/lib/davical/awl/dba/awl-tables.sql" 2>&1 | grep -v NOTICE + PGPASSWORD="$db_pass" @l_prefix@/bin/psql -q -U "$db_user" -d "$db_name" -A -t \ + -f "@l_prefix@/lib/davical/awl/dba/schema-management.sql" 2>&1 | grep -v NOTICE + PGPASSWORD="$db_pass" @l_prefix@/bin/psql -q -U "$db_user" -d "$db_name" -A -t \ + -f "@l_prefix@/lib/davical/davical/dba/davical.sql" 2>&1 | grep -v NOTICE + PGPASSWORD="$db_pass" @l_prefix@/bin/psql -q -U "$db_user" -d "$db_name" -A -t \ + -f "@l_prefix@/lib/davical/davical/dba/base-data.sql" 2>&1 | grep -v NOTICE + PGPASSWORD="$db_pass" @l_prefix@/bin/psql -q -U "$db_user" -d "$db_name" \ + -c "UPDATE usr SET password = '**davical' WHERE user_no = 1;" + ;; + + uninstall ) + PGPASSWORD="$db_pass" @l_prefix@/bin/psql -q -U "$db_user" -d "$db_name" \ + -c "DROP LANGUAGE plpgsql CASCADE;" 2>&1 | grep -v NOTICE + ( echo "DROP DATABASE $db_name;" + echo "DROP TABLESPACE $db_name;" + echo "DROP ROLE $db_user;" + ) | PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d "$db_sname" -f- + ;; + + edit ) + PGPASSWORD="$db_spass" @l_prefix@/bin/psql -U "$db_suser" -d "$db_name" + ;; +esac + @@ . patch -p0 <<'@@ .' Index: openpkg-src/davical/davical.patch ============================================================================ $ cvs diff -u -r0 -r1.1 davical.patch --- /dev/null 2009-07-11 20:28:36 +0200 +++ davical.patch 2009-07-11 20:28:41 +0200 @@ -0,0 +1,23 @@ +Index: davical-0.9.7-0/inc/always.php +--- davical-0.9.7-0/inc/always.php.orig 2009-06-22 11:09:57 +0200 ++++ davical-0.9.7-0/inc/always.php 2009-07-11 17:46:28 +0200 +@@ -67,17 +67,8 @@ + * access which could break DAViCal completely by causing output to start + * too early. + */ +-if ( @file_exists("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php") ) { +- include_once("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php"); +-} +-else if ( @file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) { +- include_once("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php"); +-} +-else if ( @file_exists("/etc/davical/config.php") ) { +- include_once("/etc/davical/config.php"); +-} +-else if ( @file_exists("../config/config.php") ) { +- include_once("../config/config.php"); ++if ( @file_exists("@l_prefix@/etc/davical/davical-config.php") ) { ++ include_once("@l_prefix@/etc/davical/davical-config.php"); + } + else { + include_once("davical_configuration_missing.php"); @@ . patch -p0 <<'@@ .' Index: openpkg-src/davical/davical.spec ============================================================================ $ cvs diff -u -r0 -r1.1 davical.spec --- /dev/null 2009-07-11 20:28:36 +0200 +++ davical.spec 2009-07-11 20:28:41 +0200 @@ -0,0 +1,164 @@ +## +## davical.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/> +## +## 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 version +%define V_opkg 0.9.7 +%define V_davical 0.9.7-0 +%define V_awl 0.37 + +# package information +Name: davical +Summary: CalDAV Server +URL: http://rscds.sourceforge.net/ +Vendor: Andrew McMillan +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: EVAL +Group: Network +License: GPL +Version: %{V_opkg} +Release: 20090711 + +# list of sources +Source0: http://switch.dl.sourceforge.net/rscds/davical_%{V_davical}.tar.gz +Source1: http://switch.dl.sourceforge.net/rscds/awl_%{V_awl}.tar.gz +Source2: davical-config.php +Source3: davical-apache.conf +Source4: davical-setup.sh +Source5: rc.davical +Patch0: davical.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20060823 +PreReq: OpenPKG, openpkg >= 20060823 +PreReq: pcre, pcre::with_utf8 +PreReq: apache +PreReq: apache-php +PreReq: apache-php::with_pgsql = yes +PreReq: postgresql +AutoReq: no +AutoReqProv: no + +%description + The DAViCal CalDAV Server is a repository for calendar, schedule, + todo and journal entries which may be accessed with CalDAV capable + client software. + +%track + prog davical:davical = { + version = %{V_davical} + url = http://sourceforge.net/projects/rscds/files/ + regex = davical_(__VER__)\.tar\.gz + } + prog davical:awl = { + version = %{V_awl} + url = http://sourceforge.net/projects/rscds/files/ + regex = awl_(__VER__)\.tar\.gz + } + +%prep + %setup -q -c + %setup -q -T -D -a 1 + %patch -p0 + +%build + +%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}/etc/davical \ + $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical \ + $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl \ + $RPM_BUILD_ROOT%{l_prefix}/var/davical/db \ + $RPM_BUILD_ROOT%{l_prefix}/var/davical/run \ + $RPM_BUILD_ROOT%{l_prefix}/var/davical/log + cp -r awl-%{V_awl}/dba awl-%{V_awl}/inc \ + $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/ + rm -f davical-%{V_davical}/inc/always.php.in + %{l_shtool} subst %{l_value -s -a} \ + davical-%{V_davical}/inc/always.php + cp -r davical-%{V_davical}/dba davical-%{V_davical}/inc davical-%{V_davical}/htdocs \ + $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/ + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE davical-config.php} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/davical/ + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE davical-apache.conf} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/davical/ + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.davical} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE davical-setup.sh} \ + $RPM_BUILD_ROOT%{l_prefix}/sbin/davical-setup + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %{l_prefix}/etc/davical/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical/*' + +%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 Drupal please start PostgreSQL" + echo " and initialize the DAViCal database like this:" + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start" + echo " \$ $RPM_INSTALL_PREFIX/sbin/davical-setup install" + echo "" + echo "2. By default, DAViCal runs its own Apache server on IPv4 address" + echo " 127.0.0.1, TCP port 8080. Please change this by editing the" + echo " \"Listen 127.0.0.1:8080\" directive in:" + echo " $RPM_INSTALL_PREFIX/etc/davical/davical-apache.conf" + echo "" + echo "3. Now start DAViCal by running the command" + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc davical start" + echo " and connect with a CalDAV client to the URL:" + echo " http://127.0.0.1:8080/caldav.php" + ) | %{l_rpmtool} msg -b -t notice + fi + if [ $1 -eq 2 ]; then + # after upgrade, restart service + eval `%{l_rc} davical status 2>/dev/null` + [ ".$davical_active" = .yes ] && %{l_rc} davical restart + fi + exit 0 + +%preun + if [ $1 -eq 0 ]; then + # before erase, stop service and remove log files + %{l_rc} davical stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/davical/log/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/davical/run/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/davical/db/* >/dev/null 2>&1 || true + fi + exit 0 + @@ . patch -p0 <<'@@ .' Index: openpkg-src/davical/rc.davical ============================================================================ $ cvs diff -u -r0 -r1.1 rc.davical --- /dev/null 2009-07-11 20:28:36 +0200 +++ rc.davical 2009-07-11 20:28:41 +0200 @@ -0,0 +1,39 @@ +...@l_prefix@/bin/openpkg rc +## +## rc.davical -- Run-Commands +## + +%config + davical_enable="$openpkg_rc_def" + +%status -u @l_susr@ -o + davical_usable="no" + davical_active="no" + @l_prefix@/sbin/apache -t \ + -f @l_prefix@/etc/davical/davical-apache.conf 2>/dev/null && \ + davical_usable="yes" + [ -f @l_prefix@/var/davical/run/apache.pid ] && \ + kill -0 `cat @l_prefix@/var/davical/run/apache.pid` && \ + davical_active="yes" + echo "davical_enable=\"$davical_enable\"" + echo "davical_usable=\"$davical_usable\"" + echo "davical_active=\"$davical_active\"" + +%start -u @l_susr@ + rcService davical enable yes || exit 0 + rcService davical active yes && exit 0 + @l_prefix@/sbin/apache \ + -f @l_prefix@/etc/davical/davical-apache.conf + +%stop -u @l_susr@ + rcService davical enable yes || exit 0 + rcService davical active no && exit 0 + [ -f @l_prefix@/var/davical/run/apache.pid ] && \ + kill -TERM `cat @l_prefix@/var/davical/run/apache.pid` + sleep 2 + +%restart -u @l_susr@ + rcService davical enable yes || exit 0 + rcService davical active no && exit 0 + rc davical stop start + @@ . ______________________________________________________________________ OpenPKG http://openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org