kolab.spec 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. ##
  2. ## kolab.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package version
  25. %define V_ei_maj 1.0
  26. %define V_ei 1.0.25
  27. %define V_cf 1.0.4
  28. # package information
  29. Name: kolab
  30. Summary: Kolab Groupware Server
  31. URL: http://kolab.kde.org/
  32. Vendor: Erfrakon, Intevation, Code Fusion
  33. Packager: OpenPKG Foundation e.V.
  34. Distribution: OpenPKG Community
  35. Class: EVAL
  36. Group: Mail
  37. License: GPL
  38. Version: 20041215
  39. Release: 20070622
  40. # package options
  41. %option with_genuine no
  42. # list of sources
  43. Source0: http://www.erfrakon.de/projects/kolab/download/kolab-server-%{V_ei_maj}/src/kolab-%{V_ei_maj}-%{V_ei}.src.rpm
  44. Source1: ftp://ftp.zfos.org/brew/kolab/DST/cfkolab-%{V_cf}.tar.bz2
  45. Source2: rc.kolab
  46. # build information
  47. Prefix: %{l_prefix}
  48. BuildRoot: %{l_buildroot}
  49. BuildPreReq: OpenPKG, openpkg >= 20060823
  50. PreReq: OpenPKG, openpkg >= 20060823, openldap >= 2.2.5-20040419, postfix, imapd, sasl, apache, proftpd, perl, perl-ldap
  51. PreReq: sasl >= 2.1.15-20031122, sasl::with_ldap = yes, sasl::with_login = yes
  52. PreReq: proftpd >= 1.2.9-20031031, proftpd::with_ldap = yes
  53. PreReq: gdbm >= 1.8.3-20030213, gdbm::with_ndbm = yes
  54. PreReq: postfix >= 2.0.16-20031028, postfix::with_ldap = yes, postfix::with_sasl = yes, postfix::with_ssl = yes
  55. PreReq: imapd >= 2.2.3-20040202, imapd::with_group = yes
  56. PreReq: apache >= 1.3.29-20031124, apache::with_mod_ldap = yes, apache::with_mod_dav = yes, apache-php, apache-php::with_gdbm = yes, apache-php::with_gettext = yes, apache-php::with_imap = yes, apache-php::with_openldap = yes, apache-php::with_xml = yes, apache::with_mod_ssl = yes
  57. %if "%{with_genuine}" == "no"
  58. PreReq: perl-kolab, perl-db
  59. %endif
  60. AutoReq: no
  61. AutoReqProv: no
  62. %description
  63. The Kolab Server is a Free Software groupware server
  64. that provides groupware features to either KDE Kolab clients
  65. or Microsoft Outlook[tm] clients running on Windows[tm]
  66. by use of a proprietary plug-ins. In addition it is a robust
  67. and flexible general IMAP mail server with LDAP addressbooks.
  68. Kolab %{V_ei_maj}, genuine Engine and Admin Interface %{V_ei}
  69. The Code Fusion fork adds functionality such as integration with
  70. Active Directory, a more modularised backend, separation of the
  71. daemon and the configuration generator and more.
  72. Code Fusion Engine %{V_cf}, shares Admin Interface (see above)
  73. %track
  74. prog kolab-ei = {
  75. version = %{V_ei_maj}-%{V_ei}
  76. url = http://www.erfrakon.de/projects/kolab/download/kolab-server-%{V_ei_maj}/src/
  77. regex = kolab-(%{V_ei_maj}-\d+\.\d+\.\d{1,7})\.src\.rpm
  78. }
  79. prog kolab-cf = {
  80. version = %{V_cf}
  81. url = ftp://ftp.zfos.org/brew/kolab/DST/
  82. regex = cfkolab-(__VER__)\.tar\.bz2
  83. }
  84. %prep
  85. %setup -q -c -T
  86. %{l_bzip2} -c -d %{SOURCE1} | %{l_tar} xf -
  87. %{l_rpm2cpio} <%{SOURCE0} | cpio -iv kolab-%{V_ei_maj}.tar.gz
  88. %if "%{with_genuine}" == "no"
  89. %{l_gzip} -c -d kolab-%{V_ei_maj}.tar.gz | %{l_tar} xf - admin/
  90. mv cfkolab-%{V_cf}/* .
  91. %{l_shtool} subst \
  92. -e "s;^\(# kolab_bootstrap Version .*\);\1, openpkg=kolab-%{version}-%{release}, kolab=%{V_ei_maj}, admin=%{V_ei}, cf-engine=%{V_cf};" \
  93. kolab_bootstrap
  94. %{l_shtool} subst \
  95. -e "s;\(>Version \).[^<]*<;\1%{V_ei_maj}-%{V_ei}-cf%{V_cf}<;" \
  96. admin/kolab/index.php
  97. %else
  98. %{l_gzip} -c -d kolab-%{V_ei_maj}.tar.gz | %{l_tar} xf -
  99. %{l_shtool} subst \
  100. -e "s;^\(# kolab_bootstrap Version .*\);\1, openpkg=kolab-%{version}-%{release}, kolab=%{V_ei_maj}, admin=%{V_ei} using ei-engine;" \
  101. kolab_bootstrap
  102. %{l_shtool} subst \
  103. -e "s;\(>Version \).[^<]*<;\1%{V_ei_maj}-%{V_ei}-ei<;" \
  104. admin/kolab/index.php
  105. awk <slapd.conf.template \
  106. '// { if ($1 == "pidfile") { print $0"\nreplica-pidfile @@@kolab_prefix@@@/var/openldap/run/slurpd.pid" } else print }' \
  107. >slapd.conf.template.NEW && mv slapd.conf.template.NEW slapd.conf.template
  108. %{l_shtool} subst \
  109. -e 's;@@@kolab_prefix@@@;@l_prefix@;g' \
  110. -e 's;@@@l_\([mnrs]\)usr@@@;@l_\1usr@;g' \
  111. -e 's;@@@l_\([mnrs]\)grp@@@;@l_\1grp@;g' \
  112. -e 's;@@@l_\([mnrs]\)uid@@@;@l_\1uid@;g' \
  113. -e 's;@@@l_\([mnrs]\)gid@@@;@l_\1gid@;g' \
  114. kolab_sslcert.sh kolab kolab_bootstrap *.template
  115. %{l_shtool} subst \
  116. -e 's;hostname -f;hostname;' \
  117. kolab kolab_bootstrap
  118. %{l_shtool} subst \
  119. -e 's;chown root.root;chown @l_susr@:@l_sgrp@;' \
  120. kolab
  121. %{l_shtool} subst \
  122. -e 's;libexec/slapd;libexec/openldap/slapd;' \
  123. -e 's;etc/rc.d/rc.kolab start;etc/rc all start;' \
  124. -e 's:print " running:my $cfg; open(FH, "<@l_prefix@/etc/rc.conf") || die; $cfg .= $_ while (<FH>); close(FH); $cfg =~ s/\\n((openldap_url|sasl_authmech)\\S*=[^\\n]*)/#\\1\\n/sg; $cfg .= "openldap_url=\\"\\"\\nsasl_authmech=\\"ldap\\"\\n"; open(FH, ">@l_prefix@/etc/rc.conf") || die; print FH $cfg; close(FH); undef $cfg; print " running:' \
  125. -e 's;killall -INT slapd >/dev/null 2>&1;$kolab_prefix/etc/openpkg rc openldap stop;' \
  126. -e 's;\(system("killall -9 slapd >/dev/null 2>&1")\);#\1;' \
  127. kolab_bootstrap
  128. %endif
  129. %{l_shtool} subst \
  130. -e 's;var/openldap/\(sl[aur]*pd.pid\);var/openldap/run/\1;' \
  131. -e 's;^lastmod.*on$;;' \
  132. slapd.conf.template
  133. %{l_shtool} subst \
  134. -e 's;openssl passwd kolab;openssl rand -base64 12;' \
  135. -e 's;openssl passwd nobody;openssl rand -base64 30;' \
  136. kolab_bootstrap
  137. %build
  138. %install
  139. rm -rf $RPM_BUILD_ROOT
  140. %{l_shtool} mkdir -p -m 755 \
  141. $RPM_BUILD_ROOT%{l_prefix}/etc/kolab \
  142. $RPM_BUILD_ROOT%{l_prefix}/var/kolab/log \
  143. $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/cgi-bin \
  144. $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/icons
  145. %{l_shtool} mkdir -p -m 777 \
  146. $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/admin \
  147. $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/freebusy \
  148. $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/locks
  149. %{l_shtool} install -c -m 744 %{l_value -s -a} \
  150. kolab_sslcert.sh kolab kolab_bootstrap workaround.sh \
  151. $RPM_BUILD_ROOT%{l_prefix}/etc/kolab/
  152. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  153. kolab.conf *.template \
  154. $RPM_BUILD_ROOT%{l_prefix}/etc/kolab/
  155. %if "%{with_genuine}" == "no"
  156. %{l_shtool} mkdir -p -m 755 \
  157. $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/schema \
  158. $RPM_BUILD_ROOT%{l_prefix}/sbin
  159. %{l_shtool} install -c -m 744 %{l_value -s -a} \
  160. kolabd kolabconf \
  161. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  162. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  163. kolab.globals \
  164. $RPM_BUILD_ROOT%{l_prefix}/etc/kolab/
  165. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  166. kolab.schema kolab-cf.schema \
  167. $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/schema/
  168. %else
  169. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  170. kolab.schema \
  171. $RPM_BUILD_ROOT%{l_prefix}/etc/kolab/
  172. %endif
  173. cp -r admin/* $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/admin/
  174. # install run-command script
  175. %{l_shtool} mkdir -f -p -m 755 \
  176. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  177. %if "%{with_genuine}" == "no"
  178. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  179. -e 's;@kolab_daemon@;/sbin/kolabd;' \
  180. %{SOURCE rc.kolab} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  181. %else
  182. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  183. -e 's;@kolab_daemon@;/etc/kolab/kolab;' \
  184. %{SOURCE rc.kolab} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  185. %endif
  186. # generate file list
  187. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  188. '%config %{l_prefix}/etc/kolab/*.pem' \
  189. '%config %{l_prefix}/etc/kolab/*.schema' \
  190. '%config %{l_prefix}/etc/kolab/kolab.conf'
  191. %files -f files
  192. %clean
  193. rm -rf $RPM_BUILD_ROOT
  194. %post
  195. echo "please run '$RPM_INSTALL_PREFIX/etc/kolab/kolab_bootstrap -b'"