twiki.spec 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. ##
  2. ## twiki.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: twiki
  27. Summary: Wiki Wiki based Collaboration Platform
  28. URL: http://twiki.org/
  29. Vendor: Peter Thoeny
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: EVAL
  33. Group: Web
  34. License: GPL
  35. Version: 20041030
  36. Release: 20041107
  37. # list of sources
  38. Source0: http://TWikiGuest:guest@twiki.org/release/TWiki%{version}beta.zip
  39. Source1: twiki-apache.conf
  40. Source2: rc.twiki
  41. # build information
  42. Prefix: %{l_prefix}
  43. BuildRoot: %{l_buildroot}
  44. BuildPreReq: OpenPKG, openpkg >= 20040130, infozip, perl
  45. PreReq: OpenPKG, openpkg >= 20040130
  46. PreReq: perl, perl-net, perl-mail, perl-crypto
  47. PreReq: rcs, diffutils, grep
  48. PreReq: apache, MTA
  49. AutoReq: no
  50. AutoReqProv: no
  51. %description
  52. TWiki s a flexible, powerful, and easy to use Web-based
  53. collaboration platform based on the popular Wiki Wiki principle.
  54. %track
  55. prog twiki = {
  56. version = %{version}
  57. url = http://TWikiGuest:guest@twiki.org/cgi-bin/view/Codev/TWikiBetaRelease
  58. regex = TWiki(__VER__)beta\.zip
  59. }
  60. %prep
  61. %setup -q -c -T
  62. %{l_prefix}/bin/unzip -x -q %{SOURCE0}
  63. %build
  64. %install
  65. # create installation area
  66. rm -rf $RPM_BUILD_ROOT
  67. %{l_shtool} mkdir -f -p -m 755 \
  68. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  69. $RPM_BUILD_ROOT%{l_prefix}/etc/twiki \
  70. $RPM_BUILD_ROOT%{l_prefix}/lib/twiki \
  71. $RPM_BUILD_ROOT%{l_prefix}/libexec/twiki \
  72. $RPM_BUILD_ROOT%{l_prefix}/var/twiki
  73. # install TWiki CGIs
  74. # (set path to custom Perl and library path)
  75. %{l_shtool} install -c -m 755 \
  76. -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
  77. -e "s;'../lib';'%{l_prefix}/lib/twiki';g" \
  78. bin/* $RPM_BUILD_ROOT%{l_prefix}/libexec/twiki/
  79. # install TWiki library and configuration
  80. # (move primary configuration file to canonical location and pre-configure)
  81. %{l_shtool} install -c -m 644 \
  82. -e 's;http://your.domain.com;http://localhost;g' \
  83. -e 's;/home/httpd/twiki/pub;%{l_prefix}/var/twiki/pub;g' \
  84. -e 's;/home/httpd/twiki/templates;%{l_prefix}/etc/twiki/tmpl;g' \
  85. -e 's;/home/httpd/twiki/data;%{l_prefix}/var/twiki/data;g' \
  86. -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \
  87. -e "s;'/usr/bin';'%{l_prefix}/bin';g" \
  88. -e 's;/bin/egrep;%{l_prefix}/bin/egrep;g' \
  89. -e 's;/bin/fgrep;%{l_prefix}/bin/fgrep;g' \
  90. lib/TWiki.cfg \
  91. $RPM_BUILD_ROOT%{l_prefix}/etc/twiki/twiki.conf
  92. rm -f lib/TWiki.cfg
  93. ( cd lib && %{l_tar} cf - . ) | \
  94. ( cd $RPM_BUILD_ROOT%{l_prefix}/lib/twiki && %{l_tar} xf - ) || exit $?
  95. ln $RPM_BUILD_ROOT%{l_prefix}/etc/twiki/twiki.conf \
  96. $RPM_BUILD_ROOT%{l_prefix}/lib/twiki/TWiki.cfg
  97. # install TWiki initial data
  98. # (adjust RCS content for Apache run-time environment)
  99. %{l_prefix}/bin/perl \
  100. -pi.orig -e 'NR <= 10 && s/nobody:/%{l_nusr}:/' \
  101. data/*/*,v
  102. find data -type f -name "*.orig" -print | xargs rm -f
  103. find data -type f -print | xargs chmod 664
  104. find data -type d -print | xargs chmod 775
  105. %{l_tar} cf - data | \
  106. ( cd $RPM_BUILD_ROOT%{l_prefix}/var/twiki && %{l_tar} xf - ) || exit $?
  107. # install TWiki public files
  108. find pub -type f -print | xargs chmod 664
  109. find pub -type d -print | xargs chmod 775
  110. %{l_tar} cf - pub | \
  111. ( cd $RPM_BUILD_ROOT%{l_prefix}/var/twiki && %{l_tar} xf - ) || exit $?
  112. # install TWiki template files
  113. mv templates tmpl
  114. find tmpl -type f -print | xargs chmod 664
  115. find tmpl -type d -print | xargs chmod 775
  116. %{l_tar} cf - tmpl | \
  117. ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/twiki && %{l_tar} xf - ) || exit $?
  118. # install Apache configuration
  119. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  120. %{SOURCE twiki-apache.conf} \
  121. $RPM_BUILD_ROOT%{l_prefix}/etc/twiki/
  122. # install run-command script
  123. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  124. %{SOURCE rc.twiki} \
  125. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  126. # determine installation files
  127. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  128. %{l_files_std} \
  129. '%config %{l_prefix}/etc/twiki/twiki*' \
  130. '%config %{l_prefix}/etc/twiki/templates/*' \
  131. '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/twiki'
  132. %files -f files
  133. %clean
  134. rm -rf $RPM_BUILD_ROOT
  135. %post
  136. if [ ".$1" = .1 ]; then
  137. # add hook to Apache configuration
  138. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  139. if [ -f $apacheconf ]; then
  140. ( echo "Include $RPM_INSTALL_PREFIX/etc/twiki/twiki-apache.conf"
  141. ) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  142. -a -i "$RPM_INSTALL_PREFIX:twiki" $apacheconf
  143. fi
  144. # display information about steps the admin should perform next
  145. ( echo "TWiki was successfully installed. You should now start Apache with"
  146. echo " \$ $RPM_INSTALL_PREFIX/etc/rc apache start"
  147. echo "and then edit the TWiki site-level preferences under:"
  148. echo " http://localhost/twiki/bin/view/TWiki/TWikiPreferences"
  149. ) | %{l_rpmtool} msg -b -t notice
  150. fi
  151. %postun
  152. if [ ".$1" = .0 ]; then
  153. # remove hook from Apache configuration
  154. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  155. if [ -f $apacheconf ]; then
  156. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  157. -r -i "$RPM_INSTALL_PREFIX:twiki" $apacheconf
  158. fi
  159. fi