Tue, 28 Aug 2012 18:29:40 +0200
Import package vendor original specs for necessary manipulations.
1 ##
2 ## joomla.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 ##
24 # package version
25 %define V_dist 1.7.3
26 %define V_opkg 1.7.3
27 %define V_subdir 6/9/6/69674
29 # package information
30 Name: joomla
31 Summary: Content Management System (CMS)
32 URL: http://www.joomla.org/
33 Vendor: Open Source Matters
34 Packager: OpenPKG Foundation e.V.
35 Distribution: OpenPKG Community
36 Class: EVAL
37 Group: CMS
38 License: GPL/LGPL
39 Version: %{V_opkg}
40 Release: 20111211
42 # list of sources
43 Source0: http://downloads.joomlacode.org/frsrelease/%{V_subdir}/Joomla_%{V_dist}-Stable-Full_Package.zip
44 Source1: joomla-setup.sh
45 Source2: joomla-apache.conf
46 Source3: rc.joomla
48 # build information
49 BuildPreReq: OpenPKG, openpkg >= 20100101, infozip
50 PreReq: OpenPKG, openpkg >= 20100101
51 PreReq: apache
52 PreReq: apache-php
53 PreReq: apache-php::with_mysql = yes
54 PreReq: apache-php::with_zlib = yes
55 PreReq: apache-php::with_xml = yes
56 PreReq: apache-php::with_gd = yes
57 PreReq: apache-php::with_session = yes
58 PreReq: apache-php::with_mm = yes
59 PreReq: apache-php::with_sendmail = yes
60 PreReq: MTA
62 %description
63 Joomla! is a popular Web-based Content Management System (CMS).
65 %track
66 prog joomla = {
67 version = %{V_dist}
68 url = http://joomlacode.org/gf/project/joomla/frs/
69 regex = frsrelease/\d+/\d+/Joomla-(__VER__)\.tar\.gz
70 }
71 prog joomla:subdir = {
72 version = %{V_subdir}
73 url = http://joomlacode.org/gf/project/joomla/frs/
74 regex = frsrelease/(\d+/\d+)/Joomla-__VER__\.tar\.gz
75 }
77 %prep
78 %setup -q -T -c
79 unzip -q -x %{SOURCE0}
81 %build
83 %install
84 # create installation hierarchy
85 %{l_shtool} mkdir -f -p -m 755 \
86 $RPM_BUILD_ROOT%{l_prefix}/sbin \
87 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
88 $RPM_BUILD_ROOT%{l_prefix}/etc/joomla \
89 $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime \
90 $RPM_BUILD_ROOT%{l_prefix}/var/joomla/db \
91 $RPM_BUILD_ROOT%{l_prefix}/var/joomla/log \
92 $RPM_BUILD_ROOT%{l_prefix}/var/joomla/run
94 # adjust default configuration
95 %{l_shtool} subst \
96 -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;' \
97 installation/template/tmpl/configuration.html
99 # install main program files
100 find . -name ".#*" -print | xargs rm -f
101 find . -name "*.orig" -print | xargs rm -f
102 cp -rp * $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime/
103 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime/configuration.php-dist
104 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime/htaccess.txt
106 # post-adjustment: move risky installation area out of runtime area
107 # (will be dynmically linked in again later)
108 mv $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime/installation \
109 $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/installation
111 # install run-command script
112 %{l_shtool} install -c -m 755 %{l_value -s -a} \
113 -e 's;@l_path@;%{l_build_path};' \
114 %{SOURCE rc.joomla} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
116 # install setup script
117 %{l_shtool} install -c -m 755 %{l_value -s -a} \
118 %{SOURCE joomla-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/joomla-setup
120 # install Apache configuration
121 l_hostname=`%{l_shtool} echo -e %h`
122 l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
123 %{l_shtool} install -c -m 644 %{l_value -s -a} \
124 -e "s;@l_hostname@;$l_hostname;g" \
125 -e "s;@l_domainname@;$l_domainname;g" \
126 %{SOURCE joomla-apache.conf} \
127 $RPM_BUILD_ROOT%{l_prefix}/etc/joomla/
129 # determine installation files
130 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
131 %{l_files_std} \
132 '%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/joomla/*' \
133 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla' \
134 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla/*' \
135 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla/*/*' \
136 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla/*/*/*' \
137 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla/*/*/*/*' \
138 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/joomla' \
139 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/joomla/*'
141 %files -f files
143 %clean
145 %post
146 if [ $1 -eq 1 ]; then
147 # display final hints on initial installation
148 ( echo "To complete the Joomla! installation:"
149 echo "1. start the MySQL RDBMS:"
150 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start"
151 echo "2. setup the Joomla! database in the MySQL RDBMS:"
152 echo " \$ $RPM_INSTALL_PREFIX/sbin/joomla-setup install"
153 echo "3. start the Joomla! Apache webserver:"
154 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc joomla start"
155 echo "4. setup Joomla! through the Web installer..."
156 echo " http://localhost:8080/joomla/"
157 echo " ..and on page \"4: Database\" use:"
158 echo " - Host Name: \"localhost\""
159 echo " - User Name: \"joomla\""
160 echo " - Password: \"joomla\""
161 echo " - Database Name: \"joomla\""
162 echo "5. fixup installation afterwards:"
163 echo " \$ $RPM_INSTALL_PREFIX/sbin/joomla-setup cleanup"
164 echo "6. access Joomla! via:"
165 echo " http://localhost:8080/joomla/ (website view)"
166 echo " http://localhost:8080/joomla/administrator (website admin)"
167 ) | %{l_rpmtool} msg -b -t notice
168 elif [ $1 -eq 2 ]; then
169 # after upgrade, restart service
170 rm -f $RPM_INSTALL_PREFIX/lib/joomla/runtime/installation
171 [ $1 -eq 2 ] || exit 0
172 eval `%{l_rc} joomla status 2>/dev/null`
173 [ ".$joomla_active" = .yes ] && %{l_rc} joomla restart
174 fi
175 exit 0
177 %preun
178 if [ $1 -eq 0 ]; then
179 # before erase, stop service
180 %{l_rc} joomla stop 2>/dev/null
182 # remove database
183 $RPM_INSTALL_PREFIX/sbin/joomla-setup uninstall >/dev/null 2>&1 || true
185 # remove run-time files
186 rm -f $RPM_INSTALL_PREFIX/var/joomla/db/* >/dev/null 2>&1 || true
187 rm -f $RPM_INSTALL_PREFIX/var/joomla/db/*/* >/dev/null 2>&1 || true
188 rm -f $RPM_INSTALL_PREFIX/var/joomla/run/* >/dev/null 2>&1 || true
189 rm -f $RPM_INSTALL_PREFIX/var/joomla/log/* >/dev/null 2>&1 || true
190 fi
191 exit 0