wordpress.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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 versions
  25. %define V_wordpress 2.1
  26. %define V_plugin_simpletagging 1-5
  27. %define V_plugin_dbmanager 210
  28. %define V_plugin_pagenavi 210
  29. %define V_plugin_polls 214
  30. %define V_plugin_postviews 110
  31. %define V_plugin_print 210
  32. %define V_plugin_relativedate 110
  33. %define V_plugin_stats 210
  34. %define V_plugin_ban 110
  35. # package information
  36. Name: wordpress
  37. Summary: Weblog Publishing System
  38. URL: http://www.wordpress.org/
  39. Vendor: R. Boren & M. Mullenweg et al.
  40. Packager: OpenPKG Foundation e.V.
  41. Distribution: OpenPKG Community
  42. Class: PLUS
  43. Group: CMS
  44. License: GPL
  45. Version: 2.1
  46. Release: 20070216
  47. # list of sources
  48. Source0: ftp://ftp.openpkg.org/sources/CPY/VERSIONED/wordpress/wordpress-%{V_wordpress}.tar.gz
  49. Source1: wordpress-apache.conf
  50. Source2: wordpress-setup.sh
  51. Source3: wordpress-cron.sh
  52. Source4: rc.wordpress
  53. Source10: http://sw-guide.de/_mw-uploads/simple-tagging_%{V_plugin_simpletagging}.zip
  54. Source11: http://www.lesterchan.net/others/downloads/wp-dbmanager%{V_plugin_dbmanager}.zip
  55. Source12: http://www.lesterchan.net/others/downloads/wp-pagenavi%{V_plugin_pagenavi}.zip
  56. Source13: http://www.lesterchan.net/others/downloads/wp-polls%{V_plugin_polls}.zip
  57. Source14: http://www.lesterchan.net/others/downloads/wp-postviews%{V_plugin_postviews}.zip
  58. Source15: http://www.lesterchan.net/others/downloads/wp-print%{V_plugin_print}.zip
  59. Source16: http://www.lesterchan.net/others/downloads/wp-relativedate%{V_plugin_relativedate}.zip
  60. Source17: http://www.lesterchan.net/others/downloads/wp-stats%{V_plugin_stats}.zip
  61. Source18: http://www.lesterchan.net/others/downloads/wp-ban%{V_plugin_ban}.zip
  62. Patch0: wordpress.patch
  63. # build information
  64. Prefix: %{l_prefix}
  65. BuildRoot: %{l_buildroot}
  66. BuildPreReq: OpenPKG, openpkg >= 20060823, infozip
  67. PreReq: OpenPKG, openpkg >= 20060823
  68. PreReq: apache, wget
  69. PreReq: apache::with_mod_php = yes
  70. PreReq: apache::with_mod_php_mysql = yes
  71. PreReq: apache::with_mod_php_pcre = yes
  72. PreReq: apache::with_mod_php_sendmail = yes
  73. AutoReq: no
  74. AutoReqProv: no
  75. %description
  76. WordPress is a state-of-the-art semantic personal publishing
  77. platform (aka Weblog or BLOG) with a focus on aesthetics, web
  78. standards, and usability.
  79. %track
  80. prog wordpress:wordpress = {
  81. version = %{V_wordpress}
  82. url = ftp://ftp.openpkg.org/sources/CPY/VERSIONED/wordpress/
  83. regex = wordpress-(__VER__)\.tar\.gz
  84. }
  85. prog wordpress:plugin-simpletagging = {
  86. version = %{V_plugin_simpletagging}
  87. url = http://sw-guide.de/wordpress/wordpress-plugins/simple-tagging-plugin/
  88. regex = Download\s+Latest\s+Version\s+(\d+\.\d+)
  89. transform = "s/^(\d+)\.(\d+)$/$1-$2/s, $_"
  90. }
  91. prog wordpress:plugin-dbmanager = {
  92. version = %{V_plugin_dbmanager}
  93. url = http://www.lesterchan.net/wordpress/readme/wp-dbmanager.html
  94. regex = WP-DBManager\s+(\d+\.\d+)
  95. transform = "s/^(\d+)\.(\d+)$/$1$2/s, $_"
  96. }
  97. prog wordpress:plugin-pagenavi = {
  98. version = %{V_plugin_pagenavi}
  99. url = http://www.lesterchan.net/wordpress/readme/wp-pagenavi.html
  100. regex = WP-PageNavi\s+(\d+\.\d+)
  101. transform = "s/^(\d+)\.(\d+)$/$1$2/s, $_"
  102. }
  103. prog wordpress:plugin-polls = {
  104. version = %{V_plugin_polls}
  105. url = http://www.lesterchan.net/wordpress/readme/wp-polls.html
  106. regex = WP-Polls\s+(\d+\.\d+)
  107. transform = "s/^(\d+)\.(\d+)$/$1$2/s, $_"
  108. }
  109. prog wordpress:plugin-postviews = {
  110. version = %{V_plugin_postviews}
  111. url = http://www.lesterchan.net/wordpress/readme/wp-postviews.html
  112. regex = WP-PostViews\s+(\d+\.\d+)
  113. transform = "s/^(\d+)\.(\d+)$/$1$2/s, $_"
  114. }
  115. prog wordpress:plugin-print = {
  116. version = %{V_plugin_print}
  117. url = http://www.lesterchan.net/wordpress/readme/wp-print.html
  118. regex = WP-Print\s+(\d+\.\d+)
  119. transform = "s/^(\d+)\.(\d+)$/$1$2/s, $_"
  120. }
  121. prog wordpress:plugin-relativedate = {
  122. version = %{V_plugin_relativedate}
  123. url = http://www.lesterchan.net/wordpress/readme/wp-relativedate.html
  124. regex = WP-RelativeDate\s+(\d+\.\d+)
  125. transform = "s/^(\d+)\.(\d+)$/$1$2/s, $_"
  126. }
  127. prog wordpress:plugin-stats = {
  128. version = %{V_plugin_stats}
  129. url = http://www.lesterchan.net/wordpress/readme/wp-stats.html
  130. regex = WP-Stats\s+(\d+\.\d+)
  131. transform = "s/^(\d+)\.(\d+)$/$1$2/s, $_"
  132. }
  133. prog wordpress:plugin-ban = {
  134. version = %{V_plugin_ban}
  135. url = http://www.lesterchan.net/wordpress/readme/wp-ban.html
  136. regex = WP-Ban\s+(\d+\.\d+)
  137. transform = "s/^(\d+)\.(\d+)$/$1$2/s, $_"
  138. }
  139. %prep
  140. %setup -q -c
  141. %{l_prefix}/bin/unzip -q -o -x %{SOURCE10}
  142. %{l_prefix}/bin/unzip -q -o -x %{SOURCE11}
  143. %{l_prefix}/bin/unzip -q -o -x %{SOURCE12}
  144. %{l_prefix}/bin/unzip -q -o -x %{SOURCE13}
  145. %{l_prefix}/bin/unzip -q -o -x %{SOURCE14}
  146. %{l_prefix}/bin/unzip -q -o -x %{SOURCE15}
  147. %{l_prefix}/bin/unzip -q -o -x %{SOURCE16}
  148. %{l_prefix}/bin/unzip -q -o -x %{SOURCE17}
  149. %{l_prefix}/bin/unzip -q -o -x %{SOURCE18}
  150. %patch -p0 -d wordpress
  151. %build
  152. # create configuration file
  153. %{l_shtool} install -m 644 \
  154. -e 's;username;wordpress;' \
  155. -e 's;password;wordpress;' \
  156. wordpress/wp-config-sample.php \
  157. wordpress/wp-config.php
  158. %install
  159. # create installation hierarchy
  160. rm -rf $RPM_BUILD_ROOT
  161. %{l_shtool} mkdir -f -p -m 755 \
  162. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  163. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  164. $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress \
  165. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress \
  166. $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress \
  167. $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/run \
  168. $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/log \
  169. $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/tmp
  170. # install program files
  171. cp -rp wordpress/* $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/
  172. # install plugins
  173. %{l_shtool} mkdir -f -p -m 755 \
  174. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/backup-db \
  175. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/simpletagging \
  176. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/dbmanager \
  177. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/pagenavi \
  178. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/polls \
  179. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/postviews \
  180. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/print \
  181. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/relativedate \
  182. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/stats \
  183. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/ban
  184. cp -rp simple-tagging/simpletagging* \
  185. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/simpletagging/
  186. cp -rp dbmanager/* \
  187. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/dbmanager/
  188. cp -rp pagenavi/pagenavi* \
  189. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/pagenavi/
  190. cp -rp polls/* \
  191. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/polls/
  192. cp -rp postviews/* \
  193. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/postviews/
  194. cp -rp print/* \
  195. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/print/
  196. cp -rp relativedate/* \
  197. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/relativedate/
  198. cp -rp stats/* \
  199. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/stats/
  200. cp -rp ban/* \
  201. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/ban/
  202. # create additional uploads directory
  203. %{l_shtool} mkdir -f -p -m 755 \
  204. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/uploads
  205. # install run-command script
  206. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  207. %{SOURCE rc.wordpress} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  208. # install MySQL database setup script
  209. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  210. %{SOURCE wordpress-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/wordpress-setup
  211. # install cron-job script
  212. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  213. %{SOURCE wordpress-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/wordpress-cron
  214. # install custom Apache configuration
  215. l_hostname=`%{l_shtool} echo -e %h`
  216. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  217. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  218. -e "s;@l_hostname@;$l_hostname;g" \
  219. -e "s;@l_domainname@;$l_domainname;g" \
  220. %{SOURCE wordpress-apache.conf} \
  221. $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress/
  222. # determine installation files
  223. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  224. %{l_files_std} \
  225. '%config %{l_prefix}/etc/wordpress/*' \
  226. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/wordpress' \
  227. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/wordpress/*' \
  228. '%attr(-,%{l_rusr},%{l_ngrp}) %{l_prefix}/libexec/wordpress/wp-content/uploads'
  229. %files -f files
  230. %clean
  231. rm -rf $RPM_BUILD_ROOT
  232. %post
  233. if [ $1 -eq 1 ]; then
  234. # display final hints on initial installation
  235. ( echo "1. To complete this installation of Wordpress please start MySQL and"
  236. echo " initialize the Wordpress database like this:"
  237. echo " \$ $RPM_INSTALL_PREFIX/etc/rc mysql start"
  238. echo " \$ $RPM_INSTALL_PREFIX/sbin/wordpress-setup"
  239. echo ""
  240. echo "3. By default, Wordpress runs its own Apache server on IPv4 address"
  241. echo " 127.0.0.1, TCP port 8081. Please change this by editing the"
  242. echo " \"Port 8081\" and \"Listen 127.0.0.1:8081\" directives in"
  243. echo " $RPM_INSTALL_PREFIX/etc/wordpress/wordpress-apache.conf"
  244. echo ""
  245. echo "4. After this postinstallation, start Wordpress by running"
  246. echo " \$ $RPM_INSTALL_PREFIX/etc/rc wordpress start"
  247. echo " and initialize the Wordpress database by connecting to:"
  248. echo " http://127.0.0.1:8081/wp-admin/wp-install.php"
  249. ) | %{l_rpmtool} msg -b -t notice
  250. fi
  251. if [ $1 -eq 2 ]; then
  252. # display final hints on update installation
  253. ( echo "Please perform a Wordpress database upgrade by visiting the"
  254. echo " http://127.0.0.1:8081/wp-admin/upgrade.php"
  255. echo "page on your Wordpress website."
  256. ) | %{l_rpmtool} msg -b -t notice
  257. # after upgrade, restart service
  258. eval `%{l_rc} wordpress status 2>/dev/null`
  259. [ ".$wordpress_active" = .yes ] && %{l_rc} wordpress restart
  260. fi
  261. exit 0
  262. %preun
  263. if [ $1 -eq 0 ]; then
  264. # before erase, stop service and remove log files
  265. %{l_rc} wordpress stop 2>/dev/null
  266. rm -f $RPM_INSTALL_PREFIX/var/wordpress/log/* >/dev/null 2>&1 || true
  267. rm -f $RPM_INSTALL_PREFIX/var/wordpress/run/* >/dev/null 2>&1 || true
  268. fi
  269. exit 0