wordpress.spec 14 KB

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