modsurvey.spec 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ##
  2. ## modsurvey.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: modsurvey
  26. Summary: Website Survey Framework
  27. URL: http://www.modsurvey.org/
  28. Vendor: Joel Palmius
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: EVAL
  32. Group: Web
  33. License: GPL
  34. Version: 3.2.4
  35. Release: 20070622
  36. # list of sources
  37. Source0: http://www.modsurvey.org/download/tarballs/modsurvey-%{version}.tgz
  38. Source1: http://www.modsurvey.org/download/tarballs/modsurvey-docs-%{version}.tgz
  39. Patch0: modsurvey.patch
  40. # build information
  41. Prefix: %{l_prefix}
  42. BuildRoot: %{l_buildroot}
  43. BuildPreReq: OpenPKG, openpkg >= 20040130
  44. PreReq: OpenPKG, openpkg >= 20040130
  45. BuildPreReq: perl, perl-www
  46. PreReq: perl, perl-www
  47. PreReq: apache, apache-perl
  48. AutoReq: no
  49. AutoReqProv: no
  50. %description
  51. mod_survey is a website survey framework for Apache. It is used
  52. as a mod_perl content-handler for "survey" files which contain
  53. questionnaires describe the survey in an XML-based tag notation.
  54. %track
  55. prog modsurvey = {
  56. version = %{version}
  57. url = http://www.modsurvey.org/download.php
  58. regex = modsurvey-(__VER__)\.tgz
  59. }
  60. %prep
  61. %setup -q -c
  62. %setup -q -D -T -a 1
  63. %patch -p0
  64. %build
  65. %install
  66. # create installation hierarchy
  67. rm -rf $RPM_BUILD_ROOT
  68. %{l_shtool} mkdir -f -p -m 755 \
  69. $RPM_BUILD_ROOT%{l_prefix}/etc/modsurvey \
  70. $RPM_BUILD_ROOT%{l_prefix}/lib/modsurvey \
  71. $RPM_BUILD_ROOT%{l_prefix}/share/modsurvey \
  72. $RPM_BUILD_ROOT%{l_prefix}/var/modsurvey
  73. # perform standard installation procedure
  74. %{l_shtool} install -c %{l_value -s -a} \
  75. mod_survey/installer.pl mod_survey/installer
  76. ( cd mod_survey
  77. %{l_prefix}/bin/perl installer </dev/null
  78. ) || exit $?
  79. # post-adust installation paths
  80. mv $RPM_BUILD_ROOT%{l_prefix}/lib/modsurvey/survey.conf \
  81. $RPM_BUILD_ROOT%{l_prefix}/etc/modsurvey/survey.conf
  82. mv $RPM_BUILD_ROOT%{l_prefix}/lib/modsurvey/data \
  83. $RPM_BUILD_ROOT%{l_prefix}/var/modsurvey/data
  84. mv $RPM_BUILD_ROOT%{l_prefix}/lib/modsurvey/webroot \
  85. $RPM_BUILD_ROOT%{l_prefix}/share/modsurvey/webroot
  86. # remove some installation files
  87. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/modsurvey/README.txt
  88. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/modsurvey/survey.conf.sample
  89. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/modsurvey/docs
  90. # determine installation files
  91. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  92. %{l_files_std} \
  93. '%config %{l_prefix}/etc/modsurvey/survey.conf' \
  94. '%doc %{l_prefix}/share/modsurvey/webroot/docs/*.pdf' \
  95. '%attr(700,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/modsurvey/data'
  96. %files -f files
  97. %clean
  98. rm -rf $RPM_BUILD_ROOT
  99. %post
  100. if [ $1 -eq 1 ]; then
  101. # add hook to Apache configuration
  102. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  103. if [ -f $apacheconf ]; then
  104. ( echo "<IfModule mod_perl.c>"
  105. echo " Include $RPM_INSTALL_PREFIX/etc/modsurvey/survey.conf"
  106. echo "</IfModule>"
  107. ) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  108. -a -i "$RPM_INSTALL_PREFIX:modsurvey" $apacheconf
  109. fi
  110. # display final hints
  111. ( echo "Your next step should be to run Apache with..."
  112. echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc apache start"
  113. echo "...and then access the mod_survey examples under"
  114. echo " http://127.0.0.1/mod_survey/"
  115. ) | %{l_rpmtool} msg -b -t notice
  116. fi
  117. exit 0
  118. %preun
  119. if [ $1 -eq 0 ]; then
  120. # remove hook from Apache configuration
  121. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  122. if [ -f $apacheconf ]; then
  123. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  124. -r -i "$RPM_INSTALL_PREFIX:modsurvey" $apacheconf
  125. fi
  126. # before erase, stop service and remove log files
  127. rm -rf $RPM_INSTALL_PREFIX/var/sympa/data/* >/dev/null 2>&1 || true
  128. fi
  129. exit 0