wordpress.spec 13 KB

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