Code

- Correct errors when building RPM packages Closes #957 Closes #970
[gosa.git] / gosa-core / redhat / gosa.spec
1 # Some sort of "detection" of suse
2 %{?suse_version:%define suse 1}
3 %{!?suse_version:%define suse 0}
5 # Define Packagename, e.g.:
6 # rpmbuild --rebuild --define 'sourcename gosa' gosa.srpm
7 %{!?sourcename:%define sourcename %{name}-%{version}}
9 #
10 # Distribution
11 #
12 Summary:                Web Based LDAP Administration Program 
13 Name:                   gosa
14 Version:                2.6.10
15 Release:                1
16 License:                GPL
17 Source:                 ftp://oss.GONICUS.de/pub/gosa/%{sourcename}.tar.bz2
18 URL:                    https://oss.GONICUS.de/labs/gosa/
19 Group:                  System/Administration
20 Vendor:                 GONICUS GmbH
21 Packager:               Stefan Japes <japes@GONICUS.de>
22 Buildarch:              noarch
23 Patch:                  01_fix_template_location.patch
24 Patch1:                 02_fix_class_mapping.patch
25 Patch2:                 03_fix_locale_location.patch
26 Patch3:                 04_fix_online_help_location.patch
27 %if %{suse}
28 Requires:               apache2,apache2-mod_php5,php5,php5-gd,php5-ldap,php5-mcrypt,php5-mysql,php5-imap,php5-iconv,php5-hash,php5-posix,php5-mbstring,php5-gettext,ImageMagick,gettext-tools
29 %else
30 Requires:               httpd,php,php-ldap,php-imap,php-snmp,php-mysql,php-mbstring,ImageMagick,perl-Crypt-SmbHash
31 %endif
32 BuildRoot:              %{_tmppath}/%{name}-%{version}-root
33 BuildArch:              noarch
35 ########################
37 %define confdir         /etc/%{name}
39 %if %{suse}
40         %{echo:Building SuSE rpm}
41         %define apacheuser wwwrun
42         %define apachegroup root
43         %define webconf /etc/apache2/conf.d/
44         %define docdir /usr/share/doc/packages/gosa
45 %else
46         %{echo:Building other rpm}
47         %define apacheuser apache 
48         %define apachegroup apache 
49         %define webconf /etc/httpd/conf.d/      
50         %define docdir /usr/share/doc/gosa-%{version}
51 %endif
53 %description
54 GOsa is a combination of system-administrator and end-user web
55 interface, designed to handle LDAP based setups.
56 Provided is access to posix, shadow, samba, proxy, fax, and kerberos
57 accounts. It is able to manage the postfix/cyrus server combination
58 and can write user adapted sieve scripts.
60 ########################
62 %package dev
63 Group:                  System/Administration
64 Summary:                GOsa development utiles
65 %if %{suse}
66 Requires:               lyx
67 %else
68 Requires:               php-cli,latex2html,lyx
69 %endif
70 Obsoletes:              gosa-ldap
72 %description dev
73 This package contains a couple of tools to generate
74 online help, extract localisations and aid developing.
76 ########################
78 %package desktop
79 Group:                  System/Administration
80 Summary:                Desktop integration for GOsa
81 %if %{suse}
82 Requires:               firefox
83 %else
84 Requires:               firefox
85 %endif
86 Obsoletes:              gosa-ldap
88 %description desktop
89 This package includes a menu definition for your
90 desktop environment.
92 ########################
94 %package schema
95 Group:                  System/Administration
96 Summary:                Schema Definitions for the GOSA package
97 %if %{suse}
98 Requires:               gosa >= %{version}
99 %else
100 Requires:               gosa >= %{version}
101 %endif
102 Obsoletes:              gosa-ldap
104 %description schema
105 Contains the Schema definition files for the GOSA admin package.
107 ########################
109 %package help-en
110 Group:                  System/Administration
111 Summary:                English online manual for GOSA package
112 Requires:               gosa >= %{version}
114 %description help-en
115 English online manual page for GOSA package
117 ########################
119 %package help-de
120 Group:                  System/Administration
121 Summary:                German localized online manual for GOSA package
122 Requires:               gosa >= %{version}
124 %description help-de
125 German localized online manual page for GOSA package
127 ########################
129 %package help-fr
130 Group:                  System/Administration
131 Summary:                French localized online manual for GOSA package
132 Requires:               gosa >= %{version}
134 %description help-fr
135 French localized online manual page for GOSA package
137 ########################
139 %package help-nl
140 Group:                  System/Administration
141 Summary:                Dutch localized online manual for GOSA package
142 Requires:               gosa >= %{version}
144 %description help-nl
145 Dutch localized online manual page for GOSA package
147 ########################
149 %package help-es
150 Group:                  System/Administration
151 Summary:                Spain localized online manual for GOSA package
152 Requires:               gosa >= %{version}
154 %description help-es
155 Spain localized online manual page for GOSA package
157 ########################
159 %prep
160 %setup -q -n %{sourcename}
161 %patch -p1
162 %patch1 -p1
163 %patch2 -p1
164 %patch3 -p1
166 find . -depth -name CVS -type d | xargs rm -rf
168 ########################
170 %build
172 ########################
174 %install
175 # Create buildroot
176 mkdir -p %{buildroot}/usr/share/gosa
178 # Create files for temporary stuff
179 for i in compile config cache; do \
180   mkdir -p %{buildroot}/var/spool/gosa/$i ; \
181 done
182 mkdir -p %{buildroot}/var/cache/gosa
184 # Copy
185 DIRS="doc ihtml plugins html include locale setup"
186 echo `pwd`
187 for i in $DIRS; do \
188   cp -ua $i %{buildroot}/usr/share/gosa/$i ; \
189 done
191 # Copy files for gosa
192 mkdir -p %{buildroot}/usr/sbin
193 mkdir -p %{buildroot}/etc/gosa
194 mkdir -p %{buildroot}/usr/share/doc/gosa
195 mkdir -p %{buildroot}%{webconf}
197 touch %{buildroot}/etc/gosa/gosa.secrets
198 mv contrib/gosa.conf            %{buildroot}/usr/share/doc/gosa
199 mv update-gosa                  %{buildroot}/usr/sbin
200 mv bin/gosa-encrypt-passwords   %{buildroot}/usr/sbin
201 mv debian/gosa-apache.conf      %{buildroot}%{webconf}
202 mv contrib/shells               %{buildroot}/etc/gosa
203 mv contrib/encodings            %{buildroot}/etc/gosa
204 mv contrib/openldap/slapd.conf  %{buildroot}/usr/share/doc/gosa/slapd.conf-example
205 mv -f doc manual
207 # Cleanup manual dirs
208 for i in admin ; do \
209   rm -rf %{buildroot}/usr/share/gosa/doc/$i ; \
210 done
212 # Remove (some) unneeded files
213 for i in gen_locale.sh gen_online_help.sh gen_function_list.php update.sh; do \
214  rm -rf %{buildroot}/usr/share/gosa/$i ; \
215 done
217 # Cleanup lyx warnings
218 find %{buildroot}/usr/share/gosa -name WARNINGS |xargs rm
220 # Cleanup guide
221 rm -rf %{buildroot}/usr/share/gosa/doc/guide/user/*/lyx-source
223 # Copy default config
224 mkdir -p %{buildroot}%{confdir}
225 mkdir -p %{buildroot}%{webconf}
227 # Copy file for gosa-schema
228 mkdir -p %{buildroot}/etc/openldap/schema/gosa
230 mv contrib/openldap/*.schema %{buildroot}/etc/openldap/schema/gosa
232 # Copy files for gosa-dev
233 mkdir -p %{buildroot}/usr/bin
234 mv update-locale %{buildroot}/usr/bin
235 mv update-online-help %{buildroot}/usr/bin
236 mv update-pdf-help %{buildroot}/usr/bin
237 mv dh-make-gosa %{buildroot}/usr/bin
239 # Copy files for desktop
240 mkdir -p %{buildroot}/etc/gosa
241 mkdir -p %{buildroot}/usr/bin
242 mkdir -p %{buildroot}/usr/sbin
243 mkdir -p %{buildroot}/usr/share/pixmaps
244 mkdir -p %{buildroot}/usr/share/applications
245 mkdir -p %{buildroot}/usr/share/man/man1/
246 mkdir -p %{buildroot}/usr/share/man/man5/
248 mv contrib/desktoprc            %{buildroot}/etc/gosa
249 mv contrib/gosa                 %{buildroot}/usr/bin
250 mv debian/gosa.xpm              %{buildroot}/usr/share/pixmaps
251 mv debian/gosa-16.xpm           %{buildroot}/usr/share/pixmaps
252 mv debian/gosa-desktop.desktop  %{buildroot}/usr/share/applications
254 # Gzip manpages from source
255 for x in update-gosa.1 dh-make-gosa.1 update-locale.1 update-online-help.1 update-pdf-help.1 gosa-encrypt-passwords.1
256 do
257         gzip $x
258 done
260 %if %{suse}
261         sed -i 's#/usr/bin/php#/usr/bin/php5#' %{buildroot}/usr/sbin/update-gosa
262         sed -i 's#/usr/bin/php#/usr/bin/php5#' %{buildroot}/usr/sbin/gosa-encrypt-passwords
263         cat <<-EOF >> %{buildroot}%{webconf}/gosa-apache.conf
264         
265         <Directory /usr/share/gosa/html>
266             Options None
267             AllowOverride None
268             Order deny,allow
269             Allow from all
270         </Directory>
271         EOF
272 %endif
274 # Copy manpages
275 mv ./*.1.gz                     %{buildroot}/usr/share/man/man1/
276 gzip -c contrib/gosa.1 > contrib/gosa.1.gz
277 mv contrib/gosa.1.gz            %{buildroot}/usr/share/man/man1/
278 gzip -c contrib/gosa.conf.5 > contrib/gosa.conf.5.gz
279 mv contrib/gosa.conf.5.gz               %{buildroot}/usr/share/man/man5/
281 mkdir -p %{buildroot}/usr/share/doc/gosa-%{version}
282 rm -rf %{buildroot}/usr/share/gosa/contrib
284 ########################
286 %clean
287 rm -rf %{buildroot}
289 ########################
291 %post
292 /usr/sbin/update-gosa
294 ########################
296 %pre
297 # Cleanup compile dir on updates, always exit cleanly even on errors
298 [ -d /var/spool/gosa ] && rm -rf /var/spool/gosa/* ; exit 0
300 ########################
302 %postun
303 # Remove temporary files, just to be sure
304 [ -d /var/spool/gosa ] && rm -rf /var/spool/gosa ; exit 0
305 [ -d /usr/share/gosa ] && rm -rf /usr/share/gosa ; exit 0
307 ########################
309 %files
310 %defattr(-,root,root)
311 %doc %attr(-,root,root) AUTHORS README README.safemode Changelog COPYING INSTALL FAQ CODING
312 %config %attr(-,root,root) /usr/share/doc/gosa/gosa.conf
313 #%attr(-,root,root) /contrib/openldap
314 %config %attr(-,root,root) /usr/share/doc/gosa/slapd.conf-example
315 %attr(755,root,root) /usr/sbin/update-gosa
316 %attr(755,root,root) /usr/share/man/man1/gosa-encrypt-passwords.1.gz
317 %attr(755,root,root) /usr/share/man/man1/update-gosa.1.gz
318 %attr(755,root,root) /usr/share/man/man5/gosa.conf.5.gz
319 %attr(644,root,root) /etc/gosa/shells
320 %attr(644,root,root) /etc/gosa/encodings
321 %attr(755,root,root) /usr/sbin/gosa-encrypt-passwords
322 %config(noreplace) %attr(0644,root,root) %{webconf}/gosa-apache.conf
323 %attr(0700, %{apacheuser}, %{apachegroup}) /var/spool/gosa
324 %attr(0755, root,root) /usr/share/gosa
325 #%attr(0755, root,root) /usr/share/gosa/html
326 #%attr(0755, root,root) /usr/share/gosa/ihtml
327 #%attr(0755, root,root) /usr/share/gosa/include
328 #%attr(0755, root,root) /usr/share/gosa/locale
329 #%attr(0755, root,root) /usr/share/gosa/plugins
330 #%attr(0755, root,root) /usr/share/gosa/setup
331 %attr(0755, root,root) /usr/share/gosa/doc/core/guide.xml
332 %attr(0755, root,root) /var/cache/gosa
333 %attr(0700, root,root) /etc/gosa/gosa.secrets
335 ########################
337 %files dev
338 %defattr(-,root,root)
339 /usr/bin
340 %attr(755,root,root) /usr/share/man/man1/dh-make-gosa.1.gz
341 %attr(755,root,root) /usr/share/man/man1/update-locale.1.gz
342 %attr(755,root,root) /usr/share/man/man1/update-online-help.1.gz
343 %attr(755,root,root) /usr/share/man/man1/update-pdf-help.1.gz
345 ########################
347 %files desktop
348 %defattr(-,root,root)
349 /etc/gosa
350 /usr/bin
351 /usr/share/pixmaps
352 /usr/share/applications
353 %attr(755,root,root) /usr/share/man/man1/gosa.1.gz
355 ########################
357 %files schema
358 %defattr(-,root,root)
359 %doc COPYING AUTHORS README contrib/openldap
360 /etc/openldap/schema/gosa
362 ########################
364 %files help-en
365 %defattr(-,root,root)
366 /usr/share/gosa/doc/core/en
368 ########################
370 %files help-de
371 %defattr(-,root,root)
372 /usr/share/gosa/doc/core/de
374 ########################
376 %files help-fr
377 %defattr(-,root,root)
378 /usr/share/gosa/doc/core/fr
380 ########################
382 %files help-nl
383 %defattr(-,root,root)
384 /usr/share/gosa/doc/core/nl
386 ########################
388 %files help-es
389 %defattr(-,root,root)
390 /usr/share/gosa/doc/core/es
392 ########################
394 %changelog
395 * Fri Nov 17 2008 Stefan Japes <japes@GONICUS.de>
396 - First build of GOsa 2.6 as an RPM, should work on SuSE and RedHat
397 * Thu May 14 2010 
398 - Corrected errors when building RPM and plugins where not on right
399   place Closes #957 and #970