davical/davical.spec

changeset 290
731574048d85
child 291
52571005077f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/davical/davical.spec	Mon Nov 22 12:39:58 2010 +0100
     1.3 @@ -0,0 +1,204 @@
     1.4 +##
     1.5 +##  davical.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +#   package version
    1.28 +%define       V_opkg    0.9.9.3
    1.29 +%define       V_davical 0.9.9.3
    1.30 +%define       V_awl     0.37
    1.31 +
    1.32 +#   package information
    1.33 +Name:         davical
    1.34 +Summary:      CalDAV Server
    1.35 +URL:          http://rscds.sourceforge.net/
    1.36 +Vendor:       Andrew McMillan
    1.37 +Packager:     OpenPKG Foundation e.V.
    1.38 +Distribution: OpenPKG Community
    1.39 +Class:        EVAL
    1.40 +Group:        Network
    1.41 +License:      GPL
    1.42 +Version:      %{V_opkg}
    1.43 +Release:      20100926
    1.44 +
    1.45 +#   package options
    1.46 +%define       with_ssl  no
    1.47 +
    1.48 +#   list of sources
    1.49 +Source0:      http://debian.mcmillan.net.nz/packages/davical/davical-%{V_davical}.tar.gz
    1.50 +Source1:      http://debian.mcmillan.net.nz/packages/awl/awl_%{V_awl}.tar.gz
    1.51 +Source2:      davical-config.php
    1.52 +Source3:      davical-apache.conf
    1.53 +Source4:      davical-setup.sh
    1.54 +Source5:      rc.davical
    1.55 +Patch0:       davical.patch
    1.56 +
    1.57 +#   build information
    1.58 +BuildPreReq:  OpenPKG, openpkg >= 20100101
    1.59 +PreReq:       OpenPKG, openpkg >= 20100101
    1.60 +PreReq:       pcre, pcre::with_utf8
    1.61 +PreReq:       apache
    1.62 +%if "%{with_ssl}" == "yes"
    1.63 +PreReq:       apache::with_mod_ssl = yes, x509
    1.64 +%endif
    1.65 +PreReq:       apache-php
    1.66 +PreReq:       apache-php::with_pgsql = yes
    1.67 +PreReq:       apache-php::with_gettext = yes
    1.68 +PreReq:       postgresql
    1.69 +
    1.70 +%description
    1.71 +    The DAViCal CalDAV Server is a repository for calendar, schedule,
    1.72 +    todo and journal entries which may be accessed with CalDAV capable
    1.73 +    client software.
    1.74 +
    1.75 +%track
    1.76 +    prog davical:davical = {
    1.77 +        version   = %{V_davical}
    1.78 +        url       = http://debian.mcmillan.net.nz/packages/davical/
    1.79 +        regex     = davical-(__VER__)\.tar\.gz
    1.80 +    }
    1.81 +    prog davical:awl = {
    1.82 +        version   = %{V_awl}
    1.83 +        url       = http://debian.mcmillan.net.nz/packages/awl/
    1.84 +        regex     = awl_(__VER__)\.tar\.gz
    1.85 +    }
    1.86 +
    1.87 +%prep
    1.88 +    %setup -q -c
    1.89 +    %setup -q -T -D -a 1
    1.90 +    %patch -p0
    1.91 +
    1.92 +%build
    1.93 +
    1.94 +%install
    1.95 +    #   create installation hierarchy
    1.96 +    %{l_shtool} mkdir -f -p -m 755 \
    1.97 +        $RPM_BUILD_ROOT%{l_prefix}/sbin \
    1.98 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
    1.99 +        $RPM_BUILD_ROOT%{l_prefix}/etc/davical \
   1.100 +        $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical \
   1.101 +        $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl \
   1.102 +        $RPM_BUILD_ROOT%{l_prefix}/var/davical/db \
   1.103 +        $RPM_BUILD_ROOT%{l_prefix}/var/davical/run \
   1.104 +        $RPM_BUILD_ROOT%{l_prefix}/var/davical/log
   1.105 +
   1.106 +    #   install program components
   1.107 +    find . -name "*.orig" -print | xargs rm -f
   1.108 +    cp -r \
   1.109 +        awl-%{V_awl}/dba \
   1.110 +        awl-%{V_awl}/inc \
   1.111 +        $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/
   1.112 +    rm -f davical-%{V_davical}/inc/always.php.in
   1.113 +    %{l_shtool} subst %{l_value -s -a} \
   1.114 +        davical-%{V_davical}/inc/always.php
   1.115 +    cp -r \
   1.116 +        davical-%{V_davical}/dba \
   1.117 +        davical-%{V_davical}/inc \
   1.118 +        davical-%{V_davical}/htdocs \
   1.119 +        $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/
   1.120 +
   1.121 +    #   install DAViCal application configuration file
   1.122 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.123 +        %{SOURCE davical-config.php} \
   1.124 +        $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
   1.125 +
   1.126 +    #   install DAViCal Apache configuration file
   1.127 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.128 +        %{SOURCE davical-apache.conf} \
   1.129 +        $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
   1.130 +
   1.131 +    #   install run-command script
   1.132 +%if "%{with_ssl}" == "yes"
   1.133 +    with_ssl="-DSSL"
   1.134 +%else
   1.135 +    with_ssl=""
   1.136 +%endif
   1.137 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.138 +        -e "s;@with_ssl@;$with_ssl;" \
   1.139 +        %{SOURCE rc.davical} \
   1.140 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.141 +
   1.142 +    #   install RDBMS setup script
   1.143 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.144 +        %{SOURCE davical-setup.sh} \
   1.145 +        $RPM_BUILD_ROOT%{l_prefix}/sbin/davical-setup
   1.146 +
   1.147 +    #   determine installation files
   1.148 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   1.149 +        %{l_files_std} \
   1.150 +        '%config %{l_prefix}/etc/davical/*' \
   1.151 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical' \
   1.152 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical/*'
   1.153 +
   1.154 +%files -f files
   1.155 +
   1.156 +%clean
   1.157 +
   1.158 +%post
   1.159 +    if [ $1 -eq 1 ]; then
   1.160 +        #   display final hints on initial installation
   1.161 +        ( echo "1. To complete this installation of Drupal please start PostgreSQL"
   1.162 +          echo "   and initialize the DAViCal database like this:"
   1.163 +          echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
   1.164 +          echo "     \$ $RPM_INSTALL_PREFIX/sbin/davical-setup install"
   1.165 +          echo ""
   1.166 +          echo "2. By default, DAViCal runs its own SSL/TLS based Apache server"
   1.167 +          echo "   under 127.0.0.1, TCP port 8443. Please change this by editing"
   1.168 +          echo "   the \"Listen 127.0.0.1:8443\" directive in:"
   1.169 +          echo "     $RPM_INSTALL_PREFIX/etc/davical/davical-apache.conf"
   1.170 +          echo ""
   1.171 +          echo "3. Now start DAViCal by running the command"
   1.172 +          echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc davical start"
   1.173 +          echo "   and connect with a browser to the URL"
   1.174 +%if "%{with_ssl}" == "yes"
   1.175 +          echo "     https://127.0.0.1:8443/"
   1.176 +%else
   1.177 +          echo "     https://127.0.0.1:8080/"
   1.178 +%endif
   1.179 +          echo "   and create user accounts."
   1.180 +          echo ""
   1.181 +          echo "4. Now you are able to subscribe to user \"example\"'s \"home\""
   1.182 +          echo "   calendar with a CalDAV client through the URL"
   1.183 +%if "%{with_ssl}" == "yes"
   1.184 +          echo "     https://127.0.0.1:8443/caldav/example/home"
   1.185 +%else
   1.186 +          echo "     http://127.0.0.1:8080/caldav/example/home"
   1.187 +%endif
   1.188 +        ) | %{l_rpmtool} msg -b -t notice
   1.189 +    fi
   1.190 +    if [ $1 -eq 2 ]; then
   1.191 +        #   after upgrade, restart service
   1.192 +        eval `%{l_rc} davical status 2>/dev/null`
   1.193 +        [ ".$davical_active" = .yes ] && %{l_rc} davical restart
   1.194 +    fi
   1.195 +    exit 0
   1.196 +
   1.197 +%preun
   1.198 +    if [ $1 -eq 0 ]; then
   1.199 +        #   before erase, stop service and remove log files
   1.200 +        %{l_rc} davical stop 2>/dev/null
   1.201 +        $RPM_INSTALL_PREFIX/sbin/davical-setup uninstall >/dev/null 2>&1 || true
   1.202 +        rm -f $RPM_INSTALL_PREFIX/var/davical/log/*   >/dev/null 2>&1 || true
   1.203 +        rm -f $RPM_INSTALL_PREFIX/var/davical/run/*   >/dev/null 2>&1 || true
   1.204 +        rm -f $RPM_INSTALL_PREFIX/var/davical/db/*    >/dev/null 2>&1 || true
   1.205 +    fi
   1.206 +    exit 0
   1.207 +

mercurial