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