update dev300-m58
[ooovba.git] / sysui / desktop / mandriva / mandriva-menus.spec
blob5be889e3924e566312f588632bc90e095c659138
1 # version and release passed by command-line
2 Version: %version
3 Release: %release
4 Summary: %productname desktop integration
5 Name: %pkgprefix-mandriva-menus
6 Group: Office
7 License: LGPL
8 AutoReqProv: no
9 BuildArch: noarch
11 # FIXME: Limited Edition 2005 contains package mandrakelinux-release,
12 # which provides 'mandrake-release'. We should leave 'mandrake-release'
13 # here and check for the 'mandriva-release' in the future (next year).
15 Requires: mandrake-release
16 Provides: openoffice.org3-desktop-integration
18 %define _unpackaged_files_terminate_build 0
20 %define menuversion %(echo %version|cut -d'.' -f 1-2)
21 %{?!update_menus:%define update_menus if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi}
22 %{?!trigger_clean_menus:%define trigger_clean_menus if [ "$2" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi}
24 %description
25 %productname desktop integration
27 # Update menus
29 # - core02 for spadmin (printeradmin)
31 %triggerin -- %pkgprefix, %pkgprefix-core01 %pkgprefix-calc %pkgprefix-draw %pkgprefix-impress %pkgprefix-writer %pkgprefix-math %pkgprefix-core02
32 %{update_menus}
34 # Update menus
36 # - core02 for spadmin (printeradmin)
38 %triggerpostun -- %pkgprefix, %pkgprefix-core01 %pkgprefix-calc %pkgprefix-draw %pkgprefix-impress %pkgprefix-writer %pkgprefix-math %pkgprefix-core02
39 %{trigger_clean_menus}
41 %post
43 # update /etc/mime.types
44 # backing out existing entries to avoid duplicates
45 sed '
46 /application\/vnd\.oasis\.opendocument/d
47 /application\/vnd\.openofficeorg/d
48 /application\/vnd\.sun/d
49 /application\/vnd\.stardivision/d
50 ' /etc/mime.types 2>/dev/null >> /etc/mime.types.tmp$$
52 # now append our stuff to the temporary file
53 cat >> /etc/mime.types.tmp$$ << END
54 application/vnd.oasis.opendocument.text odt
55 application/vnd.oasis.opendocument.text-template ott
56 application/vnd.oasis.opendocument.text-web oth
57 application/vnd.oasis.opendocument.text-master odm
58 application/vnd.oasis.opendocument.graphics odg
59 application/vnd.oasis.opendocument.graphics-template otg
60 application/vnd.oasis.opendocument.presentation odp
61 application/vnd.oasis.opendocument.presentation-template otp
62 application/vnd.oasis.opendocument.spreadsheet ods
63 application/vnd.oasis.opendocument.spreadsheet-template ots
64 application/vnd.oasis.opendocument.chart odc
65 application/vnd.oasis.opendocument.formula odf
66 application/vnd.oasis.opendocument.image odi
67 application/vnd.sun.xml.writer sxw
68 application/vnd.sun.xml.writer.template stw
69 application/vnd.sun.xml.writer.global sxg
70 application/vnd.stardivision.writer sdw vor
71 application/vnd.stardivision.writer-global sgl
72 application/vnd.sun.xml.calc sxc
73 application/vnd.sun.xml.calc.template stc
74 application/vnd.stardivision.calc sdc
75 application/vnd.stardivision.chart sds
76 application/vnd.sun.xml.impress sxi
77 application/vnd.sun.xml.impress.template sti
78 application/vnd.stardivision.impress sdd sdp
79 application/vnd.sun.xml.draw sxd
80 application/vnd.sun.xml.draw.template std
81 application/vnd.stardivision.draw sda
82 application/vnd.sun.xml.math sxm
83 application/vnd.stardivision.math smf
84 application/vnd.sun.xml.base odb
85 application/vnd.openofficeorg.extension oxt
86 application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
87 application/vnd.ms-word.document.macroenabled.12 docm
88 application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
89 application/vnd.ms-word.template.macroenabled.12 dotm
90 application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
91 application/vnd.ms-excel.sheet.macroenabled.12 xlsm
92 application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
93 application/vnd.ms-excel.template.macroenabled.12 xltm
94 application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
95 application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm
96 application/vnd.openxmlformats-officedocument.presentationml.template potx
97 application/vnd.ms-powerpoint.template.macroenabled.12 potm
98 END
100 # and replace the original file
101 mv -f /etc/mime.types.tmp$$ /etc/mime.types 2>/dev/null
103 # update /etc/mailcap only at initial install
104 if [ "$1" = 1 ]
105 then
106 # backing out existing entries to avoid duplicates
107 sed '
108 /^# OpenOffice.org/d
109 /^application\/vnd\.oasis\.opendocument/d
110 /^application\/vnd\.openofficeorg/d
111 /^application\/vnd\.sun/d
112 /^application\/vnd\.stardivision/d
113 /^application\/vnd\.ms-word/d
114 /^application\/vnd\.ms-excel/d
115 /^application\/vnd\.ms-powerpoint/d
116 /^application\/x-star/d
117 /excel/d
118 /ms[-]*word/d
119 /powerpoint/d
120 ' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$
122 # now append our stuff to the temporary file
123 cat >> /etc/mailcap.tmp$$ << END
124 # OpenOffice.org
125 application/vnd.oasis.opendocument.text; %unixfilename -view %s
126 application/vnd.oasis.opendocument.text-template; %unixfilename -view %s
127 application/vnd.oasis.opendocument.text-web; %unixfilename -view %s
128 application/vnd.oasis.opendocument.text-master; %unixfilename -view %s
129 application/vnd.sun.xml.writer; %unixfilename -view %s
130 application/vnd.sun.xml.writer.template; %unixfilename -view %s
131 application/vnd.sun.xml.writer.global; %unixfilename -view %s
132 application/vnd.stardivision.writer; %unixfilename -view %s
133 application/vnd.stardivision.writer-global; %unixfilename -view %s
134 application/x-starwriter; %unixfilename -view %s
135 application/vnd.oasis.opendocument.formula; %unixfilename -view %s
136 application/vnd.sun.xml.math; %unixfilename -view %s
137 application/vnd.stardivision.math; %unixfilename -view %s
138 application/x-starmath; %unixfilename -view %s
139 application/msword; %unixfilename -view %s
140 application/vnd.oasis.opendocument.spreadsheet; %unixfilename -view %s
141 application/vnd.oasis.opendocument.spreadsheet-template; %unixfilename -view %s
142 application/vnd.sun.xml.calc; %unixfilename -view %s
143 application/vnd.sun.xml.calc.template; %unixfilename -view %s
144 application/vnd.stardivision.calc; %unixfilename -view %s
145 application/x-starcalc; %unixfilename -view %s
146 application/vnd.stardivision.chart; %unixfilename -view %s
147 application/x-starchart; %unixfilename -view %s
148 application/excel; %unixfilename -view %s
149 application/msexcel; %unixfilename -view %s
150 application/vnd.ms-excel; %unixfilename -view %s
151 application/x-msexcel; %unixfilename -view %s
152 application/vnd.oasis.opendocument.presentation; %unixfilename -view %s
153 application/vnd.oasis.opendocument.presentation-template; %unixfilename -view %s
154 application/vnd.sun.xml.impress; %unixfilename -view %s
155 application/vnd.sun.xml.impress.template; %unixfilename -view %s
156 application/vnd.stardivision.impress; %unixfilename -view %s
157 application/x-starimpress; %unixfilename -view %s
158 application/powerpoint; %unixfilename -view %s
159 application/mspowerpoint; %unixfilename -view %s
160 application/vnd.ms-powerpoint; %unixfilename -view %s
161 application/x-mspowerpoint; %unixfilename -view %s
162 application/vnd.oasis.opendocument.graphics; %unixfilename -view %s
163 application/vnd.oasis.opendocument.graphics-template; %unixfilename -view %s
164 application/vnd.sun.xml.draw; %unixfilename -view %s
165 application/vnd.sun.xml.draw.template; %unixfilename -view %s
166 application/vnd.stardivision.draw; %unixfilename -view %s
167 application/x-stardraw; %unixfilename -view %s
168 application/vnd.oasis.opendocument.database; %unixfilename -view %s
169 application/vnd.sun.xml.base; %unixfilename -view %s
170 application/vnd.openofficeorg.extension; %unixfilename %s
171 application/vnd.openxmlformats-officedocument.wordprocessingml.document; %unixfilename -view %s
172 application/vnd.ms-word.document.macroenabled.12;%unixfilename -view %s
173 application/vnd.openxmlformats-officedocument.wordprocessingml.template; %unixfilename -view %s
174 application/vnd.ms-word.template.macroenabled.12; %unixfilename -view %s
175 application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; %unixfilename -view %s
176 application/vnd.ms-excel.sheet.macroenabled.12; %unixfilename -view %s
177 application/vnd.openxmlformats-officedocument.spreadsheetml.template; %unixfilename -view %s
178 application/vnd.ms-excel.template.macroenabled.12; %unixfilename -view %s
179 application/vnd.openxmlformats-officedocument.presentationml.presentation; %unixfilename -view %s
180 application/vnd.ms-powerpoint.presentation.macroenabled.12; %unixfilename -view %s
181 application/vnd.openxmlformats-officedocument.presentationml.template; %unixfilename -view %s
182 application/vnd.ms-powerpoint.template.macroenabled.12; %unixfilename -view %s
185 # and replace the original file
186 mv -f /etc/mailcap.tmp$$ /etc/mailcap
189 %{update_menus}
192 %install
193 rm -rf $RPM_BUILD_ROOT/*
195 # hack/workaround to make SuSE's brp-symlink-script happy. It wants the targets of all links
196 # to be present on the build-system/the buildroot. But the point is that we generate stale
197 # links intentionally (until we find a better solution) #46226
198 export NO_BRP_STALE_LINK_ERROR=yes
200 mkdir -p $RPM_BUILD_ROOT
202 export DESTDIR=$RPM_BUILD_ROOT
203 export KDEMAINDIR=/usr
204 export GNOMEDIR=/usr
206 ./create_tree.sh
209 # Mandriva menus fun
211 # For more info, see:
213 # http://qa.mandriva.com/twiki/bin/view/Main/MenuSystem
215 %define _menudir /usr/lib/menu
216 mkdir -p $RPM_BUILD_ROOT%{_menudir}
217 rm -f "$RPM_BUILD_ROOT%{_menudir}/%{name}"
219 GenerateMenu() {
220 [ -f "$RPM_BUILD_ROOT%{_menudir}/%{name}" ] || touch $RPM_BUILD_ROOT%{_menudir}/%{name}
221 mimetypes_item=
222 [ "$7" != "" ] && mimetypes_item="mimetypes=\"$7\""
223 cat >> $RPM_BUILD_ROOT%{_menudir}/%{name} << EOF
224 ?package(%pkgprefix-$6): needs=x11 section="$2" icon="%iconprefix-$3.png" title="$4" longtitle="$5" command="$1" \
225 $mimetypes_item kde_opt="InitialPreference=100" startup_notify="true"
230 # FIXME: Office/Database request in the Cooker ML, leave in Spreadsheets
231 # until new group will be created
233 GenerateMenu "%unixfilename -base" \
234 "More Applications/Databases" \
235 "base" \
236 "%productname %{menuversion} Base" \
237 "%productname %{menuversion} Database" \
238 "core01" \
239 "application/vnd.oasis.opendocument.database,application/vnd.sun.xml.base"
241 GenerateMenu "%unixfilename -calc" \
242 "Office/Spreadsheets" \
243 "calc" \
244 "%productname %{menuversion} Calc" \
245 "%productname %{menuversion} Spreadsheet" \
246 "calc" \
247 "application/vnd.oasis.opendocument.spreadsheet,application/vnd.oasis.opendocument.spreadsheet-template,application/vnd.sun.xml.calc,application/vnd.sun.xml.calc.template,application/vnd.stardivision.calc,application/vnd.stardivision.chart,application/msexcel,application/vnd.ms-excel"
249 GenerateMenu "%unixfilename -draw" \
250 "Office/Drawing" \
251 "draw" \
252 "%productname %{menuversion} Draw" \
253 "%productname %{menuversion} Drawing" \
254 "draw" \
255 "application/vnd.oasis.opendocument.graphics,application/vnd.oasis.opendocument.graphics-template,application/vnd.sun.xml.draw,application/vnd.sun.xml.draw.template,application/vnd.stardivision.draw"
257 GenerateMenu "%unixfilename -impress" \
258 "Office/Presentations" \
259 "impress" \
260 "%productname %{menuversion} Impress" \
261 "%productname %{menuversion} Presentation" \
262 "impress" \
263 "application/vnd.oasis.opendocument.presentation,application/vnd.oasis.opendocument.presentation-template,application/vnd.sun.xml.impress,application/vnd.sun.xml.impress.template,application/vnd.stardivision.impress,application/mspowerpoint"
265 GenerateMenu "%unixfilename -writer" \
266 "Office/Wordprocessors" \
267 "writer" \
268 "%productname %{menuversion} Writer" \
269 "%productname %{menuversion} Word Processing Component" \
270 "writer" \
271 "application/vnd.oasis.opendocument.text,application/vnd.oasis.opendocument.text-template,application/vnd.oasis.opendocument.text-web,application/vnd.oasis.opendocument.text-master,application/vnd.sun.xml.writer,application/vnd.sun.xml.writer.template,application/vnd.sun.xml.writer.global,application/vnd.stardivision.writer,application/msword,application/vnd.ms-word,application/x-doc,application/rtf"
273 GenerateMenu "%unixfilename -math" \
274 "Office/Wordprocessors" \
275 "math" \
276 "%productname %{menuversion} Math" \
277 "%productname %{menuversion} Formula Editor" \
278 "math" \
279 "application/vnd.oasis.opendocument.formula,application/vnd.sun.xml.math,application/vnd.stardivision.math"
282 # FIXME: Is there a better group than System/Configuration/Printing? I think no ...
284 GenerateMenu "%unixfilename-printeradmin" \
285 "System/Configuration/Printing" \
286 "printeradmin" \
287 "%productname %{menuversion} Printeradmin" \
288 "%productname %{menuversion} Printer Administration" \
289 "core02"
291 %clean
292 rm -rf $RPM_BUILD_ROOT
294 %preun
295 # remove from /etc/mailcap only on de-install
296 if [ "$1" = 0 ]
297 then
298 # backing all entries pointing to our binary
299 sed '/%unixfilename/d' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$
301 # and replace the original file
302 mv -f /etc/mailcap.tmp$$ /etc/mailcap
305 %postun
306 %{update_menus}
309 %files
310 %attr(0755,root,root) /usr/bin/soffice
311 %attr(0755,root,root) %verify(not size md5) /usr/bin/%unixfilename
312 %attr(0755,root,root) /usr/bin/%unixfilename-printeradmin
313 %defattr(0644, root, root)
314 %{_menudir}/%{name}
315 /usr/share/application-registry/*.applications
316 /usr/share/applications/%unixfilename-writer.desktop
317 /usr/share/applications/%unixfilename-calc.desktop
318 /usr/share/applications/%unixfilename-draw.desktop
319 /usr/share/applications/%unixfilename-impress.desktop
320 /usr/share/applications/%unixfilename-math.desktop
321 /usr/share/applications/%unixfilename-base.desktop
322 /usr/share/applications/%unixfilename-printeradmin.desktop
323 /usr/share/applications/%unixfilename-startcenter.desktop
324 /usr/share/mime-info/*.keys
325 /usr/share/mime-info/*.mime
326 /usr/share/mimelnk/application/*.desktop
327 /usr/share/icons/gnome/*/apps/*png
328 /usr/share/icons/gnome/*/mimetypes/*png
329 /usr/share/icons/hicolor/*/apps/*png
330 /usr/share/icons/hicolor/*/mimetypes/*png
331 /usr/share/icons/locolor/*/apps/*png
332 /usr/share/icons/locolor/*/mimetypes/*png