1# version and release passed by command-line 2Version: %version 3Release: %release 4Summary: %productname desktop integration 5Name: %pkgprefix-freedesktop-menus 6#BuildRequires: sed 7#BuildRequires: perl 8Group: Office 9License: LGPL 10Provides: openoffice.org3-desktop-integration 11Conflicts: %pkgprefix-suse-menus 12Conflicts: %pkgprefix-debian-menus 13Conflicts: %pkgprefix-redhat-menus 14Conflicts: %pkgprefix-mandriva-menus 15BuildArch: noarch 16AutoReqProv: no 17%define _binary_filedigest_algorithm 1 18%define _binary_payload w9.gzdio 19 20%description 21%productname desktop integration for desktop-environments that implement 22the menu- and mime-related specifications from http://www.freedesktop.org 23Install this package if you're using a distribution not covered by any of 24the other %pkgprefix-<distribution>-menus packages. 25 26%install 27rm -rf $RPM_BUILD_ROOT 28 29# hack/workaround to make SuSE's brp-symlink-script happy. It wants the targets of all links 30# to be present on the build-system/the buildroot. But the point is that we generate stale 31# links intentionally (until we find a better solution) #46226 32export NO_BRP_STALE_LINK_ERROR=yes 33 34mkdir -p $RPM_BUILD_ROOT 35 36# FIXME: remove - only purpose is to create packages identical to OOF680 m8 37umask 0000 38 39# set parameters for the create_tree script 40export DESTDIR=$RPM_BUILD_ROOT 41export KDEMAINDIR=/usr 42export GNOMEDIR=/usr 43export GNOME_MIME_THEME=hicolor 44 45./create_tree.sh 46 47cd $RPM_BUILD_ROOT 48 49# freedesktop-based desktop-environments don't need/use this. 50rm -rf usr/share/application-registry 51rm -rf usr/share/applications.flag 52rm -rf usr/share/mime-info 53rm -rf usr/share/mimelnk 54rm -rf usr/share/applnk-redhat 55#find usr/share/icons -name '*.png' -exec chmod g+w {} \; 56 57%clean 58rm -rf $RPM_BUILD_ROOT 59 60%triggerin -- %pkgprefix, %pkgprefix-writer, %pkgprefix-calc, %pkgprefix-draw, %pkgprefix-impress, %pkgprefix-math 61# this is run when one of the above packages is already installed and the menu 62# package gets installed OR when the menu-package is already installed and one 63# of the above listed packages gets installed 64 65# Dut to a bug in rpm it is not possible to check why the script is triggered... 66# This is how it should be: 1st arg: number of this package, 2nd arg: number of 67# package that triggers - the bug is that rpm reports the same number for both 68# (the value of the 2nd one), so just run this always... 69# http://rhn.redhat.com/errata/RHBA-2004-098.html 70# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=100509 71 72if [ -x /opt/gnome/bin/update-desktop-database ]; then 73 /opt/gnome/bin/update-desktop-database -q 74elif (which update-desktop-database); then 75 update-desktop-database -q /usr/share/applications 76fi 77 78%triggerun -- %pkgprefix, %pkgprefix-writer, %pkgprefix-calc, %pkgprefix-draw, %pkgprefix-impress, %pkgprefix-math 79if [ "$1" = "0" ] ; then 80 # the menu-package gets uninstalled/updated - postun will run the command 81 exit 0 82fi 83if [ "$2" = "0" ] ; then 84 # the triggering package gets removed 85 if [ -x /opt/gnome/bin/update-desktop-database ]; then 86 /opt/gnome/bin/update-desktop-database -q 87 elif (which update-desktop-database); then 88 update-desktop-database -q /usr/share/applications 89 fi 90fi 91 92%post 93# no need to run it when updating, since %postun of the old package is run 94# afterwards 95 96if [ "$1" = "1" ] ; then # first install 97 if [ -x /opt/gnome/bin/update-desktop-database ]; then 98 /opt/gnome/bin/update-desktop-database -q 99 elif (which update-desktop-database); then 100 update-desktop-database -q /usr/share/applications 101 fi 102 103 if (which update-mime-database); then 104 update-mime-database /usr/share/mime 105 fi 106fi 107 108 109#run always 110for theme in gnome hicolor locolor; do 111 if [ -e /usr/share/icons/$theme/icon-theme.cache ] ; then 112 # touch it, just in case we cannot find the binary... 113 touch /usr/share/icons/$theme 114 if [ -x /opt/gnome/bin/gtk-update-icon-cache ]; then 115 /opt/gnome/bin/gtk-update-icon-cache -q /usr/share/icons/$theme 116 elif (which gtk-update-icon-cache); then 117 gtk-update-icon-cache -q /usr/share/icons/$theme 118 fi 119 # ignore errors (e.g. when there is a cache, but no index.theme) 120 true 121 fi 122done 123 124 125# update /etc/mime.types 126# backing out existing entries to avoid duplicates 127sed ' 128/application\/vnd\.oasis\.opendocument/d 129/application\/vnd\.sun/d 130/application\/vnd\.stardivision/d 131/application\/vnd\.openofficeorg/d 132' /etc/mime.types 2>/dev/null >> /etc/mime.types.tmp$$ 133 134# now append our stuff to the temporary file 135cat >> /etc/mime.types.tmp$$ << END 136application/vnd.oasis.opendocument.text odt 137application/vnd.oasis.opendocument.text-template ott 138application/vnd.oasis.opendocument.text-web oth 139application/vnd.oasis.opendocument.text-master odm 140application/vnd.oasis.opendocument.graphics odg 141application/vnd.oasis.opendocument.graphics-template otg 142application/vnd.oasis.opendocument.presentation odp 143application/vnd.oasis.opendocument.presentation-template otp 144application/vnd.oasis.opendocument.spreadsheet ods 145application/vnd.oasis.opendocument.spreadsheet-template ots 146application/vnd.oasis.opendocument.chart odc 147application/vnd.oasis.opendocument.formula odf 148application/vnd.oasis.opendocument.image odi 149application/vnd.sun.xml.writer sxw 150application/vnd.sun.xml.writer.template stw 151application/vnd.sun.xml.writer.global sxg 152application/vnd.stardivision.writer sdw vor 153application/vnd.stardivision.writer-global sgl 154application/vnd.sun.xml.calc sxc 155application/vnd.sun.xml.calc.template stc 156application/vnd.stardivision.calc sdc 157application/vnd.stardivision.chart sds 158application/vnd.sun.xml.impress sxi 159application/vnd.sun.xml.impress.template sti 160application/vnd.stardivision.impress sdd sdp 161application/vnd.sun.xml.draw sxd 162application/vnd.sun.xml.draw.template std 163application/vnd.stardivision.draw sda 164application/vnd.sun.xml.math sxm 165application/vnd.sun.xml.base odb 166application/vnd.stardivision.math smf 167application/vnd.openofficeorg.extension oxt 168application/vnd.openxmlformats-officedocument.wordprocessingml.document docx 169application/vnd.ms-word.document.macroenabled.12 docm 170application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx 171application/vnd.ms-word.template.macroenabled.12 dotm 172application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx 173application/vnd.ms-excel.sheet.macroenabled.12 xlsm 174application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx 175application/vnd.ms-excel.template.macroenabled.12 xltm 176application/vnd.openxmlformats-officedocument.presentationml.presentation pptx 177application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm 178application/vnd.openxmlformats-officedocument.presentationml.template potx 179application/vnd.ms-powerpoint.template.macroenabled.12 potm 180END 181 182# and replace the original file 183mv -f /etc/mime.types.tmp$$ /etc/mime.types 2>/dev/null 184 185# update /etc/mailcap only at initial install 186if [ "$1" = 1 ] 187then 188 # backing out existing entries to avoid duplicates 189 sed ' 190/^# OpenOffice.org/d 191/^application\/vnd\.oasis\.opendocument/d 192/^application\/vnd\.openofficeorg/d 193/^application\/vnd\.sun/d 194/^application\/vnd\.stardivision/d 195/^application\/vnd\.ms-word/d 196/^application\/vnd\.ms-excel/d 197/^application\/vnd\.ms-powerpoint/d 198/^application\/x-star/d 199/excel/d 200/ms[-]*word/d 201/powerpoint/d 202' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$ 203 204 # now append our stuff to the temporary file 205 cat >> /etc/mailcap.tmp$$ << END 206# OpenOffice.org 207application/vnd.oasis.opendocument.text; %unixfilename -view %s 208application/vnd.oasis.opendocument.text-template; %unixfilename -view %s 209application/vnd.oasis.opendocument.text-web; %unixfilename -view %s 210application/vnd.oasis.opendocument.text-master; %unixfilename -view %s 211application/vnd.sun.xml.writer; %unixfilename -view %s 212application/vnd.sun.xml.writer.template; %unixfilename -view %s 213application/vnd.sun.xml.writer.global; %unixfilename -view %s 214application/vnd.stardivision.writer; %unixfilename -view %s 215application/vnd.stardivision.writer-global; %unixfilename -view %s 216application/x-starwriter; %unixfilename -view %s 217application/vnd.oasis.opendocument.formula; %unixfilename -view %s 218application/vnd.sun.xml.math; %unixfilename -view %s 219application/vnd.stardivision.math; %unixfilename -view %s 220application/x-starmath; %unixfilename -view %s 221application/msword; %unixfilename -view %s 222application/vnd.oasis.opendocument.spreadsheet; %unixfilename -view %s 223application/vnd.oasis.opendocument.spreadsheet-template; %unixfilename -view %s 224application/vnd.sun.xml.calc; %unixfilename -view %s 225application/vnd.sun.xml.calc.template; %unixfilename -view %s 226application/vnd.stardivision.calc; %unixfilename -view %s 227application/x-starcalc; %unixfilename -view %s 228application/vnd.stardivision.chart; %unixfilename -view %s 229application/x-starchart; %unixfilename -view %s 230application/excel; %unixfilename -view %s 231application/msexcel; %unixfilename -view %s 232application/vnd.ms-excel; %unixfilename -view %s 233application/x-msexcel; %unixfilename -view %s 234application/vnd.oasis.opendocument.presentation; %unixfilename -view %s 235application/vnd.oasis.opendocument.presentation-template; %unixfilename -view %s 236application/vnd.sun.xml.impress; %unixfilename -view %s 237application/vnd.sun.xml.impress.template; %unixfilename -view %s 238application/vnd.stardivision.impress; %unixfilename -view %s 239application/x-starimpress; %unixfilename -view %s 240application/powerpoint; %unixfilename -view %s 241application/mspowerpoint; %unixfilename -view %s 242application/vnd.ms-powerpoint; %unixfilename -view %s 243application/x-mspowerpoint; %unixfilename -view %s 244application/vnd.oasis.opendocument.graphics; %unixfilename -view %s 245application/vnd.oasis.opendocument.graphics-template; %unixfilename -view %s 246application/vnd.sun.xml.draw; %unixfilename -view %s 247application/vnd.sun.xml.draw.template; %unixfilename -view %s 248application/vnd.stardivision.draw; %unixfilename -view %s 249application/x-stardraw; %unixfilename -view %s 250application/vnd.oasis.opendocument.database; %unixfilename -view %s 251application/vnd.sun.xml.base; %unixfilename -view %s 252application/vnd.openofficeorg.extension; %unixfilename %s 253application/vnd.openxmlformats-officedocument.wordprocessingml.document; %unixfilename -view %s 254application/vnd.ms-word.document.macroenabled.12;%unixfilename -view %s 255application/vnd.openxmlformats-officedocument.wordprocessingml.template; %unixfilename -view %s 256application/vnd.ms-word.template.macroenabled.12; %unixfilename -view %s 257application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; %unixfilename -view %s 258application/vnd.ms-excel.sheet.macroenabled.12; %unixfilename -view %s 259application/vnd.openxmlformats-officedocument.spreadsheetml.template; %unixfilename -view %s 260application/vnd.ms-excel.template.macroenabled.12; %unixfilename -view %s 261application/vnd.openxmlformats-officedocument.presentationml.presentation; %unixfilename -view %s 262application/vnd.ms-powerpoint.presentation.macroenabled.12; %unixfilename -view %s 263application/vnd.openxmlformats-officedocument.presentationml.template; %unixfilename -view %s 264application/vnd.ms-powerpoint.template.macroenabled.12; %unixfilename -view %s 265END 266 267 # and replace the original file 268 mv -f /etc/mailcap.tmp$$ /etc/mailcap 269fi 270 271if [ -x /opt/gnome/bin/update-desktop-database ]; then 272 /opt/gnome/bin/update-desktop-database -q 273elif (which update-desktop-database); then 274 update-desktop-database -q /usr/share/applications 275fi 276 277%preun 278# remove from /etc/mailcap only on de-install 279if [ "$1" = 0 ] 280then 281 # backing all entries pointing to our binary 282 sed '/%unixfilename/d' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$ 283 284 # and replace the original file 285 mv -f /etc/mailcap.tmp$$ /etc/mailcap 286fi 287 288%postun 289if [ "$1" = 0 ] ; then # only run when erasing the package - other cases handled by the triggers 290 if [ -x /opt/gnome/bin/update-desktop-database ]; then 291 /opt/gnome/bin/update-desktop-database -q 292 elif (which update-desktop-database); then 293 update-desktop-database -q 294 fi 295# run always - both when upgrading as well as when erasing the package 296 if (which update-mime-database); then 297 update-mime-database /usr/share/mime 298 fi 299fi 300 301#run always 302for theme in gnome hicolor locolor; do 303 if [ -e /usr/share/icons/$theme/icon-theme.cache ] ; then 304 # touch it, just in case we cannot find the binary... 305 touch /usr/share/icons/$theme 306 if [ -x /opt/gnome/bin/gtk-update-icon-cache ]; then 307 /opt/gnome/bin/gtk-update-icon-cache -q /usr/share/icons/$theme 308 elif (which gtk-update-icon-cache); then 309 gtk-update-icon-cache -q /usr/share/icons/$theme 310 fi 311 # ignore errors (e.g. when there is a cache, but no index.theme) 312 true 313 fi 314done 315 316%files 317# specify stale symlinks verbatim, not as glob - a change in recent versions of 318# glibc breaks rpm unless rpm is build with internal glob-matching (issue 49374) 319# https://bugzilla.redhat.com/beta/show_bug.cgi?id=134362 320%defattr(-, root, root) 321%attr(0755, root, root) /usr/bin/* 322/usr/share/applications/%unixfilename-base.desktop 323/usr/share/applications/%unixfilename-calc.desktop 324/usr/share/applications/%unixfilename-draw.desktop 325/usr/share/applications/%unixfilename-impress.desktop 326/usr/share/applications/%unixfilename-math.desktop 327/usr/share/applications/%unixfilename-printeradmin.desktop 328/usr/share/applications/%unixfilename-writer.desktop 329/usr/share/applications/%unixfilename-startcenter.desktop 330/usr/share/applications/%unixfilename-javafilter.desktop 331/usr/share/icons/gnome/*/apps/*png 332/usr/share/icons/gnome/*/mimetypes/*png 333/usr/share/icons/hicolor/*/apps/*png 334/usr/share/icons/hicolor/*/mimetypes/*png 335/usr/share/icons/locolor/*/apps/*png 336/usr/share/icons/locolor/*/mimetypes/*png 337/usr/share/mime/packages/* 338