1cdf0e10cSrcweir# version and release passed by command-line 2cdf0e10cSrcweirVersion: %version 3cdf0e10cSrcweirRelease: %release 4cdf0e10cSrcweirSummary: %productname desktop integration 5cdf0e10cSrcweirName: %pkgprefix-redhat-menus 6cdf0e10cSrcweirGroup: Office 7*bda541ebSArmin Le GrandLicense: ALv2 8*bda541ebSArmin Le GrandVendor: Apache Software Foundation 9cdf0e10cSrcweirAutoReqProv: no 10cdf0e10cSrcweirBuildArch: noarch 11cdf0e10cSrcweirRequires: redhat-release 12cdf0e10cSrcweirProvides: openoffice.org3-desktop-integration 13cdf0e10cSrcweir%define _unpackaged_files_terminate_build 0 14cdf0e10cSrcweir%define _binary_filedigest_algorithm 1 15cdf0e10cSrcweir%define _binary_payload w9.gzdio 16cdf0e10cSrcweir%description 17cdf0e10cSrcweir%productname desktop integration 18cdf0e10cSrcweir 19cdf0e10cSrcweir%install 20cdf0e10cSrcweir# hack/workaround to make SuSE's brp-symlink-script happy. It wants the targets of all links 21cdf0e10cSrcweir# to be present on the build-system/the buildroot. But the point is that we generate stale 22cdf0e10cSrcweir# links intentionally (until we find a better solution) #46226 23cdf0e10cSrcweirexport NO_BRP_STALE_LINK_ERROR=yes 24cdf0e10cSrcweir 25cdf0e10cSrcweirmkdir -p $RPM_BUILD_ROOT 26cdf0e10cSrcweir 27cdf0e10cSrcweir# set parameters for the create_tree script 28cdf0e10cSrcweirexport DESTDIR=$RPM_BUILD_ROOT 29cdf0e10cSrcweirexport KDEMAINDIR=/usr 30cdf0e10cSrcweirexport GNOMEDIR=/usr 31cdf0e10cSrcweirexport GNOME_MIME_THEME=hicolor 32cdf0e10cSrcweir 33cdf0e10cSrcweir./create_tree.sh 34cdf0e10cSrcweir 35cdf0e10cSrcweir# legacy redhat KDE location for .desktop files 36cdf0e10cSrcweirmkdir -p $RPM_BUILD_ROOT/usr/share/applnk-redhat/Office 37cdf0e10cSrcweirfor i in `cat launcherlist`; do 38cdf0e10cSrcweir ln -sf /opt/%unixfilename/share/xdg/$i $RPM_BUILD_ROOT/usr/share/applnk-redhat/Office/%unixfilename-$i 39cdf0e10cSrcweirdone 40cdf0e10cSrcweir 41cdf0e10cSrcweir%clean 42cdf0e10cSrcweirrm -rf $RPM_BUILD_ROOT 43cdf0e10cSrcweir 44cdf0e10cSrcweir%triggerin -- %pkgprefix, %pkgprefix-writer, %pkgprefix-calc, %pkgprefix-draw, %pkgprefix-impress, %pkgprefix-base, %pkgprefix-math 45cdf0e10cSrcweirif [ -x /usr/bin/update-desktop-database ]; then 46cdf0e10cSrcweir update-desktop-database -q /usr/share/applications 47cdf0e10cSrcweirfi 48cdf0e10cSrcweir 49cdf0e10cSrcweir%triggerun -- %pkgprefix, %pkgprefix-writer, %pkgprefix-calc, %pkgprefix-draw, %pkgprefix-impress, %pkgprefix-base, %pkgprefix-math 50cdf0e10cSrcweirif [ "$1" = "0" ] ; then 51cdf0e10cSrcweir # the menu-package gets uninstalled/updated - postun will run the command 52cdf0e10cSrcweir exit 0 53cdf0e10cSrcweirfi 54cdf0e10cSrcweirif [ "$2" = "0" ] ; then 55cdf0e10cSrcweir # the triggering package gets removed 56cdf0e10cSrcweir if [ -x /usr/bin/update-desktop-database ]; then 57cdf0e10cSrcweir update-desktop-database -q /usr/share/applications 58cdf0e10cSrcweir fi 59cdf0e10cSrcweirfi 60cdf0e10cSrcweir 61cdf0e10cSrcweir%post 62cdf0e10cSrcweir# run always, since there are versions of this package that did not include 63cdf0e10cSrcweir# a shared-mime-info xml file 64cdf0e10cSrcweirif [ -x /usr/bin/update-mime-database ]; then 65cdf0e10cSrcweir update-mime-database /usr/share/mime 66cdf0e10cSrcweirfi 67cdf0e10cSrcweir 68cdf0e10cSrcweir# run only on first install, since postun is run when updating 69cdf0e10cSrcweir# post would be run before the old files are removed 70cdf0e10cSrcweirif [ "$1" = "1" ] ; then # first install 71cdf0e10cSrcweir for theme in gnome hicolor locolor; do 72cdf0e10cSrcweir if [ -e /usr/share/icons/$theme/icon-theme.cache ] ; then 73cdf0e10cSrcweir # touch it, just in case we cannot find the binary... 74cdf0e10cSrcweir touch /usr/share/icons/$theme 75cdf0e10cSrcweir if (which gtk-update-icon-cache); then 76cdf0e10cSrcweir gtk-update-icon-cache /usr/share/icons/$theme 77cdf0e10cSrcweir fi 78cdf0e10cSrcweir # ignore errors (e.g. when there is a cache, but no index.theme) 79cdf0e10cSrcweir true 80cdf0e10cSrcweir fi 81cdf0e10cSrcweir done 82cdf0e10cSrcweirfi 83cdf0e10cSrcweir 84cdf0e10cSrcweir# update /etc/mime.types 85cdf0e10cSrcweir# backing out existing entries to avoid duplicates 86cdf0e10cSrcweirsed ' 87cdf0e10cSrcweir/application\/vnd\.oasis\.opendocument/d 88cdf0e10cSrcweir/application\/vnd\.openofficeorg/d 89cdf0e10cSrcweir/application\/vnd\.sun/d 90cdf0e10cSrcweir/application\/vnd\.stardivision/d 91cdf0e10cSrcweir' /etc/mime.types 2>/dev/null >> /etc/mime.types.tmp$$ 92cdf0e10cSrcweir 93cdf0e10cSrcweir# now append our stuff to the temporary file 94cdf0e10cSrcweircat >> /etc/mime.types.tmp$$ << END 95cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text odt 96cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-template ott 97cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-web oth 98cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-master odm 99cdf0e10cSrcweirapplication/vnd.oasis.opendocument.graphics odg 100cdf0e10cSrcweirapplication/vnd.oasis.opendocument.graphics-template otg 101cdf0e10cSrcweirapplication/vnd.oasis.opendocument.presentation odp 102cdf0e10cSrcweirapplication/vnd.oasis.opendocument.presentation-template otp 103cdf0e10cSrcweirapplication/vnd.oasis.opendocument.spreadsheet ods 104cdf0e10cSrcweirapplication/vnd.oasis.opendocument.spreadsheet-template ots 105cdf0e10cSrcweirapplication/vnd.oasis.opendocument.chart odc 106cdf0e10cSrcweirapplication/vnd.oasis.opendocument.formula odf 107cdf0e10cSrcweirapplication/vnd.oasis.opendocument.image odi 108cdf0e10cSrcweirapplication/vnd.sun.xml.writer sxw 109cdf0e10cSrcweirapplication/vnd.sun.xml.writer.template stw 110cdf0e10cSrcweirapplication/vnd.sun.xml.writer.global sxg 111cdf0e10cSrcweirapplication/vnd.stardivision.writer sdw vor 112cdf0e10cSrcweirapplication/vnd.stardivision.writer-global sgl 113cdf0e10cSrcweirapplication/vnd.sun.xml.calc sxc 114cdf0e10cSrcweirapplication/vnd.sun.xml.calc.template stc 115cdf0e10cSrcweirapplication/vnd.stardivision.calc sdc 116cdf0e10cSrcweirapplication/vnd.stardivision.chart sds 117cdf0e10cSrcweirapplication/vnd.sun.xml.impress sxi 118cdf0e10cSrcweirapplication/vnd.sun.xml.impress.template sti 119cdf0e10cSrcweirapplication/vnd.stardivision.impress sdd sdp 120cdf0e10cSrcweirapplication/vnd.sun.xml.draw sxd 121cdf0e10cSrcweirapplication/vnd.sun.xml.draw.template std 122cdf0e10cSrcweirapplication/vnd.stardivision.draw sda 123cdf0e10cSrcweirapplication/vnd.sun.xml.math sxm 124cdf0e10cSrcweirapplication/vnd.stardivision.math smf 125cdf0e10cSrcweirapplication/vnd.sun.xml.base odb 126cdf0e10cSrcweirapplication/vnd.openofficeorg.extension oxt 127cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.wordprocessingml.document docx 128cdf0e10cSrcweirapplication/vnd.ms-word.document.macroenabled.12 docm 129cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.wordprocessingml.template dotx 130cdf0e10cSrcweirapplication/vnd.ms-word.template.macroenabled.12 dotm 131cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx 132cdf0e10cSrcweirapplication/vnd.ms-excel.sheet.macroenabled.12 xlsm 133cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.spreadsheetml.template xltx 134cdf0e10cSrcweirapplication/vnd.ms-excel.template.macroenabled.12 xltm 135cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.presentationml.presentation pptx 136cdf0e10cSrcweirapplication/vnd.ms-powerpoint.presentation.macroenabled.12 pptm 137cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.presentationml.template potx 138cdf0e10cSrcweirapplication/vnd.ms-powerpoint.template.macroenabled.12 potm 139cdf0e10cSrcweirEND 140cdf0e10cSrcweir 141cdf0e10cSrcweir# and replace the original file 142cdf0e10cSrcweirmv -f /etc/mime.types.tmp$$ /etc/mime.types 2>/dev/null 143cdf0e10cSrcweir 144cdf0e10cSrcweir# update /etc/mailcap only at initial install 145cdf0e10cSrcweirif [ "$1" = 1 ] 146cdf0e10cSrcweirthen 147cdf0e10cSrcweir # backing out existing entries to avoid duplicates 148cdf0e10cSrcweir sed ' 149cdf0e10cSrcweir/^# OpenOffice.org/d 150cdf0e10cSrcweir/^application\/vnd\.oasis\.opendocument/d 151cdf0e10cSrcweir/^application\/vnd\.openofficeorg/d 152cdf0e10cSrcweir/^application\/vnd\.sun/d 153cdf0e10cSrcweir/^application\/vnd\.stardivision/d 154cdf0e10cSrcweir/^application\/vnd\.ms-word/d 155cdf0e10cSrcweir/^application\/vnd\.ms-excel/d 156cdf0e10cSrcweir/^application\/vnd\.ms-powerpoint/d 157cdf0e10cSrcweir/^application\/x-star/d 158cdf0e10cSrcweir/excel/d 159cdf0e10cSrcweir/ms[-]*word/d 160cdf0e10cSrcweir/powerpoint/d 161cdf0e10cSrcweir' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$ 162cdf0e10cSrcweir 163cdf0e10cSrcweir # now append our stuff to the temporary file 164cdf0e10cSrcweir cat >> /etc/mailcap.tmp$$ << END 165*bda541ebSArmin Le Grand# Apache OpenOffice 166cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text; %unixfilename -view %s 167cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-template; %unixfilename -view %s 168cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-web; %unixfilename -view %s 169cdf0e10cSrcweirapplication/vnd.oasis.opendocument.text-master; %unixfilename -view %s 170cdf0e10cSrcweirapplication/vnd.sun.xml.writer; %unixfilename -view %s 171cdf0e10cSrcweirapplication/vnd.sun.xml.writer.template; %unixfilename -view %s 172cdf0e10cSrcweirapplication/vnd.sun.xml.writer.global; %unixfilename -view %s 173cdf0e10cSrcweirapplication/vnd.stardivision.writer; %unixfilename -view %s 174cdf0e10cSrcweirapplication/vnd.stardivision.writer-global; %unixfilename -view %s 175cdf0e10cSrcweirapplication/x-starwriter; %unixfilename -view %s 176cdf0e10cSrcweirapplication/vnd.oasis.opendocument.formula; %unixfilename -view %s 177cdf0e10cSrcweirapplication/vnd.sun.xml.math; %unixfilename -view %s 178cdf0e10cSrcweirapplication/vnd.stardivision.math; %unixfilename -view %s 179cdf0e10cSrcweirapplication/x-starmath; %unixfilename -view %s 180cdf0e10cSrcweirapplication/msword; %unixfilename -view %s 181cdf0e10cSrcweirapplication/vnd.oasis.opendocument.spreadsheet; %unixfilename -view %s 182cdf0e10cSrcweirapplication/vnd.oasis.opendocument.spreadsheet-template; %unixfilename -view %s 183cdf0e10cSrcweirapplication/vnd.sun.xml.calc; %unixfilename -view %s 184cdf0e10cSrcweirapplication/vnd.sun.xml.calc.template; %unixfilename -view %s 185cdf0e10cSrcweirapplication/vnd.stardivision.calc; %unixfilename -view %s 186cdf0e10cSrcweirapplication/x-starcalc; %unixfilename -view %s 187cdf0e10cSrcweirapplication/vnd.stardivision.chart; %unixfilename -view %s 188cdf0e10cSrcweirapplication/x-starchart; %unixfilename -view %s 189cdf0e10cSrcweirapplication/excel; %unixfilename -view %s 190cdf0e10cSrcweirapplication/msexcel; %unixfilename -view %s 191cdf0e10cSrcweirapplication/vnd.ms-excel; %unixfilename -view %s 192cdf0e10cSrcweirapplication/x-msexcel; %unixfilename -view %s 193cdf0e10cSrcweirapplication/vnd.oasis.opendocument.presentation; %unixfilename -view %s 194cdf0e10cSrcweirapplication/vnd.oasis.opendocument.presentation-template; %unixfilename -view %s 195cdf0e10cSrcweirapplication/vnd.sun.xml.impress; %unixfilename -view %s 196cdf0e10cSrcweirapplication/vnd.sun.xml.impress.template; %unixfilename -view %s 197cdf0e10cSrcweirapplication/vnd.stardivision.impress; %unixfilename -view %s 198cdf0e10cSrcweirapplication/x-starimpress; %unixfilename -view %s 199cdf0e10cSrcweirapplication/powerpoint; %unixfilename -view %s 200cdf0e10cSrcweirapplication/mspowerpoint; %unixfilename -view %s 201cdf0e10cSrcweirapplication/vnd.ms-powerpoint; %unixfilename -view %s 202cdf0e10cSrcweirapplication/x-mspowerpoint; %unixfilename -view %s 203cdf0e10cSrcweirapplication/vnd.oasis.opendocument.graphics; %unixfilename -view %s 204cdf0e10cSrcweirapplication/vnd.oasis.opendocument.graphics-template; %unixfilename -view %s 205cdf0e10cSrcweirapplication/vnd.sun.xml.draw; %unixfilename -view %s 206cdf0e10cSrcweirapplication/vnd.sun.xml.draw.template; %unixfilename -view %s 207cdf0e10cSrcweirapplication/vnd.stardivision.draw; %unixfilename -view %s 208cdf0e10cSrcweirapplication/x-stardraw; %unixfilename -view %s 209cdf0e10cSrcweirapplication/vnd.oasis.opendocument.database; %unixfilename -view %s 210cdf0e10cSrcweirapplication/vnd.sun.xml.base; %unixfilename -view %s 211cdf0e10cSrcweirapplication/vnd.writerperfect; %unixfilename -view %s 212cdf0e10cSrcweirapplication/wordperfect5.1; %unixfilename -view %s 213cdf0e10cSrcweirapplication/x-wordperfect; %unixfilename -view %s 214cdf0e10cSrcweirapplication/wordperfect; %unixfilename -view %s 215cdf0e10cSrcweirapplication/wpwin; %unixfilename -view %s 216cdf0e10cSrcweirapplication/vnd.openofficeorg.extension; %unixfilename %s 217cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.wordprocessingml.document; %unixfilename -view %s 218cdf0e10cSrcweirapplication/vnd.ms-word.document.macroenabled.12;%unixfilename -view %s 219cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.wordprocessingml.template; %unixfilename -view %s 220cdf0e10cSrcweirapplication/vnd.ms-word.template.macroenabled.12; %unixfilename -view %s 221cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet; %unixfilename -view %s 222cdf0e10cSrcweirapplication/vnd.ms-excel.sheet.macroenabled.12; %unixfilename -view %s 223cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.spreadsheetml.template; %unixfilename -view %s 224cdf0e10cSrcweirapplication/vnd.ms-excel.template.macroenabled.12; %unixfilename -view %s 225cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.presentationml.presentation; %unixfilename -view %s 226cdf0e10cSrcweirapplication/vnd.ms-powerpoint.presentation.macroenabled.12; %unixfilename -view %s 227cdf0e10cSrcweirapplication/vnd.openxmlformats-officedocument.presentationml.template; %unixfilename -view %s 228cdf0e10cSrcweirapplication/vnd.ms-powerpoint.template.macroenabled.12; %unixfilename -view %s 229cdf0e10cSrcweirEND 230cdf0e10cSrcweir 231cdf0e10cSrcweir # and replace the original file 232cdf0e10cSrcweir mv -f /etc/mailcap.tmp$$ /etc/mailcap 233cdf0e10cSrcweirfi 234cdf0e10cSrcweir 235cdf0e10cSrcweir%preun 236cdf0e10cSrcweir# remove from /etc/mailcap only on de-install 237cdf0e10cSrcweirif [ "$1" = 0 ] 238cdf0e10cSrcweirthen 239cdf0e10cSrcweir # backing all entries pointing to our binary 240cdf0e10cSrcweir sed '/%unixfilename/d' /etc/mailcap 2>/dev/null >> /etc/mailcap.tmp$$ 241cdf0e10cSrcweir 242cdf0e10cSrcweir # and replace the original file 243cdf0e10cSrcweir mv -f /etc/mailcap.tmp$$ /etc/mailcap 244cdf0e10cSrcweirfi 245cdf0e10cSrcweir 246cdf0e10cSrcweir%postun 247cdf0e10cSrcweir# run only when erasing this package, since %post of the new package ran 248cdf0e10cSrcweir# previously or updates already handled by triggers. 249cdf0e10cSrcweirif [ "$1" = 0 ] ; then 250cdf0e10cSrcweir if [ -x /usr/bin/update-desktop-database ]; then 251cdf0e10cSrcweir update-desktop-database -q /usr/share/applications 252cdf0e10cSrcweir fi 253cdf0e10cSrcweir if [ -x /usr/bin/update-mime-database ]; then 254cdf0e10cSrcweir update-mime-database /usr/share/mime 255cdf0e10cSrcweir fi 256cdf0e10cSrcweirfi 257cdf0e10cSrcweir#run always 258cdf0e10cSrcweirfor theme in gnome hicolor locolor; do 259cdf0e10cSrcweir if [ -e /usr/share/icons/$theme/icon-theme.cache ] ; then 260cdf0e10cSrcweir # touch it, just in case we cannot find the binary... 261cdf0e10cSrcweir touch /usr/share/icons/$theme 262cdf0e10cSrcweir if (which gtk-update-icon-cache); then 263cdf0e10cSrcweir gtk-update-icon-cache /usr/share/icons/$theme 264cdf0e10cSrcweir fi 265cdf0e10cSrcweir # ignore errors (e.g. when there is a cache, but no index.theme) 266cdf0e10cSrcweir true 267cdf0e10cSrcweir fi 268cdf0e10cSrcweirdone 269cdf0e10cSrcweir 270cdf0e10cSrcweir%files 271cdf0e10cSrcweir%attr(0755,root,root) /usr/bin/soffice 272cdf0e10cSrcweir%attr(0755,root,root) %verify(not size md5) /usr/bin/%unixfilename 273cdf0e10cSrcweir%attr(0755,root,root) /usr/bin/%unixfilename-printeradmin 274cdf0e10cSrcweir%defattr(0644, root, root) 275cdf0e10cSrcweir/usr/share/application-registry/*.applications 276cdf0e10cSrcweir/usr/share/applications/%unixfilename-writer.desktop 277cdf0e10cSrcweir/usr/share/applications/%unixfilename-calc.desktop 278cdf0e10cSrcweir/usr/share/applications/%unixfilename-draw.desktop 279cdf0e10cSrcweir/usr/share/applications/%unixfilename-impress.desktop 280cdf0e10cSrcweir/usr/share/applications/%unixfilename-math.desktop 281cdf0e10cSrcweir/usr/share/applications/%unixfilename-base.desktop 282cdf0e10cSrcweir/usr/share/applications/%unixfilename-printeradmin.desktop 283cdf0e10cSrcweir/usr/share/applications/%unixfilename-startcenter.desktop 284cdf0e10cSrcweir/usr/share/applications/%unixfilename-javafilter.desktop 285cdf0e10cSrcweir/usr/share/applnk-redhat/Office/%unixfilename-writer.desktop 286cdf0e10cSrcweir/usr/share/applnk-redhat/Office/%unixfilename-calc.desktop 287cdf0e10cSrcweir/usr/share/applnk-redhat/Office/%unixfilename-draw.desktop 288cdf0e10cSrcweir/usr/share/applnk-redhat/Office/%unixfilename-impress.desktop 289cdf0e10cSrcweir/usr/share/applnk-redhat/Office/%unixfilename-math.desktop 290cdf0e10cSrcweir/usr/share/applnk-redhat/Office/%unixfilename-base.desktop 291cdf0e10cSrcweir/usr/share/applnk-redhat/Office/%unixfilename-printeradmin.desktop 292cdf0e10cSrcweir/usr/share/applnk-redhat/Office/%unixfilename-startcenter.desktop 293cdf0e10cSrcweir/usr/share/applnk-redhat/Office/%unixfilename-javafilter.desktop 294cdf0e10cSrcweir/usr/share/mime-info/*.keys 295cdf0e10cSrcweir/usr/share/mime-info/*.mime 296cdf0e10cSrcweir/usr/share/mimelnk/application/*.desktop 297cdf0e10cSrcweir/usr/share/icons/gnome/*/apps/*png 298cdf0e10cSrcweir/usr/share/icons/gnome/*/mimetypes/*png 299cdf0e10cSrcweir/usr/share/icons/hicolor/*/apps/*png 300cdf0e10cSrcweir/usr/share/icons/hicolor/*/mimetypes/*png 301cdf0e10cSrcweir/usr/share/icons/locolor/*/apps/*png 302cdf0e10cSrcweir/usr/share/icons/locolor/*/mimetypes/*png 303cdf0e10cSrcweir/usr/share/mime/packages/* 304