wordpress.spec 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. ##
  2. ## wordpress.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package versions
  24. %define V_wordpress 2.6.2
  25. %define V_plugin_akismet 2.1.8
  26. %define V_plugin_dbmanager 2.31
  27. %define V_plugin_pagenavi 2.31
  28. %define V_plugin_polls 2.31
  29. %define V_plugin_postviews 1.31
  30. %define V_plugin_print 2.31
  31. %define V_plugin_relativedate 1.31
  32. %define V_plugin_ban 1.31
  33. %define V_plugin_ela 0.10
  34. %define V_plugin_stats 1.3.2
  35. %define V_plugin_peterantispam 3.0.7
  36. %define V_plugin_hashcash 4.3
  37. # package information
  38. Name: wordpress
  39. Summary: Weblog Publishing System
  40. URL: http://wordpress.org/
  41. Vendor: R. Boren & M. Mullenweg et al.
  42. Packager: OpenPKG Foundation e.V.
  43. Distribution: OpenPKG Community
  44. Class: PLUS
  45. Group: CMS
  46. License: GPL
  47. Version: %{V_wordpress}
  48. Release: 20080909
  49. # list of sources
  50. Source0: http://wordpress.org/wordpress-%{V_wordpress}.tar.gz
  51. Source1: wordpress-apache.conf
  52. Source2: wordpress-setup.sh
  53. Source3: wordpress-cron.sh
  54. Source4: rc.wordpress
  55. Source10: ftp://ftp.openpkg.org/sources/CPY/VERSIONED/akismet/akismet-%{V_plugin_akismet}.zip
  56. Source11: http://downloads.wordpress.org/plugin/wp-dbmanager.%{V_plugin_dbmanager}.zip
  57. Source12: http://downloads.wordpress.org/plugin/wp-pagenavi.%{V_plugin_pagenavi}.zip
  58. Source13: http://downloads.wordpress.org/plugin/wp-polls.%{V_plugin_polls}.zip
  59. Source14: http://downloads.wordpress.org/plugin/wp-postviews.%{V_plugin_postviews}.zip
  60. Source15: http://downloads.wordpress.org/plugin/wp-print.%{V_plugin_print}.zip
  61. Source16: http://downloads.wordpress.org/plugin/wp-relativedate.%{V_plugin_relativedate}.zip
  62. Source17: http://downloads.wordpress.org/plugin/wp-ban.%{V_plugin_ban}.zip
  63. Source18: http://www.sonsofskadi.net/wp-content/upload/af-extended-live-archive-%{V_plugin_ela}.zip
  64. Source19: http://downloads.wordpress.org/plugin/stats.%{V_plugin_stats}.zip
  65. Source20: http://www.theblog.ca/wp-content/uploads/2008/08/peterantispam%{V_plugin_peterantispam}.zip
  66. Source21: http://downloads.wordpress.org/plugin/wp-hashcash.%{V_plugin_hashcash}.zip
  67. Patch0: wordpress.patch
  68. Patch1: wordpress.patch.ela
  69. # build information
  70. Prefix: %{l_prefix}
  71. BuildRoot: %{l_buildroot}
  72. BuildPreReq: OpenPKG, openpkg >= 20060823, infozip
  73. PreReq: OpenPKG, openpkg >= 20060823
  74. PreReq: apache, wget
  75. PreReq: apache-php
  76. PreReq: apache-php::with_mysql = yes
  77. PreReq: apache-php::with_pcre = yes
  78. PreReq: apache-php::with_sendmail = yes
  79. PreReq: apache-extfwd
  80. AutoReq: no
  81. AutoReqProv: no
  82. %description
  83. WordPress is a state-of-the-art semantic personal publishing
  84. platform (aka Weblog or BLOG) with a focus on aesthetics, web
  85. standards, and usability.
  86. %track
  87. prog wordpress:wordpress = {
  88. version = %{V_wordpress}
  89. url = http://wordpress.org/download/release-archive/
  90. regex = wordpress-(\d+\.\d+(\.\d+)?)\.tar\.gz
  91. }
  92. prog wordpress:plugin-akismet = {
  93. version = %{V_plugin_akismet}
  94. url = http://wordpress.org/extend/plugins/akismet/download/
  95. regex = akismet\.(__VER__)\.zip
  96. }
  97. prog wordpress:plugin-dbmanager = {
  98. version = %{V_plugin_dbmanager}
  99. url = http://lesterchan.net/wordpress/readme/wp-dbmanager.html
  100. regex = WP-DBManager\s+(\d+\.\d+)
  101. }
  102. prog wordpress:plugin-pagenavi = {
  103. version = %{V_plugin_pagenavi}
  104. url = http://lesterchan.net/wordpress/readme/wp-pagenavi.html
  105. regex = WP-PageNavi\s+(\d+\.\d+)
  106. }
  107. prog wordpress:plugin-polls = {
  108. version = %{V_plugin_polls}
  109. url = http://lesterchan.net/wordpress/readme/wp-polls.html
  110. regex = WP-Polls\s+(\d+\.\d+)
  111. }
  112. prog wordpress:plugin-postviews = {
  113. version = %{V_plugin_postviews}
  114. url = http://lesterchan.net/wordpress/readme/wp-postviews.html
  115. regex = WP-PostViews\s+(\d+\.\d+)
  116. }
  117. prog wordpress:plugin-print = {
  118. version = %{V_plugin_print}
  119. url = http://lesterchan.net/wordpress/readme/wp-print.html
  120. regex = WP-Print\s+(\d+\.\d+)
  121. }
  122. prog wordpress:plugin-relativedate = {
  123. version = %{V_plugin_relativedate}
  124. url = http://lesterchan.net/wordpress/readme/wp-relativedate.html
  125. regex = WP-RelativeDate\s+(\d+\.\d+)
  126. }
  127. prog wordpress:plugin-ban = {
  128. version = %{V_plugin_ban}
  129. url = http://lesterchan.net/wordpress/readme/wp-ban.html
  130. regex = WP-Ban\s+(\d+\.\d+)
  131. }
  132. prog wordpress:plugin-ela = {
  133. version = %{V_plugin_ela}
  134. url = http://www.sonsofskadi.net/extended-live-archive/
  135. regex = af-extended-live-archive-(__VER__)\.zip
  136. }
  137. prog wordpress:plugin-stats = {
  138. version = %{V_plugin_stats}
  139. url = http://wordpress.org/extend/plugins/stats/
  140. regex = stats\.(__VER__)\.zip
  141. }
  142. prog wordpress:plugin-peterantispam = {
  143. version = %{V_plugin_peterantispam}
  144. url = http://www.theblog.ca/anti-spam
  145. regex = peterantispam(__VER__)\.zip
  146. }
  147. prog wordpress:plugin-hashcash = {
  148. version = %{V_plugin_hashcash}
  149. url = http://wordpress.org/extend/plugins/wp-hashcash/
  150. regex = wp-hashcash\.(__VER__)\.zip
  151. }
  152. %prep
  153. %setup -q -c
  154. %{l_prefix}/bin/unzip -q -o -x %{SOURCE10}
  155. %{l_prefix}/bin/unzip -q -o -x %{SOURCE11}
  156. %{l_prefix}/bin/unzip -q -o -x %{SOURCE12}
  157. %{l_prefix}/bin/unzip -q -o -x %{SOURCE13}
  158. %{l_prefix}/bin/unzip -q -o -x %{SOURCE14}
  159. %{l_prefix}/bin/unzip -q -o -x %{SOURCE15}
  160. %{l_prefix}/bin/unzip -q -o -x %{SOURCE16}
  161. %{l_prefix}/bin/unzip -q -o -x %{SOURCE17}
  162. %{l_prefix}/bin/unzip -q -o -x %{SOURCE18}
  163. %{l_prefix}/bin/unzip -q -o -x %{SOURCE19}
  164. %{l_prefix}/bin/unzip -q -o -x %{SOURCE20}
  165. %{l_prefix}/bin/unzip -q -o -x %{SOURCE21}
  166. %patch -p0
  167. %patch -p0 -d af-extended-live-archive -P 1
  168. rm -f af-extended-live-archive/*.orig
  169. rm -f af-extended-live-archive/*/*.orig
  170. %build
  171. # create configuration file
  172. %{l_shtool} install -m 644 \
  173. -e 's;putyourdbnamehere;wordpress;g' \
  174. -e 's;usernamehere;wordpress;g' \
  175. -e 's;yourpasswordhere;wordpress;g' \
  176. wordpress/wp-config-sample.php wordpress/wp-config.php
  177. %install
  178. # create installation hierarchy
  179. rm -rf $RPM_BUILD_ROOT
  180. %{l_shtool} mkdir -f -p -m 755 \
  181. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  182. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  183. $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress \
  184. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress \
  185. $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress \
  186. $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/run \
  187. $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/log \
  188. $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/tmp
  189. # install program files
  190. cp -rp wordpress/* $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/
  191. find $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress -name "*.orig" -print | xargs rm -f
  192. # update akismet plugin
  193. cp -rp akismet/* \
  194. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/akismet/
  195. # install plugins
  196. %{l_shtool} mkdir -f -p -m 755 \
  197. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/backup-db \
  198. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/dbmanager \
  199. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/pagenavi \
  200. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/polls \
  201. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/postviews \
  202. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/print \
  203. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/relativedate \
  204. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/ban \
  205. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/af-extended-live-archive \
  206. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/stats \
  207. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/custom-anti-spam \
  208. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/hashcash
  209. cp -rp wp-dbmanager/* \
  210. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/dbmanager/
  211. cp -rp wp-pagenavi/* \
  212. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/pagenavi/
  213. cp -rp wp-polls/* \
  214. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/polls/
  215. cp -rp wp-postviews/* \
  216. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/postviews/
  217. cp -rp wp-print/* \
  218. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/print/
  219. cp -rp wp-relativedate/* \
  220. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/relativedate/
  221. cp -rp wp-ban/* \
  222. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/ban/
  223. cp -rp af-extended-live-archive/* \
  224. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/af-extended-live-archive/
  225. cp -rp stats/* \
  226. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/stats/
  227. cp -rp custom-anti-spam/* \
  228. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/custom-anti-spam/
  229. cp -rp wp-hashcash/* \
  230. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/plugins/hashcash/
  231. # create additional uploads directory
  232. %{l_shtool} mkdir -f -p -m 755 \
  233. $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/uploads
  234. # install run-command script
  235. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  236. %{SOURCE rc.wordpress} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  237. # install MySQL database setup script
  238. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  239. %{SOURCE wordpress-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/wordpress-setup
  240. # install cron-job script
  241. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  242. %{SOURCE wordpress-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/wordpress-cron
  243. # install custom Apache configuration
  244. l_hostname=`%{l_shtool} echo -e %h`
  245. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  246. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  247. -e "s;@l_hostname@;$l_hostname;g" \
  248. -e "s;@l_domainname@;$l_domainname;g" \
  249. %{SOURCE wordpress-apache.conf} \
  250. $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress/
  251. # determine installation files
  252. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  253. %{l_files_std} \
  254. '%config %{l_prefix}/etc/wordpress/*' \
  255. '%config %{l_prefix}/libexec/wordpress/wp-config.php' \
  256. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/wordpress' \
  257. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/wordpress/*' \
  258. '%attr(-,%{l_rusr},%{l_ngrp}) %{l_prefix}/libexec/wordpress/wp-content/uploads' \
  259. '%attr(-,%{l_rusr},%{l_ngrp}) %{l_prefix}/libexec/wordpress/wp-content/backup-db' \
  260. '%attr(-,%{l_rusr},%{l_ngrp}) %{l_prefix}/libexec/wordpress/wp-content/plugins/af-extended-live-archive/cache'
  261. %files -f files
  262. %clean
  263. rm -rf $RPM_BUILD_ROOT
  264. %post
  265. if [ $1 -eq 1 ]; then
  266. # display final hints on initial installation
  267. ( echo "1. To complete this installation of Wordpress please start MySQL and"
  268. echo " initialize the Wordpress database like this:"
  269. echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start"
  270. echo " \$ $RPM_INSTALL_PREFIX/sbin/wordpress-setup"
  271. echo " But remember to configure your MySQL installation first."
  272. echo " At least set a MySQL administrator password in:"
  273. echo " \$ $RPM_INSTALL_PREFIX/etc/mysql/my.pwd"
  274. echo ""
  275. echo "3. By default, Wordpress runs its own Apache server on IPv4 address"
  276. echo " 127.0.0.1, TCP port 8081. Please change this by editing the"
  277. echo " \"Listen 127.0.0.1:8081\" directives in the configuration file"
  278. echo " $RPM_INSTALL_PREFIX/etc/wordpress/wordpress-apache.conf"
  279. echo ""
  280. echo "4. After this postinstallation, start Wordpress by running"
  281. echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc wordpress start"
  282. echo " and initialize the Wordpress database by connecting to:"
  283. echo " http://127.0.0.1:8081/wp-admin/wp-install.php"
  284. ) | %{l_rpmtool} msg -b -t notice
  285. fi
  286. if [ $1 -eq 2 ]; then
  287. # display final hints on update installation
  288. ( echo "Please perform a Wordpress database upgrade by visiting the"
  289. echo " http://127.0.0.1:8081/wp-admin/upgrade.php"
  290. echo "page on your Wordpress website."
  291. ) | %{l_rpmtool} msg -b -t notice
  292. # after upgrade, restart service
  293. eval `%{l_rc} wordpress status 2>/dev/null`
  294. [ ".$wordpress_active" = .yes ] && %{l_rc} wordpress restart
  295. fi
  296. exit 0
  297. %preun
  298. if [ $1 -eq 0 ]; then
  299. # before erase, stop service and remove log files
  300. %{l_rc} wordpress stop 2>/dev/null
  301. rm -f $RPM_INSTALL_PREFIX/var/wordpress/log/* >/dev/null 2>&1 || true
  302. rm -f $RPM_INSTALL_PREFIX/var/wordpress/run/* >/dev/null 2>&1 || true
  303. fi
  304. exit 0