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