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