wordpress.spec 15 KB

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