wordpress.spec 14 KB

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