punbb.spec 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. ##
  2. ## punbb.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. # package version
  24. %define V_opkg 1.3s20100511
  25. %define V_snapshot 20100511
  26. %define V_release 1.3.4
  27. # package information
  28. Name: punbb
  29. Summary: Web Discussion Board
  30. URL: http://www.punbb.org/
  31. Vendor: Rickard Andersson et al.
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: EVAL
  35. Group: CMS
  36. License: GPL
  37. Version: %{V_opkg}
  38. Release: 20100511
  39. # list of sources
  40. Source0: http://download.openpkg.org/components/versioned/punbb/punbb-%{V_snapshot}.tar.gz
  41. Source1: punbb-apache.conf
  42. Source2: punbb-setup.sh
  43. Source3: rc.punbb
  44. Patch0: punbb.patch
  45. # build information
  46. BuildPreReq: OpenPKG, openpkg >= 20100101
  47. PreReq: OpenPKG, openpkg >= 20100101
  48. PreReq: apache
  49. PreReq: apache-php
  50. PreReq: apache-php::with_pgsql = yes
  51. PreReq: apache-php::with_zlib = yes
  52. PreReq: apache-php::with_xml = yes
  53. PreReq: apache-php::with_tokenizer = yes
  54. PreReq: apache-php::with_ctype = yes
  55. PreReq: apache-php::with_curl = yes
  56. PreReq: pcre
  57. PreReq: pcre::with_utf8 = yes
  58. PreReq: postgresql >= 8.2.4-20070906
  59. %description
  60. PunBB is a fast and lightweight PHP-powered discussion board.
  61. Its primary goals are to be faster, smaller and less graphically
  62. intensive as compared to other discussion boards. PunBB has fewer
  63. features than many other discussion boards, but is generally faster
  64. and outputs smaller, semantically correct XHTML-compliant pages.
  65. %track
  66. prog punbb:release = {
  67. version = %{V_release}
  68. url = http://punbb.informer.com/downloads.php
  69. regex = punbb-(__VER__)\.tar\.gz
  70. }
  71. prog punbb:snapshot = {
  72. version = %{V_snapshot}
  73. url = http://download.openpkg.org/components/versioned/punbb/
  74. regex = punbb-(__VER__)\.tar\.gz
  75. }
  76. %prep
  77. %setup -q -n punbb
  78. %patch -p0
  79. %build
  80. %install
  81. # create installation hierarchy
  82. rm -rf $RPM_BUILD_ROOT
  83. %{l_shtool} mkdir -f -p -m 755 \
  84. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  85. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  86. $RPM_BUILD_ROOT%{l_prefix}/etc/punbb \
  87. $RPM_BUILD_ROOT%{l_prefix}/lib/punbb/runtime \
  88. $RPM_BUILD_ROOT%{l_prefix}/var/punbb/db \
  89. $RPM_BUILD_ROOT%{l_prefix}/var/punbb/log \
  90. $RPM_BUILD_ROOT%{l_prefix}/var/punbb/run
  91. # install main program files
  92. find . -name ".svn" -type d -print | xargs rm -rf
  93. find . -name "*.orig" -type f -print | xargs rm -f
  94. cp -rp * $RPM_BUILD_ROOT%{l_prefix}/lib/punbb/
  95. cp -p .htaccess.dist $RPM_BUILD_ROOT%{l_prefix}/lib/punbb/.htaccess
  96. # install setup script
  97. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  98. %{SOURCE punbb-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/punbb-setup
  99. # install run-command script
  100. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  101. -e 's;@l_path@;%{l_build_path};' \
  102. %{SOURCE rc.punbb} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  103. # install Apache configuration
  104. l_hostname=`%{l_shtool} echo -e %h`
  105. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  106. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  107. -e "s;@l_hostname@;$l_hostname;g" \
  108. -e "s;@l_domainname@;$l_domainname;g" \
  109. %{SOURCE punbb-apache.conf} \
  110. $RPM_BUILD_ROOT%{l_prefix}/etc/punbb/
  111. # determine installation files
  112. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  113. %{l_files_std} \
  114. '%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/punbb/*' \
  115. '%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/punbb/.htaccess' \
  116. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/punbb' \
  117. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/punbb/*' \
  118. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/punbb/*/*' \
  119. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/punbb/*/*/*' \
  120. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/punbb' \
  121. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/punbb/*' \
  122. '%dir %attr(0700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/punbb/db'
  123. %files -f files
  124. %clean
  125. %post
  126. if [ $1 -eq 1 ]; then
  127. # display final hints on initial installation
  128. ( echo "To complete the PunBB installation:"
  129. echo "1. start the PostgreSQL RDBMS:"
  130. echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
  131. echo "2. create the PunBB database:"
  132. echo " \$ $RPM_INSTALL_PREFIX/sbin/punbb-setup install"
  133. echo "3. start the PunBB Apache:"
  134. echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc punbb start"
  135. echo "4. install the PunBB database by accessing the"
  136. echo " following URL and proceeding through its menus:"
  137. echo " http://localhost:8080/punbb/admin/install.php"
  138. ) | %{l_rpmtool} msg -b -t notice
  139. elif [ $1 -eq 2 ]; then
  140. # after upgrade, restart service
  141. [ $1 -eq 2 ] || exit 0
  142. eval `%{l_rc} punbb status 2>/dev/null`
  143. [ ".$punbb_active" = .yes ] && %{l_rc} punbb restart
  144. fi
  145. exit 0
  146. %preun
  147. if [ $1 -eq 0 ]; then
  148. # before erase, stop service
  149. %{l_rc} punbb stop 2>/dev/null
  150. # destroy database
  151. $RPM_INSTALL_PREFIX/sbin/punbb-setup uninstall >/dev/null 2>&1 || true
  152. # remove run-time files
  153. rm -f $RPM_INSTALL_PREFIX/var/punbb/db/* >/dev/null 2>&1 || true
  154. rm -f $RPM_INSTALL_PREFIX/var/punbb/db/*/* >/dev/null 2>&1 || true
  155. rm -f $RPM_INSTALL_PREFIX/var/punbb/run/* >/dev/null 2>&1 || true
  156. rm -f $RPM_INSTALL_PREFIX/var/punbb/log/* >/dev/null 2>&1 || true
  157. # remove generated configuration file
  158. rm -f $RPM_INSTALL_PREFIX/lib/punbb/config.php >/dev/null 2>&1 || true
  159. fi
  160. exit 0