phpbb.spec 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. ##
  2. ## phpbb.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 information
  25. Name: phpbb
  26. Summary: Web Bulletin Board System (BBS)
  27. URL: http://www.phpbb.com/
  28. Vendor: phpBB Group
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: EVAL
  32. Group: CMS
  33. License: GPL
  34. Version: 3.0.RC1
  35. Release: 20070622
  36. # list of sources
  37. Source0: http://switch.dl.sourceforge.net/phpbb/phpBB-%{version}.tar.bz2
  38. Source2: phpbb-apache.conf
  39. Source3: rc.phpbb
  40. Patch0: phpbb.patch
  41. # build information
  42. Prefix: %{l_prefix}
  43. BuildRoot: %{l_buildroot}
  44. BuildPreReq: OpenPKG, openpkg >= 20060823
  45. PreReq: OpenPKG, openpkg >= 20060823
  46. PreReq: apache
  47. PreReq: apache-php::with_gd = yes
  48. PreReq: apache-php::with_zlib = yes
  49. PreReq: apache-php::with_pcre = yes
  50. PreReq: apache-php::with_ftp = yes
  51. PreReq: apache-php::with_xml = yes
  52. PreReq: apache-php::with_sqlite = yes
  53. PreReq: pcre, pcre::with_utf8 = yes
  54. PreReq: sqlite
  55. PreReq: imagemagick
  56. AutoReq: no
  57. AutoReqProv: no
  58. %description
  59. phpBB is a high powered, fully scalable, and highly customizable
  60. Open Source Bulletin Board System (BBS). phpBB has a user-friendly
  61. interface, simple and straightforward administration panel, and
  62. helpful FAQ. Based on the powerful PHP server language and a backend
  63. RDBMS, phpBB is the ideal free community solution for all web sites.
  64. %track
  65. prog phpbb = {
  66. version = %{version}
  67. url = http://prdownloads.sourceforge.net/phpbb/
  68. regex = phpBB-(__VER__)\.tar\.(gz|bz2)
  69. }
  70. %prep
  71. %setup -q -n phpBB3
  72. %patch -p0
  73. %build
  74. %install
  75. # create installation hierarchy
  76. rm -rf $RPM_BUILD_ROOT
  77. %{l_shtool} mkdir -f -p -m 755 \
  78. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  79. $RPM_BUILD_ROOT%{l_prefix}/etc/phpbb \
  80. $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime \
  81. $RPM_BUILD_ROOT%{l_prefix}/var/phpbb/db \
  82. $RPM_BUILD_ROOT%{l_prefix}/var/phpbb/log \
  83. $RPM_BUILD_ROOT%{l_prefix}/var/phpbb/run
  84. # install main program files
  85. %{l_shtool} subst %{l_value -s -a} \
  86. install/install_install.php
  87. find . -name ".#*" -print | xargs rm -f
  88. cp -rp * $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/
  89. # post-adjustment: move risky install area out of runtime area
  90. # (will be dynmically linked in again later)
  91. mv $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/install \
  92. $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/install
  93. # post-adjustment: move writable areas out of runtime area
  94. mv $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/cache \
  95. $RPM_BUILD_ROOT%{l_prefix}/var/phpbb/db/cache
  96. ln -s ../../../var/phpbb/db/cache \
  97. $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/cache
  98. mv $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/files \
  99. $RPM_BUILD_ROOT%{l_prefix}/var/phpbb/db/files
  100. ln -s ../../../var/phpbb/db/files \
  101. $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/files
  102. mv $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/store \
  103. $RPM_BUILD_ROOT%{l_prefix}/var/phpbb/db/store
  104. ln -s ../../../var/phpbb/db/store \
  105. $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/store
  106. mv $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/images/avatars/upload \
  107. $RPM_BUILD_ROOT%{l_prefix}/var/phpbb/db/upload
  108. ln -s ../../../../../var/phpbb/db/store \
  109. $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/images/avatars/upload
  110. mv $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/config.php \
  111. $RPM_BUILD_ROOT%{l_prefix}/etc/phpbb/config.php
  112. ln -s ../../../etc/phpbb/config.php \
  113. $RPM_BUILD_ROOT%{l_prefix}/lib/phpbb/runtime/config.php
  114. # install run-command script
  115. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  116. -e 's;@l_path@;%{l_build_path};' \
  117. %{SOURCE rc.phpbb} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  118. # install Apache configuration
  119. l_hostname=`%{l_shtool} echo -e %h`
  120. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  121. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  122. -e "s;@l_hostname@;$l_hostname;g" \
  123. -e "s;@l_domainname@;$l_domainname;g" \
  124. %{SOURCE phpbb-apache.conf} \
  125. $RPM_BUILD_ROOT%{l_prefix}/etc/phpbb/
  126. # determine installation files
  127. mv files files.orig
  128. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  129. %{l_files_std} \
  130. '%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/phpbb/*' \
  131. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/phpbb' \
  132. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/phpbb/*' \
  133. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/phpbb/*/*' \
  134. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/phpbb/*/*/*' \
  135. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/phpbb' \
  136. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/phpbb/*'
  137. %files -f files
  138. %clean
  139. rm -rf $RPM_BUILD_ROOT
  140. %post
  141. if [ $1 -eq 1 ]; then
  142. # display final hints on initial installation
  143. ln -s ../install $RPM_INSTALL_PREFIX/lib/phpbb/runtime/install
  144. ( echo "To complete the phpBB installation:"
  145. echo "1. start the phpBB Apache:"
  146. echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc phpbb start"
  147. echo "2. install the phpBB database by accessing the"
  148. echo " following URL and proceeding through its menus:"
  149. echo " http://localhost:8080/phpbb/install/"
  150. echo "3. cleanup after installation to enable run-time:"
  151. echo " \$ rm -f $RPM_INSTALL_PREFIX/lib/phpbb/runtime/install"
  152. ) | %{l_rpmtool} msg -b -t notice
  153. elif [ $1 -eq 2 ]; then
  154. # after upgrade, restart service
  155. [ $1 -eq 2 ] || exit 0
  156. eval `%{l_rc} phpbb status 2>/dev/null`
  157. [ ".$phpbb_active" = .yes ] && %{l_rc} phpbb restart
  158. fi
  159. exit 0
  160. %preun
  161. if [ $1 -eq 0 ]; then
  162. # before erase, stop service
  163. %{l_rc} phpbb stop 2>/dev/null
  164. # remove run-time files
  165. rm -f $RPM_INSTALL_PREFIX/var/phpbb/db/* >/dev/null 2>&1 || true
  166. rm -f $RPM_INSTALL_PREFIX/var/phpbb/db/*/* >/dev/null 2>&1 || true
  167. rm -f $RPM_INSTALL_PREFIX/var/phpbb/run/* >/dev/null 2>&1 || true
  168. rm -f $RPM_INSTALL_PREFIX/var/phpbb/log/* >/dev/null 2>&1 || true
  169. fi
  170. exit 0