davical/davical.spec

Mon, 22 Nov 2010 13:09:10 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 22 Nov 2010 13:09:10 +0100
changeset 293
bab74314890a
parent 292
935d512fd6bd
child 297
41f699c33d5f
permissions
-rw-r--r--

The apg(1) command is used in the davical-setup.sh script.

michael@290 1 ##
michael@290 2 ## davical.spec -- OpenPKG RPM Package Specification
michael@290 3 ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@290 4 ##
michael@290 5 ## Permission to use, copy, modify, and distribute this software for
michael@290 6 ## any purpose with or without fee is hereby granted, provided that
michael@290 7 ## the above copyright notice and this permission notice appear in all
michael@290 8 ## copies.
michael@290 9 ##
michael@290 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@290 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@290 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@290 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@290 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@290 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@290 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@290 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@290 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@290 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@290 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@290 21 ## SUCH DAMAGE.
michael@290 22 ##
michael@290 23
michael@290 24 # package version
michael@290 25 %define V_opkg 0.9.9.3
michael@290 26 %define V_davical 0.9.9.3
michael@290 27 %define V_awl 0.37
michael@290 28
michael@290 29 # package information
michael@290 30 Name: davical
michael@290 31 Summary: CalDAV Server
michael@290 32 URL: http://rscds.sourceforge.net/
michael@290 33 Vendor: Andrew McMillan
michael@290 34 Packager: OpenPKG Foundation e.V.
michael@290 35 Distribution: OpenPKG Community
michael@290 36 Class: EVAL
michael@290 37 Group: Network
michael@290 38 License: GPL
michael@290 39 Version: %{V_opkg}
michael@291 40 Release: 20101120
michael@290 41
michael@290 42 # package options
michael@290 43 %define with_ssl no
michael@290 44
michael@290 45 # list of sources
michael@290 46 Source0: http://debian.mcmillan.net.nz/packages/davical/davical-%{V_davical}.tar.gz
michael@290 47 Source1: http://debian.mcmillan.net.nz/packages/awl/awl_%{V_awl}.tar.gz
michael@290 48 Source2: davical-config.php
michael@290 49 Source3: davical-apache.conf
michael@290 50 Source4: davical-setup.sh
michael@290 51 Source5: rc.davical
michael@290 52 Patch0: davical.patch
michael@290 53
michael@290 54 # build information
michael@291 55 Prefix: %{l_prefix}
michael@291 56 BuildRoot: %{l_buildroot}
michael@291 57 BuildPreReq: OpenPKG, openpkg >= 20060823
michael@291 58 PreReq: OpenPKG, openpkg >= 20060823
michael@290 59 PreReq: pcre, pcre::with_utf8
michael@290 60 PreReq: apache
michael@290 61 %if "%{with_ssl}" == "yes"
michael@290 62 PreReq: apache::with_mod_ssl = yes, x509
michael@290 63 %endif
michael@290 64 PreReq: apache-php
michael@290 65 PreReq: apache-php::with_pgsql = yes
michael@290 66 PreReq: apache-php::with_gettext = yes
michael@290 67 PreReq: postgresql
michael@293 68 PreReq: apg
michael@290 69
michael@290 70 %description
michael@290 71 The DAViCal CalDAV Server is a repository for calendar, schedule,
michael@290 72 todo and journal entries which may be accessed with CalDAV capable
michael@290 73 client software.
michael@290 74
michael@290 75 %track
michael@290 76 prog davical:davical = {
michael@290 77 version = %{V_davical}
michael@290 78 url = http://debian.mcmillan.net.nz/packages/davical/
michael@290 79 regex = davical-(__VER__)\.tar\.gz
michael@290 80 }
michael@290 81 prog davical:awl = {
michael@290 82 version = %{V_awl}
michael@290 83 url = http://debian.mcmillan.net.nz/packages/awl/
michael@290 84 regex = awl_(__VER__)\.tar\.gz
michael@290 85 }
michael@290 86
michael@290 87 %prep
michael@290 88 %setup -q -c
michael@290 89 %setup -q -T -D -a 1
michael@290 90 %patch -p0
michael@290 91
michael@290 92 %build
michael@290 93
michael@290 94 %install
michael@290 95 # create installation hierarchy
michael@290 96 %{l_shtool} mkdir -f -p -m 755 \
michael@290 97 $RPM_BUILD_ROOT%{l_prefix}/sbin \
michael@290 98 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
michael@290 99 $RPM_BUILD_ROOT%{l_prefix}/etc/davical \
michael@290 100 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical \
michael@290 101 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl \
michael@290 102 $RPM_BUILD_ROOT%{l_prefix}/var/davical/db \
michael@290 103 $RPM_BUILD_ROOT%{l_prefix}/var/davical/run \
michael@290 104 $RPM_BUILD_ROOT%{l_prefix}/var/davical/log
michael@290 105
michael@290 106 # install program components
michael@290 107 find . -name "*.orig" -print | xargs rm -f
michael@290 108 cp -r \
michael@290 109 awl-%{V_awl}/dba \
michael@290 110 awl-%{V_awl}/inc \
michael@290 111 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/
michael@290 112 rm -f davical-%{V_davical}/inc/always.php.in
michael@290 113 %{l_shtool} subst %{l_value -s -a} \
michael@290 114 davical-%{V_davical}/inc/always.php
michael@290 115 cp -r \
michael@290 116 davical-%{V_davical}/dba \
michael@290 117 davical-%{V_davical}/inc \
michael@290 118 davical-%{V_davical}/htdocs \
michael@290 119 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/
michael@290 120
michael@290 121 # install DAViCal application configuration file
michael@290 122 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@290 123 %{SOURCE davical-config.php} \
michael@290 124 $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
michael@290 125
michael@290 126 # install DAViCal Apache configuration file
michael@290 127 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@290 128 %{SOURCE davical-apache.conf} \
michael@290 129 $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
michael@290 130
michael@290 131 # install run-command script
michael@290 132 %if "%{with_ssl}" == "yes"
michael@290 133 with_ssl="-DSSL"
michael@290 134 %else
michael@290 135 with_ssl=""
michael@290 136 %endif
michael@290 137 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@290 138 -e "s;@with_ssl@;$with_ssl;" \
michael@290 139 %{SOURCE rc.davical} \
michael@290 140 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@290 141
michael@290 142 # install RDBMS setup script
michael@290 143 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@290 144 %{SOURCE davical-setup.sh} \
michael@290 145 $RPM_BUILD_ROOT%{l_prefix}/sbin/davical-setup
michael@290 146
michael@290 147 # determine installation files
michael@290 148 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@290 149 %{l_files_std} \
michael@290 150 '%config %{l_prefix}/etc/davical/*' \
michael@290 151 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical' \
michael@290 152 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical/*'
michael@290 153
michael@290 154 %files -f files
michael@290 155
michael@290 156 %clean
michael@291 157 rm -rf $RPM_BUILD_ROOT
michael@290 158
michael@290 159 %post
michael@290 160 if [ $1 -eq 1 ]; then
michael@290 161 # display final hints on initial installation
michael@292 162 ( echo "1. To complete this installation of DAViCal please start"
michael@292 163 echo " PostgreSQL and initialize the DAViCal database like this:"
michael@290 164 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
michael@290 165 echo " \$ $RPM_INSTALL_PREFIX/sbin/davical-setup install"
michael@290 166 echo ""
michael@290 167 echo "2. By default, DAViCal runs its own SSL/TLS based Apache server"
michael@290 168 echo " under 127.0.0.1, TCP port 8443. Please change this by editing"
michael@290 169 echo " the \"Listen 127.0.0.1:8443\" directive in:"
michael@290 170 echo " $RPM_INSTALL_PREFIX/etc/davical/davical-apache.conf"
michael@290 171 echo ""
michael@290 172 echo "3. Now start DAViCal by running the command"
michael@290 173 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc davical start"
michael@290 174 echo " and connect with a browser to the URL"
michael@290 175 %if "%{with_ssl}" == "yes"
michael@290 176 echo " https://127.0.0.1:8443/"
michael@290 177 %else
michael@290 178 echo " https://127.0.0.1:8080/"
michael@290 179 %endif
michael@290 180 echo " and create user accounts."
michael@290 181 echo ""
michael@290 182 echo "4. Now you are able to subscribe to user \"example\"'s \"home\""
michael@290 183 echo " calendar with a CalDAV client through the URL"
michael@290 184 %if "%{with_ssl}" == "yes"
michael@290 185 echo " https://127.0.0.1:8443/caldav/example/home"
michael@290 186 %else
michael@290 187 echo " http://127.0.0.1:8080/caldav/example/home"
michael@290 188 %endif
michael@290 189 ) | %{l_rpmtool} msg -b -t notice
michael@290 190 fi
michael@290 191 if [ $1 -eq 2 ]; then
michael@290 192 # after upgrade, restart service
michael@290 193 eval `%{l_rc} davical status 2>/dev/null`
michael@290 194 [ ".$davical_active" = .yes ] && %{l_rc} davical restart
michael@290 195 fi
michael@290 196 exit 0
michael@290 197
michael@290 198 %preun
michael@290 199 if [ $1 -eq 0 ]; then
michael@290 200 # before erase, stop service and remove log files
michael@290 201 %{l_rc} davical stop 2>/dev/null
michael@290 202 $RPM_INSTALL_PREFIX/sbin/davical-setup uninstall >/dev/null 2>&1 || true
michael@290 203 rm -f $RPM_INSTALL_PREFIX/var/davical/log/* >/dev/null 2>&1 || true
michael@290 204 rm -f $RPM_INSTALL_PREFIX/var/davical/run/* >/dev/null 2>&1 || true
michael@290 205 rm -f $RPM_INSTALL_PREFIX/var/davical/db/* >/dev/null 2>&1 || true
michael@290 206 fi
michael@290 207 exit 0
michael@290 208

mercurial