wordpress.spec 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. ##
  2. ## wordpress.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: wordpress
  26. Summary: Weblog Publishing System
  27. URL: http://www.wordpress.org/
  28. Vendor: R. Boren & M. Mullenweg et al.
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: PLUS
  32. Group: CMS
  33. License: GPL
  34. Version: 2.1
  35. Release: 20070213
  36. # list of sources
  37. Source0: ftp://ftp.openpkg.org/sources/CPY/VERSIONED/wordpress/wordpress-%{version}.tar.gz
  38. Source1: wordpress-apache.conf
  39. Source2: wordpress-setup.sh
  40. Source3: wordpress-cron.sh
  41. Source4: rc.wordpress
  42. Patch0: wordpress.patch
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20060823
  47. PreReq: OpenPKG, openpkg >= 20060823
  48. PreReq: apache, wget
  49. PreReq: apache::with_mod_php = yes
  50. PreReq: apache::with_mod_php_mysql = yes
  51. PreReq: apache::with_mod_php_pcre = yes
  52. PreReq: apache::with_mod_php_sendmail = yes
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. WordPress is a state-of-the-art semantic personal publishing
  57. platform (aka Weblog or BLOG) with a focus on aesthetics, web
  58. standards, and usability.
  59. %track
  60. prog wordpress = {
  61. version = %{version}
  62. url = ftp://ftp.openpkg.org/sources/CPY/VERSIONED/wordpress/
  63. regex = wordpress-(__VER__)\.tar\.gz
  64. }
  65. %prep
  66. %setup -q -n wordpress
  67. %patch -p0
  68. %build
  69. # create configuration file
  70. %{l_shtool} install -m 644 \
  71. -e 's;username;wordpress;' \
  72. -e 's;password;wordpress;' \
  73. wp-config-sample.php wp-config.php
  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}/sbin \
  79. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  80. $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress \
  81. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress \
  82. $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress \
  83. $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/run \
  84. $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/log \
  85. $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/tmp
  86. # install program files
  87. cp -rp * $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/
  88. # create additional uploads directory
  89. %{l_shtool} mkdir -f -p -m 755 \
  90. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/uploads
  91. # install run-command script
  92. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  93. %{SOURCE rc.wordpress} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  94. # install MySQL database setup script
  95. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  96. %{SOURCE wordpress-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/wordpress-setup
  97. # install cron-job script
  98. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  99. %{SOURCE wordpress-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/wordpress-cron
  100. # install custom Apache configuration
  101. l_hostname=`%{l_shtool} echo -e %h`
  102. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  103. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  104. -e "s;@l_hostname@;$l_hostname;g" \
  105. -e "s;@l_domainname@;$l_domainname;g" \
  106. %{SOURCE wordpress-apache.conf} \
  107. $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress/
  108. # determine installation files
  109. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  110. %{l_files_std} \
  111. '%config %{l_prefix}/etc/wordpress/*' \
  112. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/wordpress' \
  113. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/wordpress/*' \
  114. '%attr(-,%{l_rusr},%{l_ngrp}) %{l_prefix}/libexec/wordpress/wp-content/uploads'
  115. %files -f files
  116. %clean
  117. rm -rf $RPM_BUILD_ROOT
  118. %post
  119. if [ $1 -eq 1 ]; then
  120. # display final hints on initial installation
  121. ( echo "1. To complete this installation of Wordpress please start MySQL and"
  122. echo " initialize the Wordpress database like this:"
  123. echo " \$ $RPM_INSTALL_PREFIX/etc/rc mysql start"
  124. echo " \$ $RPM_INSTALL_PREFIX/sbin/wordpress-setup"
  125. echo ""
  126. echo "3. By default, Wordpress runs its own Apache server on IPv4 address"
  127. echo " 127.0.0.1, TCP port 8081. Please change this by editing the"
  128. echo " \"Port 8081\" and \"Listen 127.0.0.1:8081\" directives in"
  129. echo " $RPM_INSTALL_PREFIX/etc/wordpress/wordpress-apache.conf"
  130. echo ""
  131. echo "4. After this postinstallation, start Wordpress by running"
  132. echo " \$ $RPM_INSTALL_PREFIX/etc/rc wordpress start"
  133. echo " and initialize the Wordpress database by connecting to:"
  134. echo " http://127.0.0.1:8081/wp-admin/wp-install.php"
  135. ) | %{l_rpmtool} msg -b -t notice
  136. fi
  137. if [ $1 -eq 2 ]; then
  138. # display final hints on update installation
  139. ( echo "Please perform a Wordpress database upgrade by visiting the"
  140. echo " http://127.0.0.1:8081/wp-admin/upgrade.php"
  141. echo "page on your Wordpress website."
  142. ) | %{l_rpmtool} msg -b -t notice
  143. # after upgrade, restart service
  144. eval `%{l_rc} wordpress status 2>/dev/null`
  145. [ ".$wordpress_active" = .yes ] && %{l_rc} wordpress restart
  146. fi
  147. exit 0
  148. %preun
  149. if [ $1 -eq 0 ]; then
  150. # before erase, stop service and remove log files
  151. %{l_rc} wordpress stop 2>/dev/null
  152. rm -f $RPM_INSTALL_PREFIX/var/wordpress/log/* >/dev/null 2>&1 || true
  153. rm -f $RPM_INSTALL_PREFIX/var/wordpress/run/* >/dev/null 2>&1 || true
  154. fi
  155. exit 0