|
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 ## |
|
23 |
|
24 # package version |
|
25 %define V_opkg 0.9.9.3 |
|
26 %define V_davical 0.9.9.3 |
|
27 %define V_awl 0.37 |
|
28 |
|
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: 20100926 |
|
41 |
|
42 # package options |
|
43 %define with_ssl no |
|
44 |
|
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 |
|
53 |
|
54 # build information |
|
55 BuildPreReq: OpenPKG, openpkg >= 20100101 |
|
56 PreReq: OpenPKG, openpkg >= 20100101 |
|
57 PreReq: pcre, pcre::with_utf8 |
|
58 PreReq: apache |
|
59 %if "%{with_ssl}" == "yes" |
|
60 PreReq: apache::with_mod_ssl = yes, x509 |
|
61 %endif |
|
62 PreReq: apache-php |
|
63 PreReq: apache-php::with_pgsql = yes |
|
64 PreReq: apache-php::with_gettext = yes |
|
65 PreReq: postgresql |
|
66 |
|
67 %description |
|
68 The DAViCal CalDAV Server is a repository for calendar, schedule, |
|
69 todo and journal entries which may be accessed with CalDAV capable |
|
70 client software. |
|
71 |
|
72 %track |
|
73 prog davical:davical = { |
|
74 version = %{V_davical} |
|
75 url = http://debian.mcmillan.net.nz/packages/davical/ |
|
76 regex = davical-(__VER__)\.tar\.gz |
|
77 } |
|
78 prog davical:awl = { |
|
79 version = %{V_awl} |
|
80 url = http://debian.mcmillan.net.nz/packages/awl/ |
|
81 regex = awl_(__VER__)\.tar\.gz |
|
82 } |
|
83 |
|
84 %prep |
|
85 %setup -q -c |
|
86 %setup -q -T -D -a 1 |
|
87 %patch -p0 |
|
88 |
|
89 %build |
|
90 |
|
91 %install |
|
92 # create installation hierarchy |
|
93 %{l_shtool} mkdir -f -p -m 755 \ |
|
94 $RPM_BUILD_ROOT%{l_prefix}/sbin \ |
|
95 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
|
96 $RPM_BUILD_ROOT%{l_prefix}/etc/davical \ |
|
97 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical \ |
|
98 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl \ |
|
99 $RPM_BUILD_ROOT%{l_prefix}/var/davical/db \ |
|
100 $RPM_BUILD_ROOT%{l_prefix}/var/davical/run \ |
|
101 $RPM_BUILD_ROOT%{l_prefix}/var/davical/log |
|
102 |
|
103 # install program components |
|
104 find . -name "*.orig" -print | xargs rm -f |
|
105 cp -r \ |
|
106 awl-%{V_awl}/dba \ |
|
107 awl-%{V_awl}/inc \ |
|
108 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/ |
|
109 rm -f davical-%{V_davical}/inc/always.php.in |
|
110 %{l_shtool} subst %{l_value -s -a} \ |
|
111 davical-%{V_davical}/inc/always.php |
|
112 cp -r \ |
|
113 davical-%{V_davical}/dba \ |
|
114 davical-%{V_davical}/inc \ |
|
115 davical-%{V_davical}/htdocs \ |
|
116 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/ |
|
117 |
|
118 # install DAViCal application configuration file |
|
119 %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
120 %{SOURCE davical-config.php} \ |
|
121 $RPM_BUILD_ROOT%{l_prefix}/etc/davical/ |
|
122 |
|
123 # install DAViCal Apache configuration file |
|
124 %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
125 %{SOURCE davical-apache.conf} \ |
|
126 $RPM_BUILD_ROOT%{l_prefix}/etc/davical/ |
|
127 |
|
128 # install run-command script |
|
129 %if "%{with_ssl}" == "yes" |
|
130 with_ssl="-DSSL" |
|
131 %else |
|
132 with_ssl="" |
|
133 %endif |
|
134 %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
135 -e "s;@with_ssl@;$with_ssl;" \ |
|
136 %{SOURCE rc.davical} \ |
|
137 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
138 |
|
139 # install RDBMS setup script |
|
140 %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
141 %{SOURCE davical-setup.sh} \ |
|
142 $RPM_BUILD_ROOT%{l_prefix}/sbin/davical-setup |
|
143 |
|
144 # determine installation files |
|
145 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
146 %{l_files_std} \ |
|
147 '%config %{l_prefix}/etc/davical/*' \ |
|
148 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical' \ |
|
149 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical/*' |
|
150 |
|
151 %files -f files |
|
152 |
|
153 %clean |
|
154 |
|
155 %post |
|
156 if [ $1 -eq 1 ]; then |
|
157 # display final hints on initial installation |
|
158 ( echo "1. To complete this installation of Drupal please start PostgreSQL" |
|
159 echo " and initialize the DAViCal database like this:" |
|
160 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start" |
|
161 echo " \$ $RPM_INSTALL_PREFIX/sbin/davical-setup install" |
|
162 echo "" |
|
163 echo "2. By default, DAViCal runs its own SSL/TLS based Apache server" |
|
164 echo " under 127.0.0.1, TCP port 8443. Please change this by editing" |
|
165 echo " the \"Listen 127.0.0.1:8443\" directive in:" |
|
166 echo " $RPM_INSTALL_PREFIX/etc/davical/davical-apache.conf" |
|
167 echo "" |
|
168 echo "3. Now start DAViCal by running the command" |
|
169 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc davical start" |
|
170 echo " and connect with a browser to the URL" |
|
171 %if "%{with_ssl}" == "yes" |
|
172 echo " https://127.0.0.1:8443/" |
|
173 %else |
|
174 echo " https://127.0.0.1:8080/" |
|
175 %endif |
|
176 echo " and create user accounts." |
|
177 echo "" |
|
178 echo "4. Now you are able to subscribe to user \"example\"'s \"home\"" |
|
179 echo " calendar with a CalDAV client through the URL" |
|
180 %if "%{with_ssl}" == "yes" |
|
181 echo " https://127.0.0.1:8443/caldav/example/home" |
|
182 %else |
|
183 echo " http://127.0.0.1:8080/caldav/example/home" |
|
184 %endif |
|
185 ) | %{l_rpmtool} msg -b -t notice |
|
186 fi |
|
187 if [ $1 -eq 2 ]; then |
|
188 # after upgrade, restart service |
|
189 eval `%{l_rc} davical status 2>/dev/null` |
|
190 [ ".$davical_active" = .yes ] && %{l_rc} davical restart |
|
191 fi |
|
192 exit 0 |
|
193 |
|
194 %preun |
|
195 if [ $1 -eq 0 ]; then |
|
196 # before erase, stop service and remove log files |
|
197 %{l_rc} davical stop 2>/dev/null |
|
198 $RPM_INSTALL_PREFIX/sbin/davical-setup uninstall >/dev/null 2>&1 || true |
|
199 rm -f $RPM_INSTALL_PREFIX/var/davical/log/* >/dev/null 2>&1 || true |
|
200 rm -f $RPM_INSTALL_PREFIX/var/davical/run/* >/dev/null 2>&1 || true |
|
201 rm -f $RPM_INSTALL_PREFIX/var/davical/db/* >/dev/null 2>&1 || true |
|
202 fi |
|
203 exit 0 |
|
204 |